fix(web): show command output in work log#4083
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Needs human review This PR adds new output extraction logic for displaying command results in the work log. While the changes are UI/display focused and well-tested, the author is new to this file and the extraction logic handles multiple payload formats, warranting human verification. You can customize Macroscope's approvability policy. Learn more. |
What Changed
Fixes #4076.
Updated command work-log entries so they display:
The fix supports output from Codex and ACP-based providers such as Claude.
It also preserves the existing Cursor behavior when stdout is available but the original command input is missing.
Added focused regression tests covering:
Why
Command execution entries were sometimes showing the command twice instead of showing the command followed by its output.
This happened because the command text could be stored as both the command and detail, while the real provider output was not being selected for the expanded work-log entry.
The updated logic extracts the actual output only when the original command is available, preventing duplicated command text and avoiding misleading output-only rows.
UI Changes
This changes the content shown when expanding a command work-log entry:
Before
After
There are no visual styling or layout changes.
Testing
vp test apps/web/src/session-logic.command-output.test.ts— 3 tests passedvp test apps/web/src/session-logic.test.ts— 59 tests passedvp check— completed with 0 errorsgit diff --check— passedvp run test— attempted, but unrelatedoxlint-plugin-t3codetests could not spawn the local Windowsoxlintexecutable (ENOENT)Checklist
Note
Low Risk
UI-only presentation logic in
deriveWorkLogEntrieswith focused unit tests; no auth or data-path changes.Overview
Fixes expanded command work-log rows that repeated the command string instead of showing stdout/provider output.
extractToolDetailnow treats command executions specially: it ignoresdetailwhen it matches the extracted command, requires a known command before attaching output, and pulls text via newextractToolOutput(CodexaggregatedOutput, ACPrawOutputstdout/stderr, nested result/content, ACP text blocks viaextractAcpTextContent), with exit-code suffix stripping. When there is no distinct output,detailis omitted so the row is command-only.Adds
session-logic.command-output.test.tswith regression cases for Codex, Claude ACP stdout, and silent commands.Reviewed by Cursor Bugbot for commit c1189de. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Show command output instead of command text in work log entries
extractToolOutputin session-logic.ts to retrieve normalized output from tool/command executions, checkingaggregatedOutput, stdout/stderr, and ACP content arrays in priority order, stripping trailing exit code markers.extractToolDetailto prefer actual command output over echoing the command string, and returnsnullwhen no output is available instead of repeating the command.extractAcpTextContentto collect non-empty text from ACP-style{ type: 'content', content: { type: 'text', text } }entry arrays.Macroscope summarized c1189de.