Add expandable command and file-change activity boxes#3173
Conversation
…activity-boxes # Conflicts: # apps/web/src/components/chat/MessagesTimeline.browser.tsx
|
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 |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 19abc64. Configure here.
| stdout ?? | ||
| firstRawStringFromRecord(rawOutput, ["content", "output", "text", "result"]) ?? | ||
| firstRawStringFromRecord(itemResult, ["content", "output", "text", "result"]) ?? | ||
| firstRawStringFromRecord(item, ["aggregatedOutput", "output", "text", "result"]); |
There was a problem hiding this comment.
Whitespace stdout hides output
Medium Severity
In extractCommandResult, a whitespace-only stdout string is treated as real output and short-circuits the fallback chain, so values like aggregatedOutput are never read. The work log then stores that blank stdout, skips entry.output, and the expanded command UI hides all streams because they are not renderable.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 19abc64. Configure here.
ApprovabilityVerdict: Needs human review This PR introduces significant new functionality (expandable command/file-change activity boxes) with ~1145 lines of new components and logic. Additionally, an unresolved review comment identifies a potential bug where whitespace-only stdout could hide command output. Both factors warrant human review. You can customize Macroscope's approvability policy. Learn more. |


Summary
This adds richer expandable activity boxes for command and file-change work-log rows in the chat timeline. Command rows can now show the command, raw command, exit code, duration, stdout/stderr or fallback output, and file-change rows can show changed paths plus inline unified diffs when patch data is available.
The implementation keeps this data in the derived work-log model, extracts command result and patch metadata from provider payloads, and renders the richer details without losing the existing compact row behavior.
What Changed
WorkLogEntry, including stdout, stderr, fallback output, exit code, and duration.MessagesTimelinewith command/raw-command sections, status chips, tail-truncated output, and full-output expansion.MessagesTimelinewith changed-file chips and inline diff rendering through the existing diff rendering utilities.Why
Individual command and diff events are mostly opaque currently. We can somewhat see what the agent is doing, but we don't have a clear picture of what each command actually outputs, or what each file change actually produced.
Usually that's fine, most times we inspect the end result and trust the agent. Sometimes it's good to inspect a little deeper. For commands we can help steer by debugging their output, or just compare the results with manual runs. For diffs we can see better follow along the multiple changes an agent makes, or even inspect changes to git-ignored files (which don't appear on the main diff panel).
Validation
pnpm exec vp checkpassed. It reported 20 existing lint warnings outside this branch's changed files.pnpm exec vp run typecheckpassed across all packages.pnpm exec vp run --filter @t3tools/web test -- src/session-logic.test.ts src/components/chat/MessagesTimeline.logic.test.ts src/components/chat/MessagesTimeline.test.tsxpassed, running the@t3tools/webunit test project with 121 files and 1116 tests.Proof
before:

after:

expanded command output with tail truncation:

expanded inline file-change diffs:

Note
Medium Risk
Touches activity ordering and broad provider payload parsing in
session-logic, which can affect timeline ordering and displayed tool output; UI changes are localized to chat work rows.Overview
Adds expandable detail panels for command and file-change rows in the chat work log, so users can inspect stdout/stderr, exit codes, durations, and inline diffs without leaving the timeline.
Data layer (
session-logic):WorkLogEntrynow carries command result fields (stdout,stderr,output,exitCode,durationMs) andpatch, populated from provider payloads (including Codex-style nested shapes). Incrementaltool.updated→tool.completedstreams merge via prefix-aware concatenation. File-change patches are extracted with bounded depth/size limits and Codex content diffs are normalized to unified patches. Same-timestamp activity ordering no longer breaks ties on event id (preserves arrival order for streamed chunks).UI (
MessagesTimeline): Work rows expand into structured sections—command blocks with tail-truncated output (last 40 lines, full expand), file-change blocks withFileDiffor path chips, and generic fallback for other tools. Expansion is gated by item type so non-command tools (e.g. web search) do not treatstdoutas command output. HelpershasRenderableCommandOutput/getRenderableCommandOutputLinestrim outer blank lines while keeping intentional blank lines inside output.Tests: Coverage for extraction, merging, patch normalization, renderable output helpers, and static markup for expandable command/file-change rows.
Reviewed by Cursor Bugbot for commit 19abc64. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add expandable command and file-change activity boxes to the chat timeline
MessagesTimelinenow show expand/collapse controls with aria labels; expanded rows render structured command or file-change details instead of raw text.WorkLogEntryin session-logic.ts gainsstdout,stderr,output,exitCode,durationMs, andpatchfields, populated by new extraction helpers that normalize heterogeneous provider payload shapes.mergeTextOutput; a tiebreaker fix incompareActivitiesByOrderpreserves arrival order for same-timestamp events instead of scrambling by id.Macroscope summarized 19abc64.