From 860dbdab5605b2c453a4ae6b3e1f0a818cba1365 Mon Sep 17 00:00:00 2001 From: catlog22 Date: Thu, 29 Jan 2026 16:59:00 +0800 Subject: [PATCH] fix: Unify execution IDs between broadcast events and session storage - Pass generated executionId to cliExecutorTool.execute as id parameter - Ensures CLI_EXECUTION_STARTED broadcast uses same ID as saved session - Fixes "Conversation not found" errors when querying by broadcast ID - Add DEBUG logging for executionId tracking This resolves the mismatch where: - Broadcast event used ID from Date.now() at broadcast time - Session saved used different ID from Date.now() at completion time - Now all use the same ID generated at cli.ts:868 Changes: - cli.ts:868 - executionId generated once - cli.ts:1001 - pass executionId to execute() as id parameter - cli-executor-core.ts automatically uses passed id as conversationId --- ccw/src/commands/cli.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ccw/src/commands/cli.ts b/ccw/src/commands/cli.ts index ee0c551c..0b70309e 100644 --- a/ccw/src/commands/cli.ts +++ b/ccw/src/commands/cli.ts @@ -929,6 +929,10 @@ async function execAction(positionalPrompt: string | undefined, options: CliExec mode }); + if (process.env.DEBUG) { + console.error(`[CLI] Generated executionId: ${executionId}`); + } + // Buffer to accumulate output when both --stream and --to-file are specified let streamBuffer = ''; @@ -994,7 +998,7 @@ async function execAction(positionalPrompt: string | undefined, options: CliExec includeDirs, // timeout removed - controlled by external caller (bash timeout) resume, - id, // custom execution ID + id: executionId, // unified execution ID (matches broadcast events) noNative, stream: !!stream, // stream=true → streaming enabled (no cache), stream=false → cache output (default) outputFormat, // Enable JSONL parsing for tools that support it