Skip to content

Add expandable command and file-change activity boxes#3173

Open
Quicksaver wants to merge 52 commits into
pingdotgg:mainfrom
Quicksaver:split/file-command-activity-boxes
Open

Add expandable command and file-change activity boxes#3173
Quicksaver wants to merge 52 commits into
pingdotgg:mainfrom
Quicksaver:split/file-command-activity-boxes

Conversation

@Quicksaver

@Quicksaver Quicksaver commented Jun 19, 2026

Copy link
Copy Markdown

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

  • Preserved command output metadata in WorkLogEntry, including stdout, stderr, fallback output, exit code, and duration.
  • Added bounded file-change patch extraction from provider payloads, including Codex-style nested file-change records and simple content diffs normalized into unified patches.
  • Kept stable arrival order for unsequenced same-timestamp activity events so streamed output chunks are not scrambled by random event ids.
  • Added expandable command details in MessagesTimeline with command/raw-command sections, status chips, tail-truncated output, and full-output expansion.
  • Added expandable file-change details in MessagesTimeline with changed-file chips and inline diff rendering through the existing diff rendering utilities.
  • Kept generic tool expansion behavior for rows that are neither command nor file-change details, while excluding collab-agent rows so their nested activity UI remains authoritative.
  • Hardened command-output extraction so blank completed stdout falls back to aggregated output while live incremental whitespace chunks are still preserved exactly.
  • Hardened command-output merging so shorter completed snapshots and shorter line-complete updated snapshots do not corrupt already merged command output, while prefix-like incremental chunks still append exactly.
  • Refined shorter-prefix command-output merging so single-line repeated-prefix snapshots do not duplicate output, while ambiguous multiline prefix chunks still preserve incremental stream data.
  • Addressed follow-up review findings by restoring deterministic same-timestamp ordering outside matching streamed tool updates, preserving merged file-change patches, synthesizing deleted-file patches, keeping MCP JSON expansion, and showing changed files missing from parsed inline diffs.
  • Addressed final activity-detail review findings by preventing basename-only changed files from matching unrelated inline diff suffixes and preserving deterministic ordering for same-timestamp unkeyed tool updates.
  • Addressed latest activity-detail review findings by showing changed-file previews for file-change rows that also carry command metadata, and by preserving nested keyboard controls inside expandable work rows.
  • Refactored command/file activity detail derivation into MessagesTimeline.logic.ts so MessagesTimeline.tsx now consumes derived detail objects while preserving upstream work-toggle row modeling and anchored-list behavior.
  • After merging upstream/main, reused the exported changedFileMatchesDiffPath helper from MessagesTimeline.logic.ts in MessagesTimeline.tsx so changed-file chips and inline diffs keep the same basename/path matching behavior without duplicated local matching logic.
  • After the upstream timeline minimap merge, moved compact activity-row heading/preview/display-text derivation into deriveWorkEntryDisplay() so MessagesTimeline.tsx keeps rendering row text and ARIA labels from one tested logic helper.
  • Added shared timeline anchoring metrics and tests so live-follow, manual navigation, and thread changes preserve predictable scroll behavior.
  • Fixed timeline anchor/minimap edge cases by clearing failed optimistic anchors, guarding nullable scroll nodes, and avoiding broad click interception in timeline navigation.
  • Cancel live-follow on keyboard scroll keys and native scrollbar gutter interactions while preserving editable-field keyboard behavior.
  • Addressed latest Macroscope review findings by keeping changed-file-only file-read rows in generic detail panels and preserving repeated MCP argument objects while still redacting true circular references.
  • Added focused coverage for command output extraction, output merging, file-change patch extraction, renderable command output helpers, and timeline rendering of command/file-change rows.

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.tsx passed 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.tsx passed 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.ts passed 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.tsx passed after the upstream-merge display derivation cleanup: 2 files, 66 tests.
  • git diff --check passed.
  • pnpm exec vp check passed with 20 existing warnings outside this branch's changed files.
  • pnpm exec vp run typecheck passed across all packages.
  • git diff --check passed again during the 2026-06-30 PR comment refresh.
  • pnpm exec vp check passed again during the 2026-06-30 PR comment refresh with the same 20 existing warnings.
  • pnpm exec vp run typecheck passed again during the 2026-06-30 PR comment refresh across all packages.
  • pnpm exec vp test -- apps/web/src/components/chat/MessagesTimeline.logic.test.ts passed after the 2026-07-03 Macroscope review fixes: 1 file, 56 tests.
  • git diff --check passed after the 2026-07-03 Macroscope review fixes.
  • pnpm exec vp check passed after the 2026-07-03 Macroscope review fixes with 27 existing warnings outside the changed files.
  • pnpm exec vp run typecheck passed after the 2026-07-03 Macroscope review fixes across all packages.

