Skip to content

fix(client): cap Retry-After at 60s#1907

Open
redactdeveloper wants to merge 1 commit into
openai:mainfrom
redactdeveloper:fix/1840-retry-after-cap
Open

fix(client): cap Retry-After at 60s#1907
redactdeveloper wants to merge 1 commit into
openai:mainfrom
redactdeveloper:fix/1840-retry-after-cap

Conversation

@redactdeveloper

Copy link
Copy Markdown

Summary

  • restore the 60s cap for Retry-After / retry-after-ms delays
  • fall back to the normal exponential backoff when the server asks for an unreasonable wait
  • add regression coverage for a 600s Retry-After response

Tests

  • ./scripts/test tests/index.test.ts
  • ./node_modules/.bin/prettier --check src/client.ts tests/index.test.ts
  • ./node_modules/.bin/tsc --noEmit --skipLibCheck --target es2020 --lib es2020,dom,dom.iterable --module commonjs --moduleResolution node --esModuleInterop --strict --exactOptionalPropertyTypes --noUncheckedIndexedAccess --noImplicitOverride --noPropertyAccessFromIndexSignature src/client.ts

Fixes #1840

Restore the upper bound on the Retry-After header that was dropped in a codegen update. Values outside 0..60s now fall back to the calculated exponential backoff instead of sleeping for the full server-specified duration (e.g. Retry-After: 600 no longer blocks for 10 minutes).

Fixes openai#1840
@redactdeveloper redactdeveloper requested a review from a team as a code owner June 1, 2026 06:17
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