mirror of
https://github.com/openai/codex.git
synced 2026-10-19 17:28:46 +00:00
Honor Retry-After and preserve server retry deadlines (#47641)
## 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
This commit is contained in:
committed by
copyberry
parent
ab021e9f13
commit
9d8de19674
@@ -2440,7 +2440,7 @@ fn websocket_error_detail(err: &ApiError) -> String {
|
||||
| ApiError::CyberPolicy { .. }
|
||||
| ApiError::BioPolicy { .. }
|
||||
| ApiError::MisalignmentPolicyViolation { .. }
|
||||
| ApiError::ServerOverloaded => format!("handshake error: {err}"),
|
||||
| ApiError::ServerOverloaded { .. } => format!("handshake error: {err}"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user