Proof

before:
before

after:
after

expanded command output with tail truncation:
Screenshot 2026-06-09 at 09 32 11

expanded inline file-change diffs:
Screenshot 2026-06-09 at 09 34 06


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: WorkLogEntry now carries stdout, stderr, output, exitCode, durationMs, and patch. session-logic extracts command results from provider payloads (including Codex/Cursor shapes), merges incremental tool.updated output 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 workLogEntryDetails module centralizes expandability rules, command/file/generic detail derivation, output tail truncation, changed-file chips vs inline diff deduplication, and MCP JSON display with redaction. MessagesTimeline renders structured sections (command metadata, truncatable stdout/stderr, inline FileDiff or raw patch) and uses deriveWorkEntryDisplay / keyboard toggle helpers from timeline logic. diffRendering adds 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

  • Work log entries now extract and surface command output streams (stdout/stderr), exit codes, durations, and unified patch text from tool activity payloads in session-logic.ts.
  • Expanded rows in MessagesTimeline.tsx render structured detail sections: command details with output tail/expand controls, file-change details with inline diffs or raw patches, and a generic fallback for other tools.
  • New utilities in workLogEntryDetails.ts derive display state (truncation, headings, previews, file chips) and handle sensitive-field redaction for MCP tool data serialization.
  • Path matching between changed-file entries and diff paths is handled by new helpers in diffRendering.ts with cross-platform normalization.
  • Output merging across incremental tool.updated/tool.completed events now prefers longer cumulative snapshots and avoids regressions to shorter ones.

Macroscope summarized c2e921d.

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ef5fed9f-024c-43fb-8940-eca0e83475a5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XL 500-999 changed lines (additions + deletions). labels Jun 19, 2026
Comment thread apps/web/src/session-logic.ts Outdated
@macroscopeapp

macroscopeapp Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: 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
Comment thread apps/web/src/session-logic.ts Outdated
Comment thread apps/web/src/session-logic.ts Outdated
Comment thread apps/web/src/session-logic.ts
Comment thread apps/web/src/session-logic.ts Outdated
Comment thread apps/web/src/session-logic.ts
Comment thread apps/web/src/components/chat/MessagesTimeline.tsx Outdated
Comment thread apps/web/src/session-logic.ts Outdated
- 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
Comment thread apps/web/src/components/chat/MessagesTimeline.logic.ts Outdated
Comment thread apps/web/src/session-logic.ts Outdated
…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
@github-actions github-actions Bot added size:XXL 1,000+ changed lines (additions + deletions). and removed size:XL 500-999 changed lines (additions + deletions). labels Jun 27, 2026
Comment thread apps/web/src/components/chat/MessagesTimeline.logic.ts
Comment thread apps/web/src/components/chat/MessagesTimeline.tsx Outdated
- 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
Comment thread apps/web/src/lib/workLogEntryDetails.ts
Comment thread apps/web/src/lib/workLogEntryDetails.ts Outdated
- Keep changed-file-only reads in generic detail panels

- Preserve repeated MCP argument objects while redacting cycles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL 1,000+ changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant