@devries-cameron20 / t3code-1 / commits / 997e3f37f7
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(server): Codex turns that fail with an unlisted error code no longer stay running (#28040)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Nov 2, 2026 at 18:30 UTC 997e3f37f7c695782d94c2abfe875a3dc272e73a
3 files changed +141 -513
apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts
+89
@@ -5797,6 +5797,95 @@ describe("CodexAdapterV2 post-settle continuation", () => {
5797 ),
5798 );
5799
5800 + // regression: #28032 an unlisted codexErrorInfo dropped the failed turn/completed
5801 + it.effect("fails the turn when Codex reports an error info the schema does not list", () =>
5802 + Effect.scoped(
5803 + Effect.gen(function* () {
5804 + const nativeThreadId = "native-unlisted-error-info";
5805 + const nativeTurnId = "turn-unlisted-error-info";
5806 + const message =
5807 + "The 'gpt-5-codex' model is not supported when using Codex with a ChatGPT account.";
5808 + const error = { message, codexErrorInfo: "modelNotFound", additionalDetails: null };
5809 + const usage = {
5810 + totalTokens: 1,
5811 + inputTokens: 1,
5812 + cachedInputTokens: 0,
5813 + outputTokens: 0,
5814 + reasoningOutputTokens: 0,
5815 + };
5816 + const transcript = makeCodexReplayTranscript({
5817 + scenario: "codex-unlisted-error-info",
5818 + entries: [
5819 + ...codexReplayPreamble({ nativeThreadId, nativeTurnId, prompt: "say hi" }),
5820 + {
5821 + type: "emit_inbound",
5822 + label: "error",
5823 + frame: {
5824 + method: "error",
5825 + params: { threadId: nativeThreadId, turnId: nativeTurnId, willRetry: false, error },
5826 + },
5827 + },
5828 + {
5829 + type: "emit_inbound",
5830 + label: "turn/completed",
5831 + frame: {
5832 + method: "turn/completed",
5833 + params: {
5834 + threadId: nativeThreadId,
5835 + turn: { ...makeCodexReplayTurn({ id: nativeTurnId, status: "failed" }), error },
5836 + },
5837 + },
5838 + },
5839 + // Notifications dispatch in order, so this marks turn/completed as handled.
5840 + {
5841 + type: "emit_inbound",
5842 + label: "usage",
5843 + frame: {
5844 + method: "thread/tokenUsage/updated",
5845 + params: {
5846 + threadId: nativeThreadId,
5847 + turnId: nativeTurnId,
5848 + tokenUsage: { total: usage, last: usage, modelContextWindow: 200_000 },
5849 + },
5850 + },
5851 + },
5852 + ],
5853 + });
5854 + const harness = yield* makeCodexReplayHarness(transcript);
5855 + yield* harness.runtime.startTurn(
5856 + makeCodexTestTurnInput({
5857 + threadId: harness.threadId,
5858 + providerThread: harness.providerThread,
5859 + now: yield* DateTime.now,
5860 + text: "say hi",
5861 + attemptId: RunAttemptId.make("attempt-unlisted-error-info"),
5862 + }),
5863 + );
5864 + yield* harness.until(
5865 + () =>
5866 + harness.terminalEvents().length > 0 ||
5867 + harness.events.some(
5868 + (event) =>
5869 + event.type === "provider_turn.updated" && event.providerTurn.tokenUsage != null,
5870 + ),
5871 + );
5872 + const terminal = harness.terminalEvents()[0];
5873 + assert.equal(terminal?.status, "failed");
5874 + if (terminal?.status !== "failed") return;
5875 + assert.equal(terminal.failure.message, message);
5876 + }).pipe(
5877 + Effect.provide(
5878 + Layer.mergeAll(
5879 + IdAllocator.layer,
5880 + McpProviderSessions.layer,
5881 + NodeServices.layer,
5882 + NodeCrypto.layer,
5883 + ),
5884 + ),
5885 + ),
5886 + ),
5887 + );
5888 +
5889 const FAILED_SCENARIO = "codex-failed-mid-command";
5890 const FAILED_NATIVE_THREAD = "native-codex-failed-thread";
5891 const FAILED_NATIVE_TURN = "native-codex-failed-turn";
packages/effect-codex-app-server/scripts/generate.ts
+20 -1
@@ -170,6 +170,22 @@ const DefinitionOverrides: Record<string, Schema.Json> = {
170 },
171 };
172
173 +// Codex sends error codes this ref does not list yet (e.g. `modelNotFound`). A closed enum
174 +// fails the whole notification decode, which drops a failed `turn/completed` and leaves the turn running.
175 +const OpenStringEnumDefinitions = new Set(["CodexErrorInfo"]);
176 +
177 +function openStringEnum(schema: Schema.Json): Schema.Json {
178 + if (!isJsonSchemaNode(schema) || !Array.isArray(schema.oneOf)) return schema;
179 + return {
180 + ...schema,
181 + oneOf: schema.oneOf.map((variant: Schema.Json) =>
182 + isJsonSchemaNode(variant) && variant.type === "string" && Array.isArray(variant.enum)
183 + ? { type: "string" }
184 + : variant,
185 + ),
186 + };
187 +}
188 +
189 const getGeneratedPaths = Effect.fn("getGeneratedPaths")(function* () {
190 const path = yield* Path.Path;
191 const generatedDir = path.join(import.meta.dirname, "..", "src", "_generated");
@@ -662,7 +678,10 @@ const generateFiles = Effect.fn("generateFiles")(function* () {
678 for (const [definitionName, definitionSchema] of Object.entries(parsed.definitions ?? {})) {
679 aggregateSchemas[localDefinitionNames.get(definitionName)!] = pipe(
680 rewriteExternalRefs(
665 - DefinitionOverrides[definitionName] ?? definitionSchema,
681 + DefinitionOverrides[definitionName] ??
682 + (OpenStringEnumDefinitions.has(definitionName)
683 + ? openStringEnum(definitionSchema)
684 + : definitionSchema),
685 localDefinitionNames,
686 file.namespace,
687 exportNameByQualifiedName,
packages/effect-codex-app-server/src/_generated/schema.gen.ts
+32 -512
@@ -17949,21 +17949,7 @@ export const PermissionsRequestApprovalResponse__FileSystemSpecialPath = Schema.
17949 ).annotate({ identifier: "PermissionsRequestApprovalResponse__FileSystemSpecialPath" });
17950
17951 export type ServerNotification__CodexErrorInfo =
17952 - | "contextWindowExceeded"
17953 - | "sessionBudgetExceeded"
17954 - | "usageLimitExceeded"
17955 - | "rateLimitExceeded"
17956 - | "flexUnavailable"
17957 - | "serverOverloaded"
17958 - | "cyberPolicy"
17959 - | "misalignmentPolicyViolation"
17960 - | "tooManyDenials"
17961 - | "internalServerError"
17962 - | "unauthorized"
17963 - | "badRequest"
17964 - | "threadRollbackFailed"
17965 - | "sandboxError"
17966 - | "other"
17952 + | string
17953 | { readonly httpConnectionFailed: { readonly httpStatusCode?: number | null } }
17954 | { readonly responseStreamConnectionFailed: { readonly httpStatusCode?: number | null } }
17955 | { readonly responseStreamDisconnected: { readonly httpStatusCode?: number | null } }
@@ -17975,23 +17961,7 @@ export type ServerNotification__CodexErrorInfo =
17961 };
17962 export const ServerNotification__CodexErrorInfo = Schema.Union(
17963 [
17978 - Schema.Literals([
17979 - "contextWindowExceeded",
17980 - "sessionBudgetExceeded",
17981 - "usageLimitExceeded",
17982 - "rateLimitExceeded",
17983 - "flexUnavailable",
17984 - "serverOverloaded",
17985 - "cyberPolicy",
17986 - "misalignmentPolicyViolation",
17987 - "tooManyDenials",
17988 - "internalServerError",
17989 - "unauthorized",
17990 - "badRequest",
17991 - "threadRollbackFailed",
17992 - "sandboxError",
17993 - "other",
17994 - ]),
17964 + Schema.String,
17965 Schema.Struct({
17966 httpConnectionFailed: Schema.Struct({
17967 httpStatusCode: Schema.optionalKey(
@@ -20035,21 +20005,7 @@ export const V2ConfigWriteResponse__ConfigLayerSource = Schema.Union(
20005 ).annotate({ identifier: "V2ConfigWriteResponse__ConfigLayerSource" });
20006
20007 export type V2ErrorNotification__CodexErrorInfo =
20038 - | "contextWindowExceeded"
20039 - | "sessionBudgetExceeded"
20040 - | "usageLimitExceeded"
20041 - | "rateLimitExceeded"
20042 - | "flexUnavailable"
20043 - | "serverOverloaded"
20044 - | "cyberPolicy"
20045 - | "misalignmentPolicyViolation"
20046 - | "tooManyDenials"
20047 - | "internalServerError"
20048 - | "unauthorized"
20049 - | "badRequest"
20050 - | "threadRollbackFailed"
20051 - | "sandboxError"
20052 - | "other"
20008 + | string
20009 | { readonly httpConnectionFailed: { readonly httpStatusCode?: number | null } }
20010 | { readonly responseStreamConnectionFailed: { readonly httpStatusCode?: number | null } }
20011 | { readonly responseStreamDisconnected: { readonly httpStatusCode?: number | null } }
@@ -20061,23 +20017,7 @@ export type V2ErrorNotification__CodexErrorInfo =
20017 };
20018 export const V2ErrorNotification__CodexErrorInfo = Schema.Union(
20019 [
20064 - Schema.Literals([
20065 - "contextWindowExceeded",
20066 - "sessionBudgetExceeded",
20067 - "usageLimitExceeded",
20068 - "rateLimitExceeded",
20069 - "flexUnavailable",
20070 - "serverOverloaded",
20071 - "cyberPolicy",
20072 - "misalignmentPolicyViolation",
20073 - "tooManyDenials",
20074 - "internalServerError",
20075 - "unauthorized",
20076 - "badRequest",
20077 - "threadRollbackFailed",
20078 - "sandboxError",
20079 - "other",
20080 - ]),
20020 + Schema.String,
20021 Schema.Struct({
20022 httpConnectionFailed: Schema.Struct({
20023 httpStatusCode: Schema.optionalKey(
@@ -22491,21 +22431,7 @@ export const V2RawResponseItemCompletedNotification__ConfigurationReasoning = Sc
22431 });
22432
22433 export type V2ReviewStartResponse__CodexErrorInfo =
22494 - | "contextWindowExceeded"
22495 - | "sessionBudgetExceeded"
22496 - | "usageLimitExceeded"
22497 - | "rateLimitExceeded"
22498 - | "flexUnavailable"
22499 - | "serverOverloaded"
22500 - | "cyberPolicy"
22501 - | "misalignmentPolicyViolation"
22502 - | "tooManyDenials"
22503 - | "internalServerError"
22504 - | "unauthorized"
22505 - | "badRequest"
22506 - | "threadRollbackFailed"
22507 - | "sandboxError"
22508 - | "other"
22434 + | string
22435 | { readonly httpConnectionFailed: { readonly httpStatusCode?: number | null } }
22436 | { readonly responseStreamConnectionFailed: { readonly httpStatusCode?: number | null } }
22437 | { readonly responseStreamDisconnected: { readonly httpStatusCode?: number | null } }
@@ -22517,23 +22443,7 @@ export type V2ReviewStartResponse__CodexErrorInfo =
22443 };
22444 export const V2ReviewStartResponse__CodexErrorInfo = Schema.Union(
22445 [
22520 - Schema.Literals([
22521 - "contextWindowExceeded",
22522 - "sessionBudgetExceeded",
22523 - "usageLimitExceeded",
22524 - "rateLimitExceeded",
22525 - "flexUnavailable",
22526 - "serverOverloaded",
22527 - "cyberPolicy",
22528 - "misalignmentPolicyViolation",
22529 - "tooManyDenials",
22530 - "internalServerError",
22531 - "unauthorized",
22532 - "badRequest",
22533 - "threadRollbackFailed",
22534 - "sandboxError",
22535 - "other",
22536 - ]),
22446 + Schema.String,
22447 Schema.Struct({
22448 httpConnectionFailed: Schema.Struct({
22449 httpStatusCode: Schema.optionalKey(
@@ -23029,21 +22939,7 @@ export const V2ThreadForkResponse__ThreadStatus = Schema.Union(
22939 ).annotate({ identifier: "V2ThreadForkResponse__ThreadStatus" });
22940
22941 export type V2ThreadForkResponse__CodexErrorInfo =
23032 - | "contextWindowExceeded"
23033 - | "sessionBudgetExceeded"
23034 - | "usageLimitExceeded"
23035 - | "rateLimitExceeded"
23036 - | "flexUnavailable"
23037 - | "serverOverloaded"
23038 - | "cyberPolicy"
23039 - | "misalignmentPolicyViolation"
23040 - | "tooManyDenials"
23041 - | "internalServerError"
23042 - | "unauthorized"
23043 - | "badRequest"
23044 - | "threadRollbackFailed"
23045 - | "sandboxError"
23046 - | "other"
22942 + | string
22943 | { readonly httpConnectionFailed: { readonly httpStatusCode?: number | null } }
22944 | { readonly responseStreamConnectionFailed: { readonly httpStatusCode?: number | null } }
22945 | { readonly responseStreamDisconnected: { readonly httpStatusCode?: number | null } }
@@ -23055,23 +22951,7 @@ export type V2ThreadForkResponse__CodexErrorInfo =
22951 };
22952 export const V2ThreadForkResponse__CodexErrorInfo = Schema.Union(
22953 [
23058 - Schema.Literals([
23059 - "contextWindowExceeded",
23060 - "sessionBudgetExceeded",
23061 - "usageLimitExceeded",
23062 - "rateLimitExceeded",
23063 - "flexUnavailable",
23064 - "serverOverloaded",
23065 - "cyberPolicy",
23066 - "misalignmentPolicyViolation",
23067 - "tooManyDenials",
23068 - "internalServerError",
23069 - "unauthorized",
23070 - "badRequest",
23071 - "threadRollbackFailed",
23072 - "sandboxError",
23073 - "other",
23074 - ]),
22954 + Schema.String,
22955 Schema.Struct({
22956 httpConnectionFailed: Schema.Struct({
22957 httpStatusCode: Schema.optionalKey(
@@ -23679,21 +23559,7 @@ export const V2ThreadListResponse__ThreadStatus = Schema.Union(
23559 ).annotate({ identifier: "V2ThreadListResponse__ThreadStatus" });
23560
23561 export type V2ThreadListResponse__CodexErrorInfo =
23682 - | "contextWindowExceeded"
23683 - | "sessionBudgetExceeded"
23684 - | "usageLimitExceeded"
23685 - | "rateLimitExceeded"
23686 - | "flexUnavailable"
23687 - | "serverOverloaded"
23688 - | "cyberPolicy"
23689 - | "misalignmentPolicyViolation"
23690 - | "tooManyDenials"
23691 - | "internalServerError"
23692 - | "unauthorized"
23693 - | "badRequest"
23694 - | "threadRollbackFailed"
23695 - | "sandboxError"
23696 - | "other"
23562 + | string
23563 | { readonly httpConnectionFailed: { readonly httpStatusCode?: number | null } }
23564 | { readonly responseStreamConnectionFailed: { readonly httpStatusCode?: number | null } }
23565 | { readonly responseStreamDisconnected: { readonly httpStatusCode?: number | null } }
@@ -23705,23 +23571,7 @@ export type V2ThreadListResponse__CodexErrorInfo =
23571 };
23572 export const V2ThreadListResponse__CodexErrorInfo = Schema.Union(
23573 [
23708 - Schema.Literals([
23709 - "contextWindowExceeded",
23710 - "sessionBudgetExceeded",
23711 - "usageLimitExceeded",
23712 - "rateLimitExceeded",
23713 - "flexUnavailable",
23714 - "serverOverloaded",
23715 - "cyberPolicy",
23716 - "misalignmentPolicyViolation",
23717 - "tooManyDenials",
23718 - "internalServerError",
23719 - "unauthorized",
23720 - "badRequest",
23721 - "threadRollbackFailed",
23722 - "sandboxError",
23723 - "other",
23724 - ]),
23574 + Schema.String,
23575 Schema.Struct({
23576 httpConnectionFailed: Schema.Struct({
23577 httpStatusCode: Schema.optionalKey(
@@ -24088,21 +23938,7 @@ export const V2ThreadMetadataUpdateResponse__ThreadStatus = Schema.Union(
23938 ).annotate({ identifier: "V2ThreadMetadataUpdateResponse__ThreadStatus" });
23939
23940 export type V2ThreadMetadataUpdateResponse__CodexErrorInfo =
24091 - | "contextWindowExceeded"
24092 - | "sessionBudgetExceeded"
24093 - | "usageLimitExceeded"
24094 - | "rateLimitExceeded"
24095 - | "flexUnavailable"
24096 - | "serverOverloaded"
24097 - | "cyberPolicy"
24098 - | "misalignmentPolicyViolation"
24099 - | "tooManyDenials"
24100 - | "internalServerError"
24101 - | "unauthorized"
24102 - | "badRequest"
24103 - | "threadRollbackFailed"
24104 - | "sandboxError"
24105 - | "other"
23941 + | string
23942 | { readonly httpConnectionFailed: { readonly httpStatusCode?: number | null } }
23943 | { readonly responseStreamConnectionFailed: { readonly httpStatusCode?: number | null } }
23944 | { readonly responseStreamDisconnected: { readonly httpStatusCode?: number | null } }
@@ -24114,23 +23950,7 @@ export type V2ThreadMetadataUpdateResponse__CodexErrorInfo =
23950 };
23951 export const V2ThreadMetadataUpdateResponse__CodexErrorInfo = Schema.Union(
23952 [
24117 - Schema.Literals([
24118 - "contextWindowExceeded",
24119 - "sessionBudgetExceeded",
24120 - "usageLimitExceeded",
24121 - "rateLimitExceeded",
24122 - "flexUnavailable",
24123 - "serverOverloaded",
24124 - "cyberPolicy",
24125 - "misalignmentPolicyViolation",
24126 - "tooManyDenials",
24127 - "internalServerError",
24128 - "unauthorized",
24129 - "badRequest",
24130 - "threadRollbackFailed",
24131 - "sandboxError",
24132 - "other",
24133 - ]),
23953 + Schema.String,
23954 Schema.Struct({
23955 httpConnectionFailed: Schema.Struct({
23956 httpStatusCode: Schema.optionalKey(
@@ -24502,21 +24322,7 @@ export const V2ThreadReadResponse__ThreadStatus = Schema.Union(
24322 ).annotate({ identifier: "V2ThreadReadResponse__ThreadStatus" });
24323
24324 export type V2ThreadReadResponse__CodexErrorInfo =
24505 - | "contextWindowExceeded"
24506 - | "sessionBudgetExceeded"
24507 - | "usageLimitExceeded"
24508 - | "rateLimitExceeded"
24509 - | "flexUnavailable"
24510 - | "serverOverloaded"
24511 - | "cyberPolicy"
24512 - | "misalignmentPolicyViolation"
24513 - | "tooManyDenials"
24514 - | "internalServerError"
24515 - | "unauthorized"
24516 - | "badRequest"
24517 - | "threadRollbackFailed"
24518 - | "sandboxError"
24519 - | "other"
24325 + | string
24326 | { readonly httpConnectionFailed: { readonly httpStatusCode?: number | null } }
24327 | { readonly responseStreamConnectionFailed: { readonly httpStatusCode?: number | null } }
24328 | { readonly responseStreamDisconnected: { readonly httpStatusCode?: number | null } }
@@ -24528,23 +24334,7 @@ export type V2ThreadReadResponse__CodexErrorInfo =
24334 };
24335 export const V2ThreadReadResponse__CodexErrorInfo = Schema.Union(
24336 [
24531 - Schema.Literals([
24532 - "contextWindowExceeded",
24533 - "sessionBudgetExceeded",
24534 - "usageLimitExceeded",
24535 - "rateLimitExceeded",
24536 - "flexUnavailable",
24537 - "serverOverloaded",
24538 - "cyberPolicy",
24539 - "misalignmentPolicyViolation",
24540 - "tooManyDenials",
24541 - "internalServerError",
24542 - "unauthorized",
24543 - "badRequest",
24544 - "threadRollbackFailed",
24545 - "sandboxError",
24546 - "other",
24547 - ]),
24337 + Schema.String,
24338 Schema.Struct({
24339 httpConnectionFailed: Schema.Struct({
24340 httpStatusCode: Schema.optionalKey(
@@ -25270,21 +25060,7 @@ export const V2ThreadResumeResponse__ThreadStatus = Schema.Union(
25060 ).annotate({ identifier: "V2ThreadResumeResponse__ThreadStatus" });
25061
25062 export type V2ThreadResumeResponse__CodexErrorInfo =
25273 - | "contextWindowExceeded"
25274 - | "sessionBudgetExceeded"
25275 - | "usageLimitExceeded"
25276 - | "rateLimitExceeded"
25277 - | "flexUnavailable"
25278 - | "serverOverloaded"
25279 - | "cyberPolicy"
25280 - | "misalignmentPolicyViolation"
25281 - | "tooManyDenials"
25282 - | "internalServerError"
25283 - | "unauthorized"
25284 - | "badRequest"
25285 - | "threadRollbackFailed"
25286 - | "sandboxError"
25287 - | "other"
25063 + | string
25064 | { readonly httpConnectionFailed: { readonly httpStatusCode?: number | null } }
25065 | { readonly responseStreamConnectionFailed: { readonly httpStatusCode?: number | null } }
25066 | { readonly responseStreamDisconnected: { readonly httpStatusCode?: number | null } }
@@ -25296,23 +25072,7 @@ export type V2ThreadResumeResponse__CodexErrorInfo =
25072 };
25073 export const V2ThreadResumeResponse__CodexErrorInfo = Schema.Union(
25074 [
25299 - Schema.Literals([
25300 - "contextWindowExceeded",
25301 - "sessionBudgetExceeded",
25302 - "usageLimitExceeded",
25303 - "rateLimitExceeded",
25304 - "flexUnavailable",
25305 - "serverOverloaded",
25306 - "cyberPolicy",
25307 - "misalignmentPolicyViolation",
25308 - "tooManyDenials",
25309 - "internalServerError",
25310 - "unauthorized",
25311 - "badRequest",
25312 - "threadRollbackFailed",
25313 - "sandboxError",
25314 - "other",
25315 - ]),
25075 + Schema.String,
25076 Schema.Struct({
25077 httpConnectionFailed: Schema.Struct({
25078 httpStatusCode: Schema.optionalKey(
@@ -25641,21 +25401,7 @@ export const V2ThreadRevertResponse__ThreadStatus = Schema.Union(
25401 ).annotate({ identifier: "V2ThreadRevertResponse__ThreadStatus" });
25402
25403 export type V2ThreadRevertResponse__CodexErrorInfo =
25644 - | "contextWindowExceeded"
25645 - | "sessionBudgetExceeded"
25646 - | "usageLimitExceeded"
25647 - | "rateLimitExceeded"
25648 - | "flexUnavailable"
25649 - | "serverOverloaded"
25650 - | "cyberPolicy"
25651 - | "misalignmentPolicyViolation"
25652 - | "tooManyDenials"
25653 - | "internalServerError"
25654 - | "unauthorized"
25655 - | "badRequest"
25656 - | "threadRollbackFailed"
25657 - | "sandboxError"
25658 - | "other"
25404 + | string
25405 | { readonly httpConnectionFailed: { readonly httpStatusCode?: number | null } }
25406 | { readonly responseStreamConnectionFailed: { readonly httpStatusCode?: number | null } }
25407 | { readonly responseStreamDisconnected: { readonly httpStatusCode?: number | null } }
@@ -25667,23 +25413,7 @@ export type V2ThreadRevertResponse__CodexErrorInfo =
25413 };
25414 export const V2ThreadRevertResponse__CodexErrorInfo = Schema.Union(
25415 [
25670 - Schema.Literals([
25671 - "contextWindowExceeded",
25672 - "sessionBudgetExceeded",
25673 - "usageLimitExceeded",
25674 - "rateLimitExceeded",
25675 - "flexUnavailable",
25676 - "serverOverloaded",
25677 - "cyberPolicy",
25678 - "misalignmentPolicyViolation",
25679 - "tooManyDenials",
25680 - "internalServerError",
25681 - "unauthorized",
25682 - "badRequest",
25683 - "threadRollbackFailed",
25684 - "sandboxError",
25685 - "other",
25686 - ]),
25416 + Schema.String,
25417 Schema.Struct({
25418 httpConnectionFailed: Schema.Struct({
25419 httpStatusCode: Schema.optionalKey(
@@ -26181,21 +25911,7 @@ export const V2ThreadStartedNotification__ThreadStatus = Schema.Union(
25911 ).annotate({ identifier: "V2ThreadStartedNotification__ThreadStatus" });
25912
25913 export type V2ThreadStartedNotification__CodexErrorInfo =
26184 - | "contextWindowExceeded"
26185 - | "sessionBudgetExceeded"
26186 - | "usageLimitExceeded"
26187 - | "rateLimitExceeded"
26188 - | "flexUnavailable"
26189 - | "serverOverloaded"
26190 - | "cyberPolicy"
26191 - | "misalignmentPolicyViolation"
26192 - | "tooManyDenials"
26193 - | "internalServerError"
26194 - | "unauthorized"
26195 - | "badRequest"
26196 - | "threadRollbackFailed"
26197 - | "sandboxError"
26198 - | "other"
25914 + | string
25915 | { readonly httpConnectionFailed: { readonly httpStatusCode?: number | null } }
25916 | { readonly responseStreamConnectionFailed: { readonly httpStatusCode?: number | null } }
25917 | { readonly responseStreamDisconnected: { readonly httpStatusCode?: number | null } }
@@ -26207,23 +25923,7 @@ export type V2ThreadStartedNotification__CodexErrorInfo =
25923 };
25924 export const V2ThreadStartedNotification__CodexErrorInfo = Schema.Union(
25925 [
26210 - Schema.Literals([
26211 - "contextWindowExceeded",
26212 - "sessionBudgetExceeded",
26213 - "usageLimitExceeded",
26214 - "rateLimitExceeded",
26215 - "flexUnavailable",
26216 - "serverOverloaded",
26217 - "cyberPolicy",
26218 - "misalignmentPolicyViolation",
26219 - "tooManyDenials",
26220 - "internalServerError",
26221 - "unauthorized",
26222 - "badRequest",
26223 - "threadRollbackFailed",
26224 - "sandboxError",
26225 - "other",
26226 - ]),
25926 + Schema.String,
25927 Schema.Struct({
25928 httpConnectionFailed: Schema.Struct({
25929 httpStatusCode: Schema.optionalKey(
@@ -26686,21 +26386,7 @@ export const V2ThreadStartResponse__ThreadStatus = Schema.Union(
26386 ).annotate({ identifier: "V2ThreadStartResponse__ThreadStatus" });
26387
26388 export type V2ThreadStartResponse__CodexErrorInfo =
26689 - | "contextWindowExceeded"
26690 - | "sessionBudgetExceeded"
26691 - | "usageLimitExceeded"
26692 - | "rateLimitExceeded"
26693 - | "flexUnavailable"
26694 - | "serverOverloaded"
26695 - | "cyberPolicy"
26696 - | "misalignmentPolicyViolation"
26697 - | "tooManyDenials"
26698 - | "internalServerError"
26699 - | "unauthorized"
26700 - | "badRequest"
26701 - | "threadRollbackFailed"
26702 - | "sandboxError"
26703 - | "other"
26389 + | string
26390 | { readonly httpConnectionFailed: { readonly httpStatusCode?: number | null } }
26391 | { readonly responseStreamConnectionFailed: { readonly httpStatusCode?: number | null } }
26392 | { readonly responseStreamDisconnected: { readonly httpStatusCode?: number | null } }
@@ -26712,23 +26398,7 @@ export type V2ThreadStartResponse__CodexErrorInfo =
26398 };
26399 export const V2ThreadStartResponse__CodexErrorInfo = Schema.Union(
26400 [
26715 - Schema.Literals([
26716 - "contextWindowExceeded",
26717 - "sessionBudgetExceeded",
26718 - "usageLimitExceeded",
26719 - "rateLimitExceeded",
26720 - "flexUnavailable",
26721 - "serverOverloaded",
26722 - "cyberPolicy",
26723 - "misalignmentPolicyViolation",
26724 - "tooManyDenials",
26725 - "internalServerError",
26726 - "unauthorized",
26727 - "badRequest",
26728 - "threadRollbackFailed",
26729 - "sandboxError",
26730 - "other",
26731 - ]),
26401 + Schema.String,
26402 Schema.Struct({
26403 httpConnectionFailed: Schema.Struct({
26404 httpStatusCode: Schema.optionalKey(
@@ -27016,21 +26686,7 @@ export const V2ThreadTokenUsageUpdatedNotification__ThreadTokenUsage = Schema.St
26686 }).annotate({ identifier: "V2ThreadTokenUsageUpdatedNotification__ThreadTokenUsage" });
26687
26688 export type V2ThreadTurnsListResponse__CodexErrorInfo =
27019 - | "contextWindowExceeded"
27020 - | "sessionBudgetExceeded"
27021 - | "usageLimitExceeded"
27022 - | "rateLimitExceeded"
27023 - | "flexUnavailable"
27024 - | "serverOverloaded"
27025 - | "cyberPolicy"
27026 - | "misalignmentPolicyViolation"
27027 - | "tooManyDenials"
27028 - | "internalServerError"
27029 - | "unauthorized"
27030 - | "badRequest"
27031 - | "threadRollbackFailed"
27032 - | "sandboxError"
27033 - | "other"
26689 + | string
26690 | { readonly httpConnectionFailed: { readonly httpStatusCode?: number | null } }
26691 | { readonly responseStreamConnectionFailed: { readonly httpStatusCode?: number | null } }
26692 | { readonly responseStreamDisconnected: { readonly httpStatusCode?: number | null } }
@@ -27042,23 +26698,7 @@ export type V2ThreadTurnsListResponse__CodexErrorInfo =
26698 };
26699 export const V2ThreadTurnsListResponse__CodexErrorInfo = Schema.Union(
26700 [
27045 - Schema.Literals([
27046 - "contextWindowExceeded",
27047 - "sessionBudgetExceeded",
27048 - "usageLimitExceeded",
27049 - "rateLimitExceeded",
27050 - "flexUnavailable",
27051 - "serverOverloaded",
27052 - "cyberPolicy",
27053 - "misalignmentPolicyViolation",
27054 - "tooManyDenials",
27055 - "internalServerError",
27056 - "unauthorized",
27057 - "badRequest",
27058 - "threadRollbackFailed",
27059 - "sandboxError",
27060 - "other",
27061 - ]),
26701 + Schema.String,
26702 Schema.Struct({
26703 httpConnectionFailed: Schema.Struct({
26704 httpStatusCode: Schema.optionalKey(
@@ -27429,21 +27069,7 @@ export const V2ThreadUnarchiveResponse__ThreadStatus = Schema.Union(
27069 ).annotate({ identifier: "V2ThreadUnarchiveResponse__ThreadStatus" });
27070
27071 export type V2ThreadUnarchiveResponse__CodexErrorInfo =
27432 - | "contextWindowExceeded"
27433 - | "sessionBudgetExceeded"
27434 - | "usageLimitExceeded"
27435 - | "rateLimitExceeded"
27436 - | "flexUnavailable"
27437 - | "serverOverloaded"
27438 - | "cyberPolicy"
27439 - | "misalignmentPolicyViolation"
27440 - | "tooManyDenials"
27441 - | "internalServerError"
27442 - | "unauthorized"
27443 - | "badRequest"
27444 - | "threadRollbackFailed"
27445 - | "sandboxError"
27446 - | "other"
27072 + | string
27073 | { readonly httpConnectionFailed: { readonly httpStatusCode?: number | null } }
27074 | { readonly responseStreamConnectionFailed: { readonly httpStatusCode?: number | null } }
27075 | { readonly responseStreamDisconnected: { readonly httpStatusCode?: number | null } }
@@ -27455,23 +27081,7 @@ export type V2ThreadUnarchiveResponse__CodexErrorInfo =
27081 };
27082 export const V2ThreadUnarchiveResponse__CodexErrorInfo = Schema.Union(
27083 [
27458 - Schema.Literals([
27459 - "contextWindowExceeded",
27460 - "sessionBudgetExceeded",
27461 - "usageLimitExceeded",
27462 - "rateLimitExceeded",
27463 - "flexUnavailable",
27464 - "serverOverloaded",
27465 - "cyberPolicy",
27466 - "misalignmentPolicyViolation",
27467 - "tooManyDenials",
27468 - "internalServerError",
27469 - "unauthorized",
27470 - "badRequest",
27471 - "threadRollbackFailed",
27472 - "sandboxError",
27473 - "other",
27474 - ]),
27084 + Schema.String,
27085 Schema.Struct({
27086 httpConnectionFailed: Schema.Struct({
27087 httpStatusCode: Schema.optionalKey(
@@ -27760,21 +27370,7 @@ export const V2ThreadUnarchiveResponse__CollabAgentState = Schema.Struct({
27370 }).annotate({ identifier: "V2ThreadUnarchiveResponse__CollabAgentState" });
27371
27372 export type V2TurnCompletedNotification__CodexErrorInfo =
27763 - | "contextWindowExceeded"
27764 - | "sessionBudgetExceeded"
27765 - | "usageLimitExceeded"
27766 - | "rateLimitExceeded"
27767 - | "flexUnavailable"
27768 - | "serverOverloaded"
27769 - | "cyberPolicy"
27770 - | "misalignmentPolicyViolation"
27771 - | "tooManyDenials"
27772 - | "internalServerError"
27773 - | "unauthorized"
27774 - | "badRequest"
27775 - | "threadRollbackFailed"
27776 - | "sandboxError"
27777 - | "other"
27373 + | string
27374 | { readonly httpConnectionFailed: { readonly httpStatusCode?: number | null } }
27375 | { readonly responseStreamConnectionFailed: { readonly httpStatusCode?: number | null } }
27376 | { readonly responseStreamDisconnected: { readonly httpStatusCode?: number | null } }
@@ -27786,23 +27382,7 @@ export type V2TurnCompletedNotification__CodexErrorInfo =
27382 };
27383 export const V2TurnCompletedNotification__CodexErrorInfo = Schema.Union(
27384 [
27789 - Schema.Literals([
27790 - "contextWindowExceeded",
27791 - "sessionBudgetExceeded",
27792 - "usageLimitExceeded",
27793 - "rateLimitExceeded",
27794 - "flexUnavailable",
27795 - "serverOverloaded",
27796 - "cyberPolicy",
27797 - "misalignmentPolicyViolation",
27798 - "tooManyDenials",
27799 - "internalServerError",
27800 - "unauthorized",
27801 - "badRequest",
27802 - "threadRollbackFailed",
27803 - "sandboxError",
27804 - "other",
27805 - ]),
27385 + Schema.String,
27386 Schema.Struct({
27387 httpConnectionFailed: Schema.Struct({
27388 httpStatusCode: Schema.optionalKey(
@@ -28101,21 +27681,7 @@ export const V2TurnPlanUpdatedNotification__TurnPlanStep = Schema.Struct({
27681 }).annotate({ identifier: "V2TurnPlanUpdatedNotification__TurnPlanStep" });
27682
27683 export type V2TurnStartedNotification__CodexErrorInfo =
28104 - | "contextWindowExceeded"
28105 - | "sessionBudgetExceeded"
28106 - | "usageLimitExceeded"
28107 - | "rateLimitExceeded"
28108 - | "flexUnavailable"
28109 - | "serverOverloaded"
28110 - | "cyberPolicy"
28111 - | "misalignmentPolicyViolation"
28112 - | "tooManyDenials"
28113 - | "internalServerError"
28114 - | "unauthorized"
28115 - | "badRequest"
28116 - | "threadRollbackFailed"
28117 - | "sandboxError"
28118 - | "other"
27684 + | string
27685 | { readonly httpConnectionFailed: { readonly httpStatusCode?: number | null } }
27686 | { readonly responseStreamConnectionFailed: { readonly httpStatusCode?: number | null } }
27687 | { readonly responseStreamDisconnected: { readonly httpStatusCode?: number | null } }
@@ -28127,23 +27693,7 @@ export type V2TurnStartedNotification__CodexErrorInfo =
27693 };
27694 export const V2TurnStartedNotification__CodexErrorInfo = Schema.Union(
27695 [
28130 - Schema.Literals([
28131 - "contextWindowExceeded",
28132 - "sessionBudgetExceeded",
28133 - "usageLimitExceeded",
28134 - "rateLimitExceeded",
28135 - "flexUnavailable",
28136 - "serverOverloaded",
28137 - "cyberPolicy",
28138 - "misalignmentPolicyViolation",
28139 - "tooManyDenials",
28140 - "internalServerError",
28141 - "unauthorized",
28142 - "badRequest",
28143 - "threadRollbackFailed",
28144 - "sandboxError",
28145 - "other",
28146 - ]),
27696 + Schema.String,
27697 Schema.Struct({
27698 httpConnectionFailed: Schema.Struct({
27699 httpStatusCode: Schema.optionalKey(
@@ -28569,21 +28119,7 @@ export const V2TurnStartParams__SandboxPolicy = Schema.Union(
28119 ).annotate({ identifier: "V2TurnStartParams__SandboxPolicy" });
28120
28121 export type V2TurnStartResponse__CodexErrorInfo =
28572 - | "contextWindowExceeded"
28573 - | "sessionBudgetExceeded"
28574 - | "usageLimitExceeded"
28575 - | "rateLimitExceeded"
28576 - | "flexUnavailable"
28577 - | "serverOverloaded"
28578 - | "cyberPolicy"
28579 - | "misalignmentPolicyViolation"
28580 - | "tooManyDenials"
28581 - | "internalServerError"
28582 - | "unauthorized"
28583 - | "badRequest"
28584 - | "threadRollbackFailed"
28585 - | "sandboxError"
28586 - | "other"
28122 + | string
28123 | { readonly httpConnectionFailed: { readonly httpStatusCode?: number | null } }
28124 | { readonly responseStreamConnectionFailed: { readonly httpStatusCode?: number | null } }
28125 | { readonly responseStreamDisconnected: { readonly httpStatusCode?: number | null } }
@@ -28595,23 +28131,7 @@ export type V2TurnStartResponse__CodexErrorInfo =
28131 };
28132 export const V2TurnStartResponse__CodexErrorInfo = Schema.Union(
28133 [
28598 - Schema.Literals([
28599 - "contextWindowExceeded",
28600 - "sessionBudgetExceeded",
28601 - "usageLimitExceeded",
28602 - "rateLimitExceeded",
28603 - "flexUnavailable",
28604 - "serverOverloaded",
28605 - "cyberPolicy",
28606 - "misalignmentPolicyViolation",
28607 - "tooManyDenials",
28608 - "internalServerError",
28609 - "unauthorized",
28610 - "badRequest",
28611 - "threadRollbackFailed",
28612 - "sandboxError",
28613 - "other",
28614 - ]),
28134 + Schema.String,
28135 Schema.Struct({
28136 httpConnectionFailed: Schema.Struct({
28137 httpStatusCode: Schema.optionalKey(