Skip to content

Honor Retry-After and preserve server retry deadlines - #47641

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/a2eff02946e5524f29e06f7ba1431e3d339261a4
Sep 23, 2026
Merged

copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/a2eff02946e5524f29e06f7ba1431e3d339261a4

Conversation

@copyberry

@copyberry copyberry Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Honor Retry-After and preserve server retry deadlines

Why

HTTP retries used local backoff even when the server supplied Retry-After. Relative retry delays also failed to account for time spent propagating errors or reporting retries.

What changed

  • Parse Retry-After delay seconds and HTTP dates into a monotonic deadline captured when response headers arrive.
  • Honor that deadline for HTTP retries, falling back to local backoff when valid advice is absent.
  • Preserve deadlines through API and Bedrock error mapping, stream retries, and exhausted retry state. Expired advice remains a zero delay instead of triggering local backoff.

Testing

Add coverage for header parsing, deadline countdown and expiry, error mapping after exhausted HTTP retries, and delayed stream retry notifications. Update Responses and remote compaction tests to verify that HTTP retries honor Retry-After.

## Why

HTTP retries used local backoff even when the server supplied `Retry-After`. Relative retry delays also failed to account for time spent propagating errors or reporting retries.

## What changed

- Parse `Retry-After` delay seconds and HTTP dates into a monotonic deadline captured when response headers arrive.
- Honor that deadline for HTTP retries, falling back to local backoff when valid advice is absent.
- Preserve deadlines through API and Bedrock error mapping, stream retries, and exhausted retry state. Expired advice remains a zero delay instead of triggering local backoff.

## Testing

Add coverage for header parsing, deadline countdown and expiry, error mapping after exhausted HTTP retries, and delayed stream retry notifications. Update Responses and remote compaction tests to verify that HTTP retries honor `Retry-After`.

GitOrigin-RevId: a2eff02946e5524f29e06f7ba1431e3d339261a4
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/a2eff02946e5524f29e06f7ba1431e3d339261a4 branch from afd0643 to 9d8de19 Compare September 23, 2026 19:53
@copyberry
copyberry Bot merged commit 9d8de19 into main Sep 23, 2026
1 check passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/a2eff02946e5524f29e06f7ba1431e3d339261a4 branch September 23, 2026 19:53
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant