From be4aec89bee18d44eb53190311c4cbbc761f8ebf Mon Sep 17 00:00:00 2001 From: Ada Sen Date: Wed, 9 Sep 2026 06:23:29 +0000 Subject: [PATCH] fix(summarizer): set excludeTurns on ephemeral Codex thread/fork (#158) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit codex-cli 0.150 rejects an ephemeral thread/fork against a paginated (i.e. reasonably large) thread with: thread/fork failed: {"code":-32600,"message":"ephemeral paginated thread/fork requires `excludeTurns: true`"} summarizeConversation() catches this and silently falls back to transcript-text summarization, so the Codex-native path stops being used for exactly the conversations it matters most for: the long ones. The only trace is a 'Codex summarizer unavailable, falling back to transcript text' log line. excludeTurns governs pagination of the fork response, not the fork's context/semantics — the forked thread still carries full session history with the flag set, so summaries after this change remain accurate. Fixes #158. --- dist/summarizer.js | 1 + src/summarizer.ts | 1 + test/summarizer-options.test.ts | 1 + 3 files changed, 3 insertions(+) diff --git a/dist/summarizer.js b/dist/summarizer.js index 430eba4..6071980 100644 --- a/dist/summarizer.js +++ b/dist/summarizer.js @@ -560,6 +560,7 @@ export async function runCodexCommand(command) { const fork = await send('thread/fork', { threadId: command.sessionId, ephemeral: true, + excludeTurns: true, sandbox: 'read-only', approvalPolicy: 'never', ...(command.model ? { model: command.model } : {}), diff --git a/src/summarizer.ts b/src/summarizer.ts index 2fbd158..d7e3cc0 100644 --- a/src/summarizer.ts +++ b/src/summarizer.ts @@ -640,6 +640,7 @@ export async function runCodexCommand(command: CodexSummarizerCommand): Promise< const fork = await send('thread/fork', { threadId: command.sessionId, ephemeral: true, + excludeTurns: true, sandbox: 'read-only', approvalPolicy: 'never', ...(command.model ? { model: command.model } : {}), diff --git a/test/summarizer-options.test.ts b/test/summarizer-options.test.ts index f53ff96..1267b88 100644 --- a/test/summarizer-options.test.ts +++ b/test/summarizer-options.test.ts @@ -143,6 +143,7 @@ describe('runCodexCommand', () => { if (message.method === 'thread/fork') { if (message.params.threadId !== 'session-123') throw new Error('wrong session id'); if (message.params.ephemeral !== true) throw new Error('fork was not ephemeral'); + if (message.params.excludeTurns !== true) throw new Error('fork did not set excludeTurns (required by codex-cli 0.150+ for paginated threads)'); if (message.params.sandbox !== 'read-only') throw new Error('fork was not read-only'); console.log(JSON.stringify({ id: message.id, result: { thread: { id: 'fork-456' } } })); return;