Skip to content

Commit f607ebc

Browse files
juliusmarmingecodex
andcommitted
Fix raw command output handling for PR #4083
Co-authored-by: codex <[email protected]>
1 parent bef7c6e commit f607ebc

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

‎apps/web/src/session-logic.command-output.test.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ describe("deriveWorkLogEntries command output", () => {
2424
makeCommandActivity("codex-command", {
2525
itemType: "command_execution",
2626
title: "Ran command",
27-
detail: "printf hello",
27+
detail: "/bin/zsh -lc \"printf 'hello\\n'\"",
2828
data: {
2929
item: {
3030
type: "commandExecution",
31-
command: "printf hello",
31+
command: "/bin/zsh -lc \"printf 'hello\\n'\"",
32+
commandActions: [{ command: "printf 'hello\\n'", type: "unknown" }],
3233
aggregatedOutput: "hello\n<exited with exit code 0>",
3334
status: "completed",
3435
},
@@ -37,7 +38,8 @@ describe("deriveWorkLogEntries command output", () => {
3738
]);
3839

3940
expect(entry).toMatchObject({
40-
command: "printf hello",
41+
command: "printf 'hello\\n'",
42+
rawCommand: "/bin/zsh -lc \"printf 'hello\\n'\"",
4143
detail: "hello",
4244
});
4345
});

‎apps/web/src/session-logic.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,13 +1467,18 @@ function extractToolDetail(
14671467
const normalizedHeading = normalizePreviewForComparison(heading);
14681468
const normalizedDetail = normalizePreviewForComparison(detail);
14691469
const commandTool = isCommandToolDetail(payload, heading);
1470-
const command = commandTool ? extractToolCommand(payload).command : null;
1470+
const commandPreview = commandTool
1471+
? extractToolCommand(payload)
1472+
: { command: null, rawCommand: null };
1473+
const command = commandPreview.command;
14711474
const normalizedCommand = normalizePreviewForComparison(command);
1475+
const normalizedRawCommand = normalizePreviewForComparison(commandPreview.rawCommand);
14721476

14731477
if (
14741478
detail &&
14751479
normalizedHeading !== normalizedDetail &&
1476-
(!commandTool || normalizedCommand !== normalizedDetail)
1480+
(!commandTool ||
1481+
(normalizedCommand !== normalizedDetail && normalizedRawCommand !== normalizedDetail))
14771482
) {
14781483
return detail;
14791484
}

0 commit comments

Comments
 (0)