History

Fix raw command output handling for PR #4083

Julius Marminge committed 3 months ago

Commit bf58a961 parent 86dc15c2 files · +12 −5Browse files

Unified · Split

2 files
  1. apps/web/src/session-logic.command-output.test.ts +5 −3
  2. apps/web/src/session-logic.ts +7 −2
apps/web/src/session-logic.command-output.test.ts+5−3
@@ -24,11 +24,12 @@ describe("deriveWorkLogEntries command output", () => { · 23 unmodified lines
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", () => { · 2 unmodified lines
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+7−2
@@ -1234,13 +1234,18 @@ function extractToolDetail( · 1233 unmodified lines
12341234 const normalizedHeading = normalizePreviewForComparison(heading);
12351235 const normalizedDetail = normalizePreviewForComparison(detail);
12361236 const commandTool = isCommandToolDetail(payload, heading);
1237− const command = commandTool ? extractToolCommand(payload).command : null;
1237+ const commandPreview = commandTool
1238+ ? extractToolCommand(payload)
1239+ : { command: null, rawCommand: null };
1240+ const command = commandPreview.command;
12381241 const normalizedCommand = normalizePreviewForComparison(command);
1242+ const normalizedRawCommand = normalizePreviewForComparison(commandPreview.rawCommand);
12391243
12401244 if (
12411245 detail &&
12421246 normalizedHeading !== normalizedDetail &&
1243− (!commandTool || normalizedCommand !== normalizedDetail)
1247+ (!commandTool ||
1248+ (normalizedCommand !== normalizedDetail && normalizedRawCommand !== normalizedDetail))
12441249 ) {
12451250 return detail;
12461251 }