Lightweight coding agent that runs in your terminal
Rust
Accept unknown Codex error variants in the app-server protocol (#49806)
Adam Perry @ OpenAIa5d56d8120ab
diff --git a/codex-rs/app-server-protocol/schema/json/ServerNotification.json b/codex-rs/app-server-protocol/schema/json/ServerNotification.jsonindex 3c65020a32..7cc907203b 100644--- a/codex-rs/app-server-protocol/schema/json/ServerNotification.json+++ b/codex-rs/app-server-protocol/schema/json/ServerNotification.json@@ -654,8 +654,7 @@"type": "object"},"CodexErrorInfo": {- "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.",- "oneOf": [+ "anyOf": [{"enum": ["contextWindowExceeded",@@ -792,8 +791,15 @@],"title": "ActiveTurnNotSteerableCodexErrorInfo","type": "object"+ },+ {+ "type": [+ "string",+ "object"+ ]}- ]+ ],+ "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant."},"CollabAgentState": {"properties": {diff --git a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.jsonindex 04ae2b9286..feabaf409c 100644--- a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json+++ b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json@@ -8425,8 +8425,7 @@"type": "string"},"CodexErrorInfo": {- "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.",- "oneOf": [+ "anyOf": [{"enum": ["contextWindowExceeded",@@ -8563,8 +8562,15 @@],"title": "ActiveTurnNotSteerableCodexErrorInfo","type": "object"+ },+ {+ "type": [+ "string",+ "object"+ ]}- ]+ ],+ "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant."},"CodexResponseHandoffMode": {"enum": [diff --git a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.jsonindex fcae8cbdd3..c4e2a12805 100644--- a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json+++ b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json@@ -4261,8 +4261,7 @@"title": "ClientRequest"},"CodexErrorInfo": {- "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.",- "oneOf": [+ "anyOf": [{"enum": ["contextWindowExceeded",@@ -4399,8 +4398,15 @@],"title": "ActiveTurnNotSteerableCodexErrorInfo","type": "object"+ },+ {+ "type": [+ "string",+ "object"+ ]}- ]+ ],+ "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant."},"CodexResponseHandoffMode": {"enum": [diff --git a/codex-rs/app-server-protocol/schema/json/v2/ErrorNotification.json b/codex-rs/app-server-protocol/schema/json/v2/ErrorNotification.jsonindex 7b065d6184..7704081998 100644--- a/codex-rs/app-server-protocol/schema/json/v2/ErrorNotification.json+++ b/codex-rs/app-server-protocol/schema/json/v2/ErrorNotification.json@@ -2,8 +2,7 @@"$schema": "http://json-schema.org/draft-07/schema#","definitions": {"CodexErrorInfo": {- "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.",- "oneOf": [+ "anyOf": [{"enum": ["contextWindowExceeded",@@ -140,8 +139,15 @@],"title": "ActiveTurnNotSteerableCodexErrorInfo","type": "object"+ },+ {+ "type": [+ "string",+ "object"+ ]}- ]+ ],+ "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant."},"MisalignmentErrorDetails": {"properties": {diff --git a/codex-rs/app-server-protocol/schema/json/v2/ReviewStartResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ReviewStartResponse.jsonindex f84f980faf..db7a0ac431 100644--- a/codex-rs/app-server-protocol/schema/json/v2/ReviewStartResponse.json+++ b/codex-rs/app-server-protocol/schema/json/v2/ReviewStartResponse.json@@ -52,8 +52,7 @@"type": "object"},"CodexErrorInfo": {- "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.",- "oneOf": [+ "anyOf": [{"enum": ["contextWindowExceeded",@@ -190,8 +189,15 @@],"title": "ActiveTurnNotSteerableCodexErrorInfo","type": "object"+ },+ {+ "type": [+ "string",+ "object"+ ]}- ]+ ],+ "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant."},"CollabAgentState": {"properties": {diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadForkResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadForkResponse.jsonindex 1a3c732bab..dec11ca9d7 100644--- a/codex-rs/app-server-protocol/schema/json/v2/ThreadForkResponse.json+++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadForkResponse.json@@ -133,8 +133,7 @@"type": "object"},"CodexErrorInfo": {- "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.",- "oneOf": [+ "anyOf": [{"enum": ["contextWindowExceeded",@@ -271,8 +270,15 @@],"title": "ActiveTurnNotSteerableCodexErrorInfo","type": "object"+ },+ {+ "type": [+ "string",+ "object"+ ]}- ]+ ],+ "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant."},"CollabAgentState": {"properties": {diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadListResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadListResponse.jsonindex 997c5e0041..03a4d8ddb7 100644--- a/codex-rs/app-server-protocol/schema/json/v2/ThreadListResponse.json+++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadListResponse.json@@ -55,8 +55,7 @@"type": "object"},"CodexErrorInfo": {- "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.",- "oneOf": [+ "anyOf": [{"enum": ["contextWindowExceeded",@@ -193,8 +192,15 @@],"title": "ActiveTurnNotSteerableCodexErrorInfo","type": "object"+ },+ {+ "type": [+ "string",+ "object"+ ]}- ]+ ],+ "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant."},"CollabAgentState": {"properties": {diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadMetadataUpdateResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadMetadataUpdateResponse.jsonindex b3336a05be..aec018030c 100644--- a/codex-rs/app-server-protocol/schema/json/v2/ThreadMetadataUpdateResponse.json+++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadMetadataUpdateResponse.json@@ -55,8 +55,7 @@"type": "object"},"CodexErrorInfo": {- "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.",- "oneOf": [+ "anyOf": [{"enum": ["contextWindowExceeded",@@ -193,8 +192,15 @@],"title": "ActiveTurnNotSteerableCodexErrorInfo","type": "object"+ },+ {+ "type": [+ "string",+ "object"+ ]}- ]+ ],+ "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant."},"CollabAgentState": {"properties": {diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadReadResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadReadResponse.jsonindex 9f11927d72..32c44a7fe5 100644--- a/codex-rs/app-server-protocol/schema/json/v2/ThreadReadResponse.json+++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadReadResponse.json@@ -55,8 +55,7 @@"type": "object"},"CodexErrorInfo": {- "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.",- "oneOf": [+ "anyOf": [{"enum": ["contextWindowExceeded",@@ -193,8 +192,15 @@],"title": "ActiveTurnNotSteerableCodexErrorInfo","type": "object"+ },+ {+ "type": [+ "string",+ "object"+ ]}- ]+ ],+ "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant."},"CollabAgentState": {"properties": {diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeResponse.jsonindex 9220eeecaa..90f142dce6 100644--- a/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeResponse.json+++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeResponse.json@@ -133,8 +133,7 @@"type": "object"},"CodexErrorInfo": {- "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.",- "oneOf": [+ "anyOf": [{"enum": ["contextWindowExceeded",@@ -271,8 +270,15 @@],"title": "ActiveTurnNotSteerableCodexErrorInfo","type": "object"+ },+ {+ "type": [+ "string",+ "object"+ ]}- ]+ ],+ "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant."},"CollabAgentState": {"properties": {diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadRevertResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadRevertResponse.jsonindex ce1c4d51a5..cbf3223c56 100644--- a/codex-rs/app-server-protocol/schema/json/v2/ThreadRevertResponse.json+++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadRevertResponse.json@@ -55,8 +55,7 @@"type": "object"},"CodexErrorInfo": {- "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.",- "oneOf": [+ "anyOf": [{"enum": ["contextWindowExceeded",@@ -193,8 +192,15 @@],"title": "ActiveTurnNotSteerableCodexErrorInfo","type": "object"+ },+ {+ "type": [+ "string",+ "object"+ ]}- ]+ ],+ "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant."},"CollabAgentState": {"properties": {diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadStartResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadStartResponse.jsonindex 01af33c3cc..ef13faffe3 100644--- a/codex-rs/app-server-protocol/schema/json/v2/ThreadStartResponse.json+++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadStartResponse.json@@ -133,8 +133,7 @@"type": "object"},"CodexErrorInfo": {- "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.",- "oneOf": [+ "anyOf": [{"enum": ["contextWindowExceeded",@@ -271,8 +270,15 @@],"title": "ActiveTurnNotSteerableCodexErrorInfo","type": "object"+ },+ {+ "type": [+ "string",+ "object"+ ]}- ]+ ],+ "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant."},"CollabAgentState": {"properties": {diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadStartedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadStartedNotification.jsonindex 04776d73d9..568eb2211d 100644--- a/codex-rs/app-server-protocol/schema/json/v2/ThreadStartedNotification.json+++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadStartedNotification.json@@ -55,8 +55,7 @@"type": "object"},"CodexErrorInfo": {- "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.",- "oneOf": [+ "anyOf": [{"enum": ["contextWindowExceeded",@@ -193,8 +192,15 @@],"title": "ActiveTurnNotSteerableCodexErrorInfo","type": "object"+ },+ {+ "type": [+ "string",+ "object"+ ]}- ]+ ],+ "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant."},"CollabAgentState": {"properties": {diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadTurnsListResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadTurnsListResponse.jsonindex 6952ab146e..4db744c11a 100644--- a/codex-rs/app-server-protocol/schema/json/v2/ThreadTurnsListResponse.json+++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadTurnsListResponse.json@@ -52,8 +52,7 @@"type": "object"},"CodexErrorInfo": {- "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.",- "oneOf": [+ "anyOf": [{"enum": ["contextWindowExceeded",@@ -190,8 +189,15 @@],"title": "ActiveTurnNotSteerableCodexErrorInfo","type": "object"+ },+ {+ "type": [+ "string",+ "object"+ ]}- ]+ ],+ "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant."},"CollabAgentState": {"properties": {diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadUnarchiveResponse.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadUnarchiveResponse.jsonindex 6079f73c8e..7416e5b4a2 100644--- a/codex-rs/app-server-protocol/schema/json/v2/ThreadUnarchiveResponse.json+++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadUnarchiveResponse.json@@ -55,8 +55,7 @@"type": "object"},"CodexErrorInfo": {- "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.",- "oneOf": [+ "anyOf": [{"enum": ["contextWindowExceeded",@@ -193,8 +192,15 @@],"title": "ActiveTurnNotSteerableCodexErrorInfo","type": "object"+ },+ {+ "type": [+ "string",+ "object"+ ]}- ]+ ],+ "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant."},"CollabAgentState": {"properties": {diff --git a/codex-rs/app-server-protocol/schema/json/v2/TurnCompletedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/TurnCompletedNotification.jsonindex 2d61e08042..70487c9d29 100644--- a/codex-rs/app-server-protocol/schema/json/v2/TurnCompletedNotification.json+++ b/codex-rs/app-server-protocol/schema/json/v2/TurnCompletedNotification.json@@ -52,8 +52,7 @@"type": "object"},"CodexErrorInfo": {- "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.",- "oneOf": [+ "anyOf": [{"enum": ["contextWindowExceeded",@@ -190,8 +189,15 @@],"title": "ActiveTurnNotSteerableCodexErrorInfo","type": "object"+ },+ {+ "type": [+ "string",+ "object"+ ]}- ]+ ],+ "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant."},"CollabAgentState": {"properties": {diff --git a/codex-rs/app-server-protocol/schema/json/v2/TurnStartResponse.json b/codex-rs/app-server-protocol/schema/json/v2/TurnStartResponse.jsonindex 82e5c34ef6..047017e9b1 100644--- a/codex-rs/app-server-protocol/schema/json/v2/TurnStartResponse.json+++ b/codex-rs/app-server-protocol/schema/json/v2/TurnStartResponse.json@@ -52,8 +52,7 @@"type": "object"},"CodexErrorInfo": {- "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.",- "oneOf": [+ "anyOf": [{"enum": ["contextWindowExceeded",@@ -190,8 +189,15 @@],"title": "ActiveTurnNotSteerableCodexErrorInfo","type": "object"+ },+ {+ "type": [+ "string",+ "object"+ ]}- ]+ ],+ "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant."},"CollabAgentState": {"properties": {diff --git a/codex-rs/app-server-protocol/schema/json/v2/TurnStartedNotification.json b/codex-rs/app-server-protocol/schema/json/v2/TurnStartedNotification.jsonindex 1d988b8cf9..5ea7ace499 100644--- a/codex-rs/app-server-protocol/schema/json/v2/TurnStartedNotification.json+++ b/codex-rs/app-server-protocol/schema/json/v2/TurnStartedNotification.json@@ -52,8 +52,7 @@"type": "object"},"CodexErrorInfo": {- "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.",- "oneOf": [+ "anyOf": [{"enum": ["contextWindowExceeded",@@ -190,8 +189,15 @@],"title": "ActiveTurnNotSteerableCodexErrorInfo","type": "object"+ },+ {+ "type": [+ "string",+ "object"+ ]}- ]+ ],+ "description": "This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant."},"CollabAgentState": {"properties": {diff --git a/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-experimental.json.zst b/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-experimental.json.zstindex 9e6ab232b7..b7a833ce65 100644Binary files a/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-experimental.json.zst and b/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-experimental.json.zst differdiff --git a/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-stable.json.zst b/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-stable.json.zstindex 63d1321e7b..afd021f12a 100644Binary files a/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-stable.json.zst and b/codex-rs/app-server-protocol/schema/precomputed/app-server-exports-stable.json.zst differdiff --git a/codex-rs/app-server-protocol/schema/typescript/v2/CodexErrorInfo.ts b/codex-rs/app-server-protocol/schema/typescript/v2/CodexErrorInfo.tsindex 294998e7ff..43598b28e0 100644--- a/codex-rs/app-server-protocol/schema/typescript/v2/CodexErrorInfo.ts+++ b/codex-rs/app-server-protocol/schema/typescript/v2/CodexErrorInfo.ts@@ -9,4 +9,4 @@ import type { NonSteerableTurnKind } from "./NonSteerableTurnKind";* When an upstream HTTP status is available (for example, from the Responses API or a provider),* it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant.*/-export type CodexErrorInfo = "contextWindowExceeded" | "sessionBudgetExceeded" | "usageLimitExceeded" | "rateLimitExceeded" | "flexUnavailable" | "serverOverloaded" | "cyberPolicy" | "misalignmentPolicyViolation" | "tooManyDenials" | { "httpConnectionFailed": { httpStatusCode: number | null, } } | { "responseStreamConnectionFailed": { httpStatusCode: number | null, } } | "internalServerError" | "unauthorized" | "badRequest" | "threadRollbackFailed" | "sandboxError" | { "responseStreamDisconnected": { httpStatusCode: number | null, } } | { "responseTooManyFailedAttempts": { httpStatusCode: number | null, } } | { "activeTurnNotSteerable": { turnKind: NonSteerableTurnKind, } } | "other";+export type CodexErrorInfo = "contextWindowExceeded" | "sessionBudgetExceeded" | "usageLimitExceeded" | "rateLimitExceeded" | "flexUnavailable" | "serverOverloaded" | "cyberPolicy" | "misalignmentPolicyViolation" | "tooManyDenials" | { "httpConnectionFailed": { httpStatusCode: number | null, } } | { "responseStreamConnectionFailed": { httpStatusCode: number | null, } } | "internalServerError" | "unauthorized" | "badRequest" | "threadRollbackFailed" | "sandboxError" | { "responseStreamDisconnected": { httpStatusCode: number | null, } } | { "responseTooManyFailedAttempts": { httpStatusCode: number | null, } } | { "activeTurnNotSteerable": { turnKind: NonSteerableTurnKind, } } | "other" | string | { [key: string]: unknown };diff --git a/codex-rs/app-server-protocol/src/export.rs b/codex-rs/app-server-protocol/src/export.rsindex 0d8ce4aaa4..e870ec4e9c 100644--- a/codex-rs/app-server-protocol/src/export.rs+++ b/codex-rs/app-server-protocol/src/export.rs@@ -1366,6 +1366,11 @@ wherestrip_v1_server_notification_variants_from_json_schema(&mut schema_value);add_server_notification_emitted_at_to_json_schema(&mut schema_value)?;}+ if let Some(Value::Object(error_schema)) =+ schema_value.pointer_mut("/definitions/CodexErrorInfo")+ {+ keep_enum_open_ended(error_schema);+ }enforce_numbered_definition_collision_overrides(file_stem, &mut schema_value);annotate_schema(&mut schema_value, Some(file_stem));}@@ -1397,6 +1402,13 @@ where})}+fn keep_enum_open_ended(schema: &mut Map<String, Value>) {+ if let Some(Value::Array(mut variants)) = schema.remove("oneOf") {+ variants.push(serde_json::json!({ "type": ["string", "object"] }));+ schema.insert("anyOf".to_string(), Value::Array(variants));+ }+}+fn add_server_notification_emitted_at_to_json_schema(schema: &mut Value) -> Result<()> {let schema = schema.as_object_mut()diff --git a/codex-rs/app-server-protocol/src/protocol/v2/shared.rs b/codex-rs/app-server-protocol/src/protocol/v2/shared.rsindex 7b20419d4b..65c7db5aeb 100644--- a/codex-rs/app-server-protocol/src/protocol/v2/shared.rs+++ b/codex-rs/app-server-protocol/src/protocol/v2/shared.rs@@ -19,7 +19,6 @@ use schemars::schema::Schema;use schemars::schema::SchemaObject;use serde::Deserialize;use serde::Serialize;-#[cfg(test)]use serde_json::Value as JsonValue;// Macro to declare a camelCased API v2 enum mirroring a core enum which@@ -119,9 +118,34 @@ pub enum CodexErrorInfo {#[ts(rename = "turnKind")]turn_kind: NonSteerableTurnKind,},+ #[serde(+ untagged,+ serialize_with = "serialize_other_codex_error_info",+ deserialize_with = "deserialize_other_codex_error_info"+ )]+ #[ts(type = "\"other\" | string | { [key: string]: unknown }")]Other,}+fn serialize_other_codex_error_info<S>(serializer: S) -> Result<S::Ok, S::Error>+where+ S: serde::Serializer,+{+ serializer.serialize_str("other")+}++fn deserialize_other_codex_error_info<'de, D>(deserializer: D) -> Result<(), D::Error>+where+ D: serde::Deserializer<'de>,+{+ match JsonValue::deserialize(deserializer)? {+ JsonValue::String(_) | JsonValue::Object(_) => Ok(()),+ _ => Err(serde::de::Error::custom(+ "expected an error string or object",+ )),+ }+}+impl From<CoreCodexErrorInfo> for CodexErrorInfo {fn from(value: CoreCodexErrorInfo) -> Self {match value {diff --git a/codex-rs/app-server-protocol/src/protocol/v2/tests.rs b/codex-rs/app-server-protocol/src/protocol/v2/tests.rsindex ff34043464..0ec1535c00 100644--- a/codex-rs/app-server-protocol/src/protocol/v2/tests.rs+++ b/codex-rs/app-server-protocol/src/protocol/v2/tests.rs@@ -4781,6 +4781,67 @@ fn core_error_info_converts_to_camel_case() {}}+/// The catchall must keep the existing `other` string stable in both directions.+#[test]+fn codex_error_info_other_round_trips_as_string() {+ assert_eq!(+ serde_json::to_value(CodexErrorInfo::Other).unwrap(),+ json!("other")+ );+ assert_eq!(+ serde_json::from_value::<CodexErrorInfo>(json!("other")).unwrap(),+ CodexErrorInfo::Other+ );+}++/// Future unit variants must not prevent older clients from handling errors.+#[test]+fn codex_error_info_deserializes_unknown_string_as_other() {+ assert_eq!(+ serde_json::from_value::<CodexErrorInfo>(json!("futureError")).unwrap(),+ CodexErrorInfo::Other+ );+}++/// Future structured variants must fall back without retaining their unknown payload.+#[test]+fn codex_error_info_deserializes_unknown_object_as_other() {+ assert_eq!(+ serde_json::from_value::<CodexErrorInfo>(json!({+ "futureError": {+ "detail": "unknown",+ "retryAfterSeconds": 30,+ }+ }))+ .unwrap(),+ CodexErrorInfo::Other+ );+}++/// The catchall must not replace known structured variants with `Other`.+#[test]+fn codex_error_info_deserializes_known_object_without_falling_back() {+ assert_eq!(+ serde_json::from_value::<CodexErrorInfo>(json!({+ "httpConnectionFailed": {+ "httpStatusCode": 503,+ }+ }))+ .unwrap(),+ CodexErrorInfo::HttpConnectionFailed {+ http_status_code: Some(503),+ }+ );+}++/// Only the two supported error wire shapes may reach the catchall.+#[test]+fn codex_error_info_rejects_unsupported_wire_shapes() {+ for value in [json!(null), json!(true), json!(42), json!([])] {+ assert!(serde_json::from_value::<CodexErrorInfo>(value).is_err());+ }+}+#[test]fn codex_error_info_serializes_active_turn_not_steerable_turn_kind_in_camel_case() {let value = CodexErrorInfo::ActiveTurnNotSteerable {diff --git a/sdk/python/scripts/update_sdk_artifacts.py b/sdk/python/scripts/update_sdk_artifacts.pyindex 635292b1cf..9451aebc20 100755--- a/sdk/python/scripts/update_sdk_artifacts.py+++ b/sdk/python/scripts/update_sdk_artifacts.py@@ -286,6 +286,18 @@ def _flatten_string_enum_one_of(definition: dict[str, Any]) -> bool:return True+def _normalize_open_ended_enum(definition: dict[str, Any]) -> None:+ variants = definition.pop("oneOf", definition.get("anyOf", []))+ definition["anyOf"] = [+ variant+ for variant in variants+ if "enum" in variant or variant.get("type") not in ("string", ["string", "object"])+ ]+ object_fallback = {"type": "object", "additionalProperties": {}}+ if object_fallback not in definition["anyOf"]:+ definition["anyOf"].append(object_fallback)++DISCRIMINATOR_KEYS = ("type", "method", "mode", "state", "status", "role", "reason")@@ -522,8 +534,10 @@ def _normalized_schema_bundle_text(schema_dir: Path) -> str:_preserve_guardian_approval_path_wrappers(schema)definitions = schema.get("definitions", {})if isinstance(definitions, dict):- for definition in definitions.values():+ for name, definition in definitions.items():if isinstance(definition, dict):+ if name == "CodexErrorInfo":+ _normalize_open_ended_enum(definition)_flatten_string_enum_one_of(definition)# Normalize the schema into something datamodel-code-generator can map to# stable class names instead of anonymous numbered helpers.@@ -580,9 +594,10 @@ def generate_v2_all(schema_dir: Path) -> None:_require_nullable_field(out_path, "McpResourceReadTarget", r"link_id: Annotated\[\n(?: .*\n)+ \]")+ _preserve_open_enum(out_path, "CodexErrorInfoValue", allow_empty=True)_preserve_reasoning_effort_enum(out_path)_preserve_thread_source_enum(out_path)- _preserve_plan_type_enum(out_path)+ _preserve_open_enum(out_path, "PlanType")_normalize_generated_timestamps(out_path)@@ -687,27 +702,30 @@ def _preserve_thread_source_enum(out_path: Path) -> None:out_path.write_text(source[:class_start] + open_enum + source[class_end:])-def _preserve_plan_type_enum(out_path: Path) -> None:- """Keep the public plan constants while accepting values from newer runtimes."""+def _preserve_open_enum(out_path: Path, name: str, *, allow_empty: bool = False) -> None:+ """Keep generated enum constants while accepting values from newer runtimes."""source = out_path.read_text()- class_start = source.find("class PlanType(Enum):")+ class_start = source.find(f"class {name}(Enum):")if class_start == -1:- raise RuntimeError("Generated SDK is missing PlanType")+ raise RuntimeError(f"Generated SDK is missing {name}")class_end = source.find("\n\nclass ", class_start)if class_end == -1:class_end = len(source)class_source = source[class_start:class_end]class_source = class_source.replace(- "class PlanType(Enum):",- "class PlanType(str, Enum):",+ f"class {name}(Enum):",+ f"class {name}(str, Enum):",1,).rstrip()- class_source += """+ invalid_value = "not isinstance(value, str)"+ if not allow_empty:+ invalid_value += " or not value"+ class_source += f"""@classmethod- def _missing_(cls, value: object) -> PlanType | None:- if not isinstance(value, str) or not value:+ def _missing_(cls, value: object) -> {name} | None:+ if {invalid_value}:return Nonemember = str.__new__(cls, value)member._name_ = valuediff --git a/sdk/python/src/openai_codex/generated/v2_all.py b/sdk/python/src/openai_codex/generated/v2_all.pyindex e2fef8e383..f0823a4af8 100644--- a/sdk/python/src/openai_codex/generated/v2_all.py+++ b/sdk/python/src/openai_codex/generated/v2_all.py@@ -538,7 +538,7 @@ class ClientInfo(BaseModel):version: str-class CodexErrorInfoValue(Enum):+class CodexErrorInfoValue(str, Enum):context_window_exceeded = "contextWindowExceeded"session_budget_exceeded = "sessionBudgetExceeded"usage_limit_exceeded = "usageLimitExceeded"@@ -555,6 +555,15 @@ class CodexErrorInfoValue(Enum):sandbox_error = "sandboxError"other = "other"+ @classmethod+ def _missing_(cls, value: object) -> CodexErrorInfoValue | None:+ if not isinstance(value, str):+ return None+ member = str.__new__(cls, value)+ member._name_ = value+ member._value_ = value+ return member+class HttpConnectionFailed(BaseModel):model_config = ConfigDict(@@ -7669,6 +7678,7 @@ class CodexErrorInfo(| ResponseStreamDisconnectedCodexErrorInfo| ResponseTooManyFailedAttemptsCodexErrorInfo| ActiveTurnNotSteerableCodexErrorInfo+ | dict[str, Any]]):model_config = ConfigDict(@@ -7680,7 +7690,8 @@ class CodexErrorInfo(| ResponseStreamConnectionFailedCodexErrorInfo| ResponseStreamDisconnectedCodexErrorInfo| ResponseTooManyFailedAttemptsCodexErrorInfo- | ActiveTurnNotSteerableCodexErrorInfo,+ | ActiveTurnNotSteerableCodexErrorInfo+ | dict[str, Any],Field(description="This translation layer make sure that we expose codex error code in camel case.\n\nWhen an upstream HTTP status is available (for example, from the Responses API or a provider), it is forwarded in `httpStatusCode` on the relevant `codexErrorInfo` variant."),