TypeScript
fix(codex): preserve partial answer messages and thread histories (#23388)
Alex Southwell87b36c77fb5c
diff --git a/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts b/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.tsindex 6413ed0bfe9..8efdc1b468b 100644--- a/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts+++ b/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts@@ -3201,7 +3201,7 @@ describe("CodexAdapterV2 post-settle continuation", () => {answers: ReadonlyArray<{readonly id: string;readonly text: string;- readonly phase?: "commentary" | "final_answer" | null;+ readonly phase?: "commentary" | "partial_answer" | "final_answer" | null;readonly omitPhase?: boolean;readonly streamed?: boolean;readonly completionDelayMs?: number;@@ -3296,6 +3296,39 @@ describe("CodexAdapterV2 post-settle continuation", () => {});};+ it.effect.each([false, true])(+ "preserves a final answer that repeats a preceding partial answer (streamed: %s)",+ (streamed) =>+ Effect.scoped(+ Effect.gen(function* () {+ const transcript = finalAnswerTranscript("codex-partial-then-final", [+ { id: "partial", text: "CODEX_RECOVERY_OK", phase: "partial_answer", streamed },+ { id: "final", text: "CODEX_RECOVERY_OK", phase: "final_answer", streamed },+ ]);+ const harness = yield* makeCodexReplayHarness(transcript);+ const now = yield* DateTime.now;+ yield* harness.runtime.startTurn(+ makeCodexTestTurnInput({+ threadId: harness.threadId,+ providerThread: harness.providerThread,+ now,+ attemptId: RunAttemptId.make("attempt-codex-partial-then-final"),+ text: "Reply with the requested recovery marker.",+ }),+ );+ yield* harness.awaitTerminal(1);+ assert.deepEqual(+ assistantMessages(harness.events).map((event) => event.message.text),+ ["CODEX_RECOVERY_OK", "CODEX_RECOVERY_OK"],+ );+ }).pipe(+ Effect.provide(+ Layer.mergeAll(IdAllocator.layer, McpProviderSessions.layer, NodeServices.layer),+ ),+ ),+ ),+ );+it.effect.each([{name: "a text reply gains each saved image once",diff --git a/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts b/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.tsindex 1ebb5b5fb12..37426780466 100644--- a/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts+++ b/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts@@ -4769,7 +4769,7 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (}if (payload.item.type === "agentMessage") {- if (payload.item.phase !== "commentary") {+ if (payload.item.phase == null || payload.item.phase === "final_answer") {yield* Ref.update(finalAnswerItemIdsByTurn, (current) => {const updated = new Map(current);const itemIds = new Set(updated.get(payload.turnId) ?? []);@@ -5132,7 +5132,7 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (return;}- const finalAnswer = payload.item.phase !== "commentary";+ const finalAnswer = payload.item.phase == null || payload.item.phase === "final_answer";if (finalAnswer) {yield* Ref.update(finalAnswerItemIdsByTurn, (current) => {const updated = new Map(current);diff --git a/packages/effect-codex-app-server/scripts/generate.ts b/packages/effect-codex-app-server/scripts/generate.tsindex 23ce2e1edd3..8f9a45bb929 100644--- a/packages/effect-codex-app-server/scripts/generate.ts+++ b/packages/effect-codex-app-server/scripts/generate.ts@@ -145,6 +145,29 @@ const ManualSchemas: Record<string, Schema.Json> = {// `account/read` decode and take the provider down with it.const DefinitionOverrides: Record<string, Schema.Json> = {PlanType: { type: "string" },+ // Newer custom Codex binaries emit partial answers before additional tools or text.+ MessagePhase: {+ description:+ 'Classifies an assistant message as interim commentary or final answer text.\n\nProviders do not emit this consistently, so callers must treat `None` as "phase unknown" and keep compatibility behavior for legacy models.',+ oneOf: [+ {+ type: "string",+ enum: ["commentary"],+ description:+ "Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.",+ },+ {+ type: "string",+ enum: ["partial_answer"],+ description: "Stable answer text that may be followed by more assistant output or tools.",+ },+ {+ type: "string",+ enum: ["final_answer"],+ description: "The assistant's terminal answer text for the current turn.",+ },+ ],+ },};const getGeneratedPaths = Effect.fn("getGeneratedPaths")(function* () {diff --git a/packages/effect-codex-app-server/src/_generated/schema.gen.ts b/packages/effect-codex-app-server/src/_generated/schema.gen.tsindex 90006c01697..90869b56aa8 100644--- a/packages/effect-codex-app-server/src/_generated/schema.gen.ts+++ b/packages/effect-codex-app-server/src/_generated/schema.gen.ts@@ -1532,13 +1532,16 @@ export const ClientRequest__InternalChatMessageMetadataPassthrough = Schema.Struidentifier: "ClientRequest__InternalChatMessageMetadataPassthrough",});-export type ClientRequest__MessagePhase = "commentary" | "final_answer";+export type ClientRequest__MessagePhase = "commentary" | "partial_answer" | "final_answer";export const ClientRequest__MessagePhase = Schema.Union([Schema.Literal("commentary").annotate({description:"Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.",}),+ Schema.Literal("partial_answer").annotate({+ description: "Stable answer text that may be followed by more assistant output or tools.",+ }),Schema.Literal("final_answer").annotate({description: "The assistant's terminal answer text for the current turn.",}),@@ -2219,13 +2222,16 @@ export const ServerNotification__MemoryCitationEntry = Schema.Struct({path: Schema.String,}).annotate({ identifier: "ServerNotification__MemoryCitationEntry" });-export type ServerNotification__MessagePhase = "commentary" | "final_answer";+export type ServerNotification__MessagePhase = "commentary" | "partial_answer" | "final_answer";export const ServerNotification__MessagePhase = Schema.Union([Schema.Literal("commentary").annotate({description:"Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.",}),+ Schema.Literal("partial_answer").annotate({+ description: "Stable answer text that may be followed by more assistant output or tools.",+ }),Schema.Literal("final_answer").annotate({description: "The assistant's terminal answer text for the current turn.",}),@@ -5991,13 +5997,19 @@ export const V2ItemCompletedNotification__MemoryCitationEntry = Schema.Struct({path: Schema.String,}).annotate({ identifier: "V2ItemCompletedNotification__MemoryCitationEntry" });-export type V2ItemCompletedNotification__MessagePhase = "commentary" | "final_answer";+export type V2ItemCompletedNotification__MessagePhase =+ | "commentary"+ | "partial_answer"+ | "final_answer";export const V2ItemCompletedNotification__MessagePhase = Schema.Union([Schema.Literal("commentary").annotate({description:"Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.",}),+ Schema.Literal("partial_answer").annotate({+ description: "Stable answer text that may be followed by more assistant output or tools.",+ }),Schema.Literal("final_answer").annotate({description: "The assistant's terminal answer text for the current turn.",}),@@ -6538,13 +6550,19 @@ export const V2ItemStartedNotification__MemoryCitationEntry = Schema.Struct({path: Schema.String,}).annotate({ identifier: "V2ItemStartedNotification__MemoryCitationEntry" });-export type V2ItemStartedNotification__MessagePhase = "commentary" | "final_answer";+export type V2ItemStartedNotification__MessagePhase =+ | "commentary"+ | "partial_answer"+ | "final_answer";export const V2ItemStartedNotification__MessagePhase = Schema.Union([Schema.Literal("commentary").annotate({description:"Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.",}),+ Schema.Literal("partial_answer").annotate({+ description: "Stable answer text that may be followed by more assistant output or tools.",+ }),Schema.Literal("final_answer").annotate({description: "The assistant's terminal answer text for the current turn.",}),@@ -7915,13 +7933,19 @@ export const V2RawResponseItemCompletedNotification__InternalChatMessageMetadataidentifier: "V2RawResponseItemCompletedNotification__InternalChatMessageMetadataPassthrough",});-export type V2RawResponseItemCompletedNotification__MessagePhase = "commentary" | "final_answer";+export type V2RawResponseItemCompletedNotification__MessagePhase =+ | "commentary"+ | "partial_answer"+ | "final_answer";export const V2RawResponseItemCompletedNotification__MessagePhase = Schema.Union([Schema.Literal("commentary").annotate({description:"Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.",}),+ Schema.Literal("partial_answer").annotate({+ description: "Stable answer text that may be followed by more assistant output or tools.",+ }),Schema.Literal("final_answer").annotate({description: "The assistant's terminal answer text for the current turn.",}),@@ -8215,13 +8239,16 @@ export const V2ReviewStartResponse__MemoryCitationEntry = Schema.Struct({path: Schema.String,}).annotate({ identifier: "V2ReviewStartResponse__MemoryCitationEntry" });-export type V2ReviewStartResponse__MessagePhase = "commentary" | "final_answer";+export type V2ReviewStartResponse__MessagePhase = "commentary" | "partial_answer" | "final_answer";export const V2ReviewStartResponse__MessagePhase = Schema.Union([Schema.Literal("commentary").annotate({description:"Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.",}),+ Schema.Literal("partial_answer").annotate({+ description: "Stable answer text that may be followed by more assistant output or tools.",+ }),Schema.Literal("final_answer").annotate({description: "The assistant's terminal answer text for the current turn.",}),@@ -8927,13 +8954,16 @@ export const V2ThreadForkResponse__MemoryCitationEntry = Schema.Struct({path: Schema.String,}).annotate({ identifier: "V2ThreadForkResponse__MemoryCitationEntry" });-export type V2ThreadForkResponse__MessagePhase = "commentary" | "final_answer";+export type V2ThreadForkResponse__MessagePhase = "commentary" | "partial_answer" | "final_answer";export const V2ThreadForkResponse__MessagePhase = Schema.Union([Schema.Literal("commentary").annotate({description:"Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.",}),+ Schema.Literal("partial_answer").annotate({+ description: "Stable answer text that may be followed by more assistant output or tools.",+ }),Schema.Literal("final_answer").annotate({description: "The assistant's terminal answer text for the current turn.",}),@@ -9382,13 +9412,19 @@ export const V2ThreadItemsListResponse__MemoryCitationEntry = Schema.Struct({path: Schema.String,}).annotate({ identifier: "V2ThreadItemsListResponse__MemoryCitationEntry" });-export type V2ThreadItemsListResponse__MessagePhase = "commentary" | "final_answer";+export type V2ThreadItemsListResponse__MessagePhase =+ | "commentary"+ | "partial_answer"+ | "final_answer";export const V2ThreadItemsListResponse__MessagePhase = Schema.Union([Schema.Literal("commentary").annotate({description:"Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.",}),+ Schema.Literal("partial_answer").annotate({+ description: "Stable answer text that may be followed by more assistant output or tools.",+ }),Schema.Literal("final_answer").annotate({description: "The assistant's terminal answer text for the current turn.",}),@@ -9872,13 +9908,16 @@ export const V2ThreadListResponse__MemoryCitationEntry = Schema.Struct({path: Schema.String,}).annotate({ identifier: "V2ThreadListResponse__MemoryCitationEntry" });-export type V2ThreadListResponse__MessagePhase = "commentary" | "final_answer";+export type V2ThreadListResponse__MessagePhase = "commentary" | "partial_answer" | "final_answer";export const V2ThreadListResponse__MessagePhase = Schema.Union([Schema.Literal("commentary").annotate({description:"Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.",}),+ Schema.Literal("partial_answer").annotate({+ description: "Stable answer text that may be followed by more assistant output or tools.",+ }),Schema.Literal("final_answer").annotate({description: "The assistant's terminal answer text for the current turn.",}),@@ -10364,13 +10403,19 @@ export const V2ThreadMetadataUpdateResponse__MemoryCitationEntry = Schema.Structpath: Schema.String,}).annotate({ identifier: "V2ThreadMetadataUpdateResponse__MemoryCitationEntry" });-export type V2ThreadMetadataUpdateResponse__MessagePhase = "commentary" | "final_answer";+export type V2ThreadMetadataUpdateResponse__MessagePhase =+ | "commentary"+ | "partial_answer"+ | "final_answer";export const V2ThreadMetadataUpdateResponse__MessagePhase = Schema.Union([Schema.Literal("commentary").annotate({description:"Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.",}),+ Schema.Literal("partial_answer").annotate({+ description: "Stable answer text that may be followed by more assistant output or tools.",+ }),Schema.Literal("final_answer").annotate({description: "The assistant's terminal answer text for the current turn.",}),@@ -10822,13 +10867,16 @@ export const V2ThreadReadResponse__MemoryCitationEntry = Schema.Struct({path: Schema.String,}).annotate({ identifier: "V2ThreadReadResponse__MemoryCitationEntry" });-export type V2ThreadReadResponse__MessagePhase = "commentary" | "final_answer";+export type V2ThreadReadResponse__MessagePhase = "commentary" | "partial_answer" | "final_answer";export const V2ThreadReadResponse__MessagePhase = Schema.Union([Schema.Literal("commentary").annotate({description:"Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.",}),+ Schema.Literal("partial_answer").annotate({+ description: "Stable answer text that may be followed by more assistant output or tools.",+ }),Schema.Literal("final_answer").annotate({description: "The assistant's terminal answer text for the current turn.",}),@@ -11382,13 +11430,16 @@ export const V2ThreadResumeParams__InternalChatMessageMetadataPassthrough = Scheidentifier: "V2ThreadResumeParams__InternalChatMessageMetadataPassthrough",});-export type V2ThreadResumeParams__MessagePhase = "commentary" | "final_answer";+export type V2ThreadResumeParams__MessagePhase = "commentary" | "partial_answer" | "final_answer";export const V2ThreadResumeParams__MessagePhase = Schema.Union([Schema.Literal("commentary").annotate({description:"Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.",}),+ Schema.Literal("partial_answer").annotate({+ description: "Stable answer text that may be followed by more assistant output or tools.",+ }),Schema.Literal("final_answer").annotate({description: "The assistant's terminal answer text for the current turn.",}),@@ -11755,13 +11806,16 @@ export const V2ThreadResumeResponse__MemoryCitationEntry = Schema.Struct({path: Schema.String,}).annotate({ identifier: "V2ThreadResumeResponse__MemoryCitationEntry" });-export type V2ThreadResumeResponse__MessagePhase = "commentary" | "final_answer";+export type V2ThreadResumeResponse__MessagePhase = "commentary" | "partial_answer" | "final_answer";export const V2ThreadResumeResponse__MessagePhase = Schema.Union([Schema.Literal("commentary").annotate({description:"Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.",}),+ Schema.Literal("partial_answer").annotate({+ description: "Stable answer text that may be followed by more assistant output or tools.",+ }),Schema.Literal("final_answer").annotate({description: "The assistant's terminal answer text for the current turn.",}),@@ -12202,13 +12256,16 @@ export const V2ThreadRevertResponse__MemoryCitationEntry = Schema.Struct({path: Schema.String,}).annotate({ identifier: "V2ThreadRevertResponse__MemoryCitationEntry" });-export type V2ThreadRevertResponse__MessagePhase = "commentary" | "final_answer";+export type V2ThreadRevertResponse__MessagePhase = "commentary" | "partial_answer" | "final_answer";export const V2ThreadRevertResponse__MessagePhase = Schema.Union([Schema.Literal("commentary").annotate({description:"Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.",}),+ Schema.Literal("partial_answer").annotate({+ description: "Stable answer text that may be followed by more assistant output or tools.",+ }),Schema.Literal("final_answer").annotate({description: "The assistant's terminal answer text for the current turn.",}),@@ -12841,13 +12898,19 @@ export const V2ThreadStartedNotification__MemoryCitationEntry = Schema.Struct({path: Schema.String,}).annotate({ identifier: "V2ThreadStartedNotification__MemoryCitationEntry" });-export type V2ThreadStartedNotification__MessagePhase = "commentary" | "final_answer";+export type V2ThreadStartedNotification__MessagePhase =+ | "commentary"+ | "partial_answer"+ | "final_answer";export const V2ThreadStartedNotification__MessagePhase = Schema.Union([Schema.Literal("commentary").annotate({description:"Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.",}),+ Schema.Literal("partial_answer").annotate({+ description: "Stable answer text that may be followed by more assistant output or tools.",+ }),Schema.Literal("final_answer").annotate({description: "The assistant's terminal answer text for the current turn.",}),@@ -13469,13 +13532,16 @@ export const V2ThreadStartResponse__MemoryCitationEntry = Schema.Struct({path: Schema.String,}).annotate({ identifier: "V2ThreadStartResponse__MemoryCitationEntry" });-export type V2ThreadStartResponse__MessagePhase = "commentary" | "final_answer";+export type V2ThreadStartResponse__MessagePhase = "commentary" | "partial_answer" | "final_answer";export const V2ThreadStartResponse__MessagePhase = Schema.Union([Schema.Literal("commentary").annotate({description:"Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.",}),+ Schema.Literal("partial_answer").annotate({+ description: "Stable answer text that may be followed by more assistant output or tools.",+ }),Schema.Literal("final_answer").annotate({description: "The assistant's terminal answer text for the current turn.",}),@@ -13910,13 +13976,19 @@ export const V2ThreadTurnsListResponse__MemoryCitationEntry = Schema.Struct({path: Schema.String,}).annotate({ identifier: "V2ThreadTurnsListResponse__MemoryCitationEntry" });-export type V2ThreadTurnsListResponse__MessagePhase = "commentary" | "final_answer";+export type V2ThreadTurnsListResponse__MessagePhase =+ | "commentary"+ | "partial_answer"+ | "final_answer";export const V2ThreadTurnsListResponse__MessagePhase = Schema.Union([Schema.Literal("commentary").annotate({description:"Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.",}),+ Schema.Literal("partial_answer").annotate({+ description: "Stable answer text that may be followed by more assistant output or tools.",+ }),Schema.Literal("final_answer").annotate({description: "The assistant's terminal answer text for the current turn.",}),@@ -14384,13 +14456,19 @@ export const V2ThreadUnarchiveResponse__MemoryCitationEntry = Schema.Struct({path: Schema.String,}).annotate({ identifier: "V2ThreadUnarchiveResponse__MemoryCitationEntry" });-export type V2ThreadUnarchiveResponse__MessagePhase = "commentary" | "final_answer";+export type V2ThreadUnarchiveResponse__MessagePhase =+ | "commentary"+ | "partial_answer"+ | "final_answer";export const V2ThreadUnarchiveResponse__MessagePhase = Schema.Union([Schema.Literal("commentary").annotate({description:"Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.",}),+ Schema.Literal("partial_answer").annotate({+ description: "Stable answer text that may be followed by more assistant output or tools.",+ }),Schema.Literal("final_answer").annotate({description: "The assistant's terminal answer text for the current turn.",}),@@ -14785,13 +14863,19 @@ export const V2TurnCompletedNotification__MemoryCitationEntry = Schema.Struct({path: Schema.String,}).annotate({ identifier: "V2TurnCompletedNotification__MemoryCitationEntry" });-export type V2TurnCompletedNotification__MessagePhase = "commentary" | "final_answer";+export type V2TurnCompletedNotification__MessagePhase =+ | "commentary"+ | "partial_answer"+ | "final_answer";export const V2TurnCompletedNotification__MessagePhase = Schema.Union([Schema.Literal("commentary").annotate({description:"Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.",}),+ Schema.Literal("partial_answer").annotate({+ description: "Stable answer text that may be followed by more assistant output or tools.",+ }),Schema.Literal("final_answer").annotate({description: "The assistant's terminal answer text for the current turn.",}),@@ -15200,13 +15284,19 @@ export const V2TurnStartedNotification__MemoryCitationEntry = Schema.Struct({path: Schema.String,}).annotate({ identifier: "V2TurnStartedNotification__MemoryCitationEntry" });-export type V2TurnStartedNotification__MessagePhase = "commentary" | "final_answer";+export type V2TurnStartedNotification__MessagePhase =+ | "commentary"+ | "partial_answer"+ | "final_answer";export const V2TurnStartedNotification__MessagePhase = Schema.Union([Schema.Literal("commentary").annotate({description:"Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.",}),+ Schema.Literal("partial_answer").annotate({+ description: "Stable answer text that may be followed by more assistant output or tools.",+ }),Schema.Literal("final_answer").annotate({description: "The assistant's terminal answer text for the current turn.",}),@@ -15729,13 +15819,16 @@ export const V2TurnStartResponse__MemoryCitationEntry = Schema.Struct({path: Schema.String,}).annotate({ identifier: "V2TurnStartResponse__MemoryCitationEntry" });-export type V2TurnStartResponse__MessagePhase = "commentary" | "final_answer";+export type V2TurnStartResponse__MessagePhase = "commentary" | "partial_answer" | "final_answer";export const V2TurnStartResponse__MessagePhase = Schema.Union([Schema.Literal("commentary").annotate({description:"Mid-turn assistant text (for example preamble/progress narration).\n\nAdditional tool calls or assistant output may follow before turn completion.",}),+ Schema.Literal("partial_answer").annotate({+ description: "Stable answer text that may be followed by more assistant output or tools.",+ }),Schema.Literal("final_answer").annotate({description: "The assistant's terminal answer text for the current turn.",}),diff --git a/packages/effect-codex-app-server/src/schema.test.ts b/packages/effect-codex-app-server/src/schema.test.tsindex 2f6fefde0d6..dfbedf86af9 100644--- a/packages/effect-codex-app-server/src/schema.test.ts+++ b/packages/effect-codex-app-server/src/schema.test.ts@@ -33,6 +33,52 @@ it("keeps async questions in live notifications and thread history", () => {}});+it("keeps partial answers in notifications and persisted thread histories", () => {+ const item = {+ type: "agentMessage",+ id: "partial-1",+ text: "A stable answer before more tool work.",+ phase: "partial_answer",+ } as const;+ for (const schema of [+ CodexSchema.ServerNotification__ThreadItem,+ CodexSchema.V2ItemStartedNotification__ThreadItem,+ CodexSchema.V2ItemCompletedNotification__ThreadItem,+ CodexSchema.V2ThreadReadResponse__ThreadItem,+ CodexSchema.V2ThreadResumeResponse__ThreadItem,+ CodexSchema.V2ThreadForkResponse__ThreadItem,+ CodexSchema.V2TurnCompletedNotification__ThreadItem,+ ]) {+ assert.deepEqual(Schema.decodeSync(schema)(item), item);+ }+ const response = {+ approvalPolicy: "never",+ approvalsReviewer: "user",+ cwd: "/tmp/project",+ model: "gpt-5.6-sol",+ modelProvider: "openai",+ sandbox: { type: "dangerFullAccess" },+ thread: {+ cliVersion: "0.162.0",+ createdAt: 0,+ updatedAt: 0,+ cwd: "/tmp/project",+ ephemeral: false,+ id: "thread-1",+ modelProvider: "openai",+ preview: "",+ projectId: null,+ sessionId: "session-1",+ source: "cli",+ status: { type: "idle" },+ turns: [{ id: "turn-1", status: "completed", items: [item] }],+ },+ };+ assert.equal(isThreadForkResponse(response), true);+ assert.equal(isThreadResumeResponse(response), true);+ assert.equal(isThreadReadResponse({ thread: response.thread }), true);+});+it("accepts Codex 0.150 multi-agent values", () => {const schemas = [CodexSchema.ServerNotification__SubAgentActivityKind,