mirror of
https://github.com/openai/codex.git
synced 2026-10-31 19:28:49 +00:00
Treat audio validation failures as non-retryable input errors (#58434)
## What changed Map audio size, data, format, and sample-rate validation failures to `InvalidAudioInput` for HTTP 400 responses and streamed errors. Preserve the provider's message, falling back to `Invalid audio input.` when it is absent or blank. Classify these errors as non-retryable and expose them as `BadRequest`. Redact their messages in doctor diagnostics and group them as invalid requests in telemetry. ## Testing Add coverage for all six audio validation codes across HTTP errors, streamed `error` events, and `response.failed` events, checking error classification, message preservation, and the absence of retries. Extend doctor diagnostic redaction coverage for `InvalidAudioInput`. GitOrigin-RevId: 0a59964bcabd83997bdb32fc9318a5482dac33b0
This commit is contained in:
@@ -152,6 +152,8 @@ pub enum CodexErrorDetails {
|
||||
#[error("{0}")]
|
||||
InvalidRequest(String),
|
||||
#[error("{message}")]
|
||||
InvalidAudioInput { message: String },
|
||||
#[error("{message}")]
|
||||
ModelNotFound {
|
||||
message: String,
|
||||
status: Option<StatusCode>,
|
||||
@@ -429,6 +431,7 @@ impl CodexErr {
|
||||
| CodexErrorDetails::QuotaExceeded
|
||||
| CodexErrorDetails::InvalidImageRequest()
|
||||
| CodexErrorDetails::InvalidRequest(_)
|
||||
| CodexErrorDetails::InvalidAudioInput { .. }
|
||||
| CodexErrorDetails::ResponseIncomplete(_)
|
||||
| CodexErrorDetails::ModelNotFound { .. }
|
||||
| CodexErrorDetails::InvalidPrompt { .. }
|
||||
@@ -534,7 +537,8 @@ impl CodexErr {
|
||||
CodexErrorDetails::SessionConfiguredNotFirstEvent
|
||||
| CodexErrorDetails::InternalServerError
|
||||
| CodexErrorDetails::InternalAgentDied => CodexErrorInfo::InternalServerError,
|
||||
CodexErrorDetails::UnsupportedOperation(_)
|
||||
CodexErrorDetails::InvalidAudioInput { .. }
|
||||
| CodexErrorDetails::UnsupportedOperation(_)
|
||||
| CodexErrorDetails::ThreadNotFound(_)
|
||||
| CodexErrorDetails::AgentLimitReached { .. } => CodexErrorInfo::BadRequest,
|
||||
CodexErrorDetails::Sandbox(_) => CodexErrorInfo::SandboxError,
|
||||
|
||||
Reference in New Issue
Block a user