Skip to content

fix(client): restore 60s cap on Retry-After header#1841

Open
MukundaKatta wants to merge 1 commit intoopenai:masterfrom
MukundaKatta:fix/retry-after-60s-cap
Open

fix(client): restore 60s cap on Retry-After header#1841
MukundaKatta wants to merge 1 commit intoopenai:masterfrom
MukundaKatta:fix/retry-after-60s-cap

Conversation

@MukundaKatta
Copy link
Copy Markdown

Closes #1840.

A refactor in 583240f dropped the 60s cap on Retry-After parsing, so the SDK now sleeps for whatever the server returns (sometimes 30+ minutes), freezing long-running scripts. Restored the original guard so values outside [0, 60s) fall back to calculated backoff.

Added test in tests/index.test.ts. Couldn't run yarn test locally due to sandbox restrictions; happy to adjust if CI flags anything.

@MukundaKatta MukundaKatta requested a review from a team as a code owner April 25, 2026 18:18
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 654185b544

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/client.ts
if (timeoutMillis === undefined) {
// If the API asks us to wait a certain amount of time (and it's a reasonable amount),
// just do what it says, but otherwise calculate a default
if (!(timeoutMillis && 0 <= timeoutMillis && timeoutMillis < 60 * 1000)) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat zero Retry-After as valid delay

The new guard uses timeoutMillis && ..., which makes a parsed Retry-After: 0 (or retry-after-ms: 0) look invalid and fall back to exponential backoff instead of retrying immediately. This changes behavior for explicit zero-delay responses and contradicts the intended [0, 60s) acceptance range mentioned in the commit message; a server that sends 0 will now incur an unnecessary client-side delay.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Retry-After 60-second cap silently removed in chore commit, was this intentional?

1 participant