goutamadwant opened a new issue, #13176:
URL: https://github.com/apache/seatunnel/issues/13176

   ### Search before asking
   
   - [x] I searched existing issues and pull requests and found no equivalent 
embedding Retry-After fix.
   
   ### What happened
   
   Embedding HTTP adapters classify HTTP 429 and 5xx responses as retryable but 
discard their Retry-After headers. The shared runtime retries using only the 
configured local backoff. This can exhaust the attempt budget during a 
provider's explicitly advertised cooldown, even though the same request would 
succeed after waiting.
   
   Reproduced on dev at f54bb5876bd282b88181b6d93c9f59ec5dd38621 using a local 
OpenAI-compatible HTTP stub. The server returns HTTP 429 with Retry-After: 1 
until its one-second cooldown expires, then returns one valid embedding. With 
two attempts and a 10 ms local backoff, both requests arrive during cooldown 
and the invocation fails with RATE_LIMIT. The regression succeeds when the 
header delay reaches the common retry runtime.
   
   ### Expected behavior
   
   - Honor non-negative integer seconds and HTTP-date values on retryable 
embedding HTTP responses.
   - Wait for the longer of configured local backoff and the provider delay.
   - If the provider delay exceeds a positive configured maximum backoff, stop 
instead of retrying early.
   - Preserve malformed-header fallback, attempt defaults, interruptible waits 
and SDK-owned retry policies.
   
   ### Scope
   
   OPENAI, CUSTOM, ZHIPU, QIANFAN embedding invocations and DOUBAO 
text/multimodal invocations. Qianfan constructor-time OAuth retries, LLM chat 
retries and SDK-owned policies are not changed.
   
   ### SeaTunnel Version
   
   3.1.0-SNAPSHOT, dev at f54bb5876bd282b88181b6d93c9f59ec5dd38621.
   
   ### SeaTunnel Config
   
   The reproduction invokes the existing embedding HTTP adapter and common 
runtime directly; no engine configuration or real provider account is needed. 
Equivalent transform settings:
   
   ```hocon
   model_provider = OPENAI
   model = "test-model"
   api_key = "test-key"
   model_retry_max_attempts = 2
   model_retry_backoff_ms = 10
   model_retry_max_backoff_ms = 2000
   ```
   
   ### Running Command
   
   Regression setup: start an HTTP stub that responds with HTTP 429 and 
`Retry-After: 1` until one second after its first request, then responds with 
`{"data":[{"embedding":[0.1,0.2]}]}`. Invoke the adapter through the shared 
runtime using the settings above. On unchanged dev, both attempts occur before 
cooldown expires; after propagating the header and respecting the delay, the 
second request succeeds.
   
   The added regression is 
`EmbeddingModelDimensionTest#testOpenAIWaitsForRetryAfterCooldown`, run with:
   
   ```shell
   mvn -B -pl seatunnel-transforms-v2 
-Dtest=EmbeddingModelDimensionTest#testOpenAIWaitsForRetryAfterCooldown 
-Dskip.spotless=true test
   ```
   
   This test will be included in the fix branch; it is not present in unchanged 
dev.
   
   ### Error Exception
   
   ```text
   ModelInvocationException: Model invocation failed: provider=OPENAI, 
model=test-model,
   errorType=RATE_LIMIT, retryable=true, httpStatus=429, message=HTTP status 429
   Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
   BUILD FAILURE
   ```
   
   ### Zeta or Flink or Spark Version
   
   Reproduced below the engine boundary in the shared transform runtime.
   
   ### Java or Scala Version
   
   JDK 17 for the failing-before regression.
   
   ### Are you willing to submit PR?
   
   - [x] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to