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 |
ApprovabilityVerdict: Needs human review This PR introduces a significant new feature - expandable activity boxes for command executions and file changes in the chat timeline. It adds multiple new UI components, extends core data interfaces, and includes substantial new logic for command output rendering and diff display. While well-tested, the scope of new user-facing functionality warrants human review. You can customize Macroscope's approvability policy. Learn more. |
- Treat whitespace-only stdout as absent\n- Fall back to aggregated command output
- Keep blank stream chunks for live command updates - Avoid synthetic separators around whitespace chunks
- Preserve incremental chunks without injecting separators - Keep blank-only raw output content during tool updates - Avoid trim allocation when checking command output
This reverts commit de5480b.
This reverts commit c0fe7fa.
This reverts commit d1583db.
- Move supplemental detail helpers into shared logic - Add coverage for command and file change detail expansion
- Guard collab-agent activity before request-kind checks - Cover command and file-change request-kind regressions
- Normalize command output dedupe comparisons - Cover command and patch activity edge cases
…activity-boxes # Conflicts: # apps/web/src/components/chat/MessagesTimeline.tsx
- Move detail derivation into MessagesTimeline.logic - Reuse shared helpers for command, file, and preview display - Keep command output truncation and file chips consistent
- Add a cheap expandable-details predicate for timeline rows - Derive full command details only after a row is expanded
- Show changed-file previews for file-change rows with commands - Ignore nested control key events in expandable work rows
- Reuse the path matcher from the timeline UI - Remove duplicated diff path normalization logic
- Move changed-file diff path matching into diffRendering - Reuse precomputed matchers in timeline diff displays - Cover absolute, nested, basename, and Windows paths
- Add shared anchoring metrics and tests for timeline scroll math - Keep live-follow stable across user navigation and thread changes - Widen chat composer and toolbar containers to the new max width - Bump package versions and lockfile to 0.0.28
- Clear failed optimistic anchor state in both send paths - Guard nullable scroll nodes before scrollend registration - Avoid broad click interception in timeline navigation
- Treat keyboard scroll keys as manual timeline navigation - Detect native scrollbar gutter interaction before live-follow guards
- Move expandable work entry logic into a shared module - Re-export the moved helpers from MessagesTimeline.logic - Keep the timeline component focused on rendering
- Remove duplicate timeline helper re-exports - Stream command-output tail and dedupe calculations - Safely serialize MCP tool data and cover edge cases
- Match absolute changed files against workspace-relative diffs - Cover basename root diffs without hiding nested namesakes
- Keep changed-file-only reads in generic detail panels - Preserve repeated MCP argument objects while redacting cycles
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.MessagesTimeline.logic.tssoMessagesTimeline.tsxnow consumes derived detail objects while preserving upstreamwork-togglerow modeling and anchored-list behavior.upstream/main, reused the exportedchangedFileMatchesDiffPathhelper fromMessagesTimeline.logic.tsinMessagesTimeline.tsxso changed-file chips and inline diffs keep the same basename/path matching behavior without duplicated local matching logic.deriveWorkEntryDisplay()soMessagesTimeline.tsxkeeps rendering row text and ARIA labels from one tested logic helper.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
(cd apps/web && pnpm exec vp test run --passWithNoTests --project unit src/session-logic.test.ts)passed: 1 file, 79 tests.(cd apps/web && pnpm exec vp test run --passWithNoTests --project unit src/components/chat/MessagesTimeline.test.tsx)passed: 1 file, 13 tests.pnpm exec vp run --filter @t3tools/web test -- src/components/chat/MessagesTimeline.test.tsxpassed on the final branch state: 145 files, 1318 tests.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 after the activity-detail review fixes: 140 files, 1240 tests.pnpm exec vp run --filter @t3tools/web test -- src/session-logic.test.ts src/components/chat/MessagesTimeline.logic.test.tspassed after the final activity-detail review fixes: 140 files, 1242 tests.(cd apps/web && pnpm exec vp test run --passWithNoTests --project unit src/components/chat/MessagesTimeline.test.tsx src/components/chat/MessagesTimeline.logic.test.ts src/session-logic.test.ts)passed after the post-merge derivation refactor: 3 files, 150 tests.(cd apps/web && pnpm exec vp test run --passWithNoTests --project unit src/components/chat/MessagesTimeline.logic.test.ts src/components/chat/MessagesTimeline.test.tsx)passed after the latest activity-detail review fixes: 2 files, 64 tests.pnpm exec vp test -- apps/web/src/components/chat/MessagesTimeline.logic.test.ts apps/web/src/components/chat/MessagesTimeline.test.tsxpassed after the upstream-merge display derivation cleanup: 2 files, 66 tests.git diff --checkpassed.pnpm exec vp checkpassed with 20 existing warnings outside this branch's changed files.pnpm exec vp run typecheckpassed across all packages.git diff --checkpassed again during the 2026-06-30 PR comment refresh.pnpm exec vp checkpassed again during the 2026-06-30 PR comment refresh with the same 20 existing warnings.pnpm exec vp run typecheckpassed again during the 2026-06-30 PR comment refresh across all packages.pnpm exec vp test -- apps/web/src/components/chat/MessagesTimeline.logic.test.tspassed after the 2026-07-03 Macroscope review fixes: 1 file, 56 tests.git diff --checkpassed after the 2026-07-03 Macroscope review fixes.pnpm exec vp checkpassed after the 2026-07-03 Macroscope review fixes with 27 existing warnings outside the changed files.pnpm exec vp run typecheckpassed after the 2026-07-03 Macroscope review fixes across all packages.Proof
before:

after:

expanded command output with tail truncation:

expanded inline file-change diffs:

Note
Medium Risk
Touches work-log derivation and streaming output merge logic used across providers; regressions could scramble command output or mis-classify expandable rows, but changes are heavily tested and UI-scoped to timeline work entries.
Overview
Adds expandable activity detail panels for command and file-change work-log rows in the chat timeline, replacing the previous single generic
<pre>expansion.Data layer:
WorkLogEntrynow carriesstdout,stderr,output,exitCode,durationMs, andpatch.session-logicextracts command results from provider payloads (including Codex/Cursor shapes), merges incrementaltool.updatedoutput without regressing to shorter snapshots, extracts and normalizes file-change patches (including Codex add/delete content diffs), and tightens same-timestamp activity ordering for streamed updates.Presentation: New
workLogEntryDetailsmodule centralizes expandability rules, command/file/generic detail derivation, output tail truncation, changed-file chips vs inline diff deduplication, and MCP JSON display with redaction.MessagesTimelinerenders structured sections (command metadata, truncatable stdout/stderr, inlineFileDiffor raw patch) and usesderiveWorkEntryDisplay/ keyboard toggle helpers from timeline logic.diffRenderingadds path matchers so changed files align with diff paths across absolute/relative and Windows paths.Tests: Large additions cover output merging, patch extraction, detail derivation, and static timeline markup for expandable rows.
Reviewed by Cursor Bugbot for commit c2e921d. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add expandable command and file-change activity boxes to the session work log
stdout/stderr), exit codes, durations, and unified patch text from tool activity payloads in session-logic.ts.tool.updated/tool.completedevents now prefers longer cumulative snapshots and avoids regressions to shorter ones.Macroscope summarized c2e921d.