From bf58a964cd6d63495cbbe79803dd98464447dc4a Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Mon, 20 Jul 2026 16:59:43 +0200 Subject: [PATCH] Fix raw command output handling for PR #4083 Co-authored-by: codex --- apps/web/src/session-logic.command-output.test.ts | 8 +++++--- apps/web/src/session-logic.ts | 9 +++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/apps/web/src/session-logic.command-output.test.ts b/apps/web/src/session-logic.command-output.test.ts index ed237557bd..4d138dea20 100644 --- a/apps/web/src/session-logic.command-output.test.ts +++ b/apps/web/src/session-logic.command-output.test.ts @@ -24,11 +24,12 @@ describe("deriveWorkLogEntries command output", () => { makeCommandActivity("codex-command", { itemType: "command_execution", title: "Ran command", - detail: "printf hello", + detail: "/bin/zsh -lc \"printf 'hello\\n'\"", data: { item: { type: "commandExecution", - command: "printf hello", + command: "/bin/zsh -lc \"printf 'hello\\n'\"", + commandActions: [{ command: "printf 'hello\\n'", type: "unknown" }], aggregatedOutput: "hello\n", status: "completed", }, @@ -37,7 +38,8 @@ describe("deriveWorkLogEntries command output", () => { ]); expect(entry).toMatchObject({ - command: "printf hello", + command: "printf 'hello\\n'", + rawCommand: "/bin/zsh -lc \"printf 'hello\\n'\"", detail: "hello", }); }); diff --git a/apps/web/src/session-logic.ts b/apps/web/src/session-logic.ts index d2773e1aa2..802fcc2b25 100644 --- a/apps/web/src/session-logic.ts +++ b/apps/web/src/session-logic.ts @@ -1234,13 +1234,18 @@ function extractToolDetail( const normalizedHeading = normalizePreviewForComparison(heading); const normalizedDetail = normalizePreviewForComparison(detail); const commandTool = isCommandToolDetail(payload, heading); - const command = commandTool ? extractToolCommand(payload).command : null; + const commandPreview = commandTool + ? extractToolCommand(payload) + : { command: null, rawCommand: null }; + const command = commandPreview.command; const normalizedCommand = normalizePreviewForComparison(command); + const normalizedRawCommand = normalizePreviewForComparison(commandPreview.rawCommand); if ( detail && normalizedHeading !== normalizedDetail && - (!commandTool || normalizedCommand !== normalizedDetail) + (!commandTool || + (normalizedCommand !== normalizedDetail && normalizedRawCommand !== normalizedDetail)) ) { return detail; }