fix(openai-compat): honor bounded rate-limit waits - #5435
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6f16121554
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| log.Errorf("openai compat executor: close response body error: %v", errClose) | ||
| } | ||
| err = statusErr{code: httpResp.StatusCode, msg: string(b)} | ||
| err = newOpenAICompatStatusError(httpResp.StatusCode, httpResp.Header, b) |
There was a problem hiding this comment.
Preserve retry metadata for streamed image errors
When SourceFormat is openai-image with streaming enabled, ExecuteStream returns through executeImagesStream before reaching this error path. That function's non-2xx branch still returns a plain statusErr at line 650, so a streamed image request receiving a 429 loses both the provider's Retry-After value and the new TPM fallback, causing the auth manager to use its shorter generic cooldown instead. Use newOpenAICompatStatusError in the image-stream bootstrap branch as well.
Useful? React with 👍 / 👎.
Summary
Retry-Afterheaders from OpenAI-compatible HTTP errors into the auth retry/cooldown pathRetry-AfterThis prevents large requests from being replayed immediately through providers that enforce minute-level token windows, while preserving provider-supplied deadlines when available.
Tests
go test ./... -count=1