mirror of
https://github.com/openai/codex.git
synced 2026-10-30 19:18:49 +00:00
Classify streaming rate-limit errors (#40931)
## What changed - Classify `response.failed` events with the `rate_limit_exceeded` code as a distinct retryable error while preserving any parsed retry delay. - Expose the error as `rateLimitExceeded` through the core protocol and app-server schemas after stream retries are exhausted. - Preserve the upstream message for TUI display while keeping it out of telemetry summaries. ## Testing - Cover SSE classification, retry metadata, protocol conversion and serialization, exhausted stream retries, telemetry redaction, and TUI rendering. GitOrigin-RevId: 02dab4d3477dcd7653a58c49c4bd38687a616579
This commit is contained in:
@@ -29,6 +29,13 @@ pub fn map_api_error(err: ApiError) -> CodexErr {
|
||||
None => error,
|
||||
}
|
||||
}
|
||||
ApiError::RateLimitExceeded { message, delay } => {
|
||||
let error = CodexErr::new(CodexErrorDetails::RateLimitExceeded(message));
|
||||
match delay {
|
||||
Some(delay) => error.with_retry_delay(delay),
|
||||
None => error,
|
||||
}
|
||||
}
|
||||
ApiError::Stream(msg) => CodexErr::Stream(msg),
|
||||
ApiError::ServerOverloaded => CodexErr::ServerOverloaded,
|
||||
ApiError::Api { status, message } => {
|
||||
|
||||
Reference in New Issue
Block a user