fix(codex): preserve upstream error headers - #4635
Conversation
aa8b4f2 to
8bc6d6b
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8bc6d6b320
ℹ️ 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".
Co-Authored-By: Claude <noreply@anthropic.com>
8bc6d6b to
d530e39
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d530e39a48
ℹ️ 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".
Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0dc8724902
ℹ️ 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".
Summary
Preserve upstream response headers on Codex HTTP errors and parse standard
Retry-Aftervalues before returning the error to the auth/retry and API layers.Fixes #4633.
Root cause
The Codex WebSocket error path already returns
statusErrWithHeaders, but the HTTP execute, streaming bootstrap, and image endpoints callednewCodexStatusErr(status, body). That constructor retained only the status and response body.Consequently:
Retry-Afterheaders could not influence retry scheduling;X-Request-Idwere unavailable to optional downstream header passthrough;Changes
newCodexStatusErrWithHeadersfor Codex HTTP failures.Retry-Afterdelta-seconds and HTTP-date values.Downstream header exposure remains governed by the existing
passthrough-headerssetting and now passes throughFilterUpstreamHeaders;Retry-Afterstill participates in internal 408/5xx cooldown scheduling even when passthrough is disabled. Correlation headers are exposed only when passthrough is enabled.Validation
go test ./internal/runtime/executorgo test ./sdk/cliproxy/auth ./sdk/api/handlersgo vet ./internal/runtime/executor ./sdk/cliproxy/auth ./sdk/api/handlersgo build ./...go test ./...git diff --checkAll passed against current
dev.