Fix raw command output handling for PR #4083

Co-authored-by: codex <[email protected]>
This commit is contained in:
Julius Marmingeandcodex committed 2026-07-20 16:59:43 +02:00
1 parent 86dc15c3d5
commit bf58a964cd
2 files changed
+12 -5

No files matched your search

@@ -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<exited with exit code 0>",
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",
});
});
+7 -2
View File
@@ -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;
}