mirror of
https://github.com/openai/codex.git
synced 2026-11-14 21:40:39 +00:00
Preserve invalid_prompt as a distinct error classification (#47353)
## Why `invalid_prompt` responses were classified as generic invalid requests, losing the server's specific error classification. ## What changed Add `InvalidPrompt` variants to the API and core error types and serialize the core protocol classification as `invalid_prompt`. Recognize the code in HTTP 400 responses, wrapped WebSocket errors, and SSE `response.failed` events while preserving server messages and keeping the error non-retryable. Map it to `other` in the app-server v2 protocol. ## Testing Extend coverage for typed error mapping, missing and blank messages, protocol conversion, and guardian retry handling. Exercise HTTP and SSE failures in core integration tests, asserting the error message, serialized classification, and a single request without retry. GitOrigin-RevId: 5d9a299a013b06158a4dc27a4054f3dbc5fd0f4d
This commit is contained in:
@@ -33,6 +33,8 @@ pub enum ApiError {
|
||||
RateLimit(String),
|
||||
#[error("invalid request: {message}")]
|
||||
InvalidRequest { message: String },
|
||||
#[error("invalid prompt: {message}")]
|
||||
InvalidPrompt { message: String },
|
||||
#[error("cyber policy: {message}")]
|
||||
CyberPolicy { message: String },
|
||||
#[error("bio policy: {message}")]
|
||||
|
||||
Reference in New Issue
Block a user