mirror of
https://github.com/openai/codex.git
synced 2026-10-27 18:48:37 +00:00
Surface Flex capacity failures as a distinct terminal error (#47967)
## What changed - Recognize `flex_unavailable` in HTTP 429 responses and streamed `error` and `response.failed` events. End normal turns without retries and report `Flex capacity unavailable.` - Expose `flexUnavailable` through the core and app-server protocols and generated schemas and SDK types. - Keep Flex capacity failures eligible for Guardian review and sampler retries, with a distinct telemetry classification. - Map unexpected HTTP responses to `HttpConnectionFailed`, preserving their status codes. ## Testing Add regression coverage for terminal Flex failures over HTTP, SSE, and WebSocket, HTTP 504 status preservation after a stream retry, and protocol serialization. Update Guardian retry and sampler recovery tests to cover Flex failures. GitOrigin-RevId: f2e03a6d2d36a6d9748c35952e40397f8670d121
This commit is contained in:
@@ -64,7 +64,13 @@ fn map_api_error_distinguishes_capacity_from_slow_down() {
|
||||
false,
|
||||
),
|
||||
("slow_down", CodexErrorInfo::RateLimitExceeded, true),
|
||||
("unknown_error", CodexErrorInfo::Other, true),
|
||||
(
|
||||
"unknown_error",
|
||||
CodexErrorInfo::HttpConnectionFailed {
|
||||
http_status_code: Some(503),
|
||||
},
|
||||
true,
|
||||
),
|
||||
] {
|
||||
let err = map_api_error(ApiError::Transport(TransportError::Http {
|
||||
retry_after: None,
|
||||
|
||||
Reference in New Issue
Block a user