Skip to content

feat: add ability to see live output of commands#1665

Open
sethigeet wants to merge 7 commits intopingdotgg:mainfrom
sethigeet:feat/cmd-outputs
Open

feat: add ability to see live output of commands#1665
sethigeet wants to merge 7 commits intopingdotgg:mainfrom
sethigeet:feat/cmd-outputs

Conversation

@sethigeet
Copy link
Copy Markdown

@sethigeet sethigeet commented Apr 1, 2026

I know this is not exactly a small PR, but its not really that huge and most of the stuff is boilerplate + tests and there aren't a lot of complicated changes.

What Changed

The tool calls are shown in the UI when they start (this is especially useful for seeing that the model ran a command like running tests or benchmarks which can take significant time and the user is not stuck seeing "working...") and the output of the terminal commands are streamed into the UI (just kept in memory for the current session, not persisted, just like the Codex App) so that the user can see what's happening

Why

  • It's useful to see what the model is running as soon as it starts running it (rather than after it completes running it) so that we can stop it if its doing something wrong (for example, it might not be using something from our build system by default due to it not being mentioned in the Agents.md (or equivalent) and we can stop the model and ask it to change).
  • Its also useful to see the outputs of the commands that the agent has run due to obvious reasons!

UI Changes

A "Show Output" button is added for the commands:

image image

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Medium Risk
Adds a new WebSocket stream carrying provider runtime command_output deltas and threads it through client state and work-log collapsing logic; correctness depends on stable itemId correlation and lifecycle grouping, and mistakes could cause confusing/incorrect work-log rendering or memory growth.

Overview
Adds live, ephemeral command output streaming from server to web UI via a new WS RPC subscription subscribeProviderRuntimeToolOutputEvents that forwards provider content.delta events where streamKind is command_output.

On the client, introduces runtimeToolOutputStore (per-thread/per-itemId buffer with a 24k char cap) and wires it into the root websocket event loop, clearing output on thread.deleted and thread.turn-start-requested. deriveWorkLogEntries is extended to keep relevant tool.started rows, correlate tool lifecycle rows using itemId/group keys, and inject buffered output into the matching work-log entry.

Updates the timeline UI to show a “Show output/Hide output” toggle (collapsed by default) for tool work entries with output, and expands server ingestion tool activities to include itemId and data for started/updated/completed events while ensuring command_output deltas are not persisted as activities (new tests cover these behaviors).

Written by Cursor Bugbot for commit ae5d9cd. This will update automatically on new commits. Configure here.

Note

Add live command output streaming to the chat work log

  • Adds a new WebSocket stream (subscribeProviderRuntimeToolOutputEvents) that emits content.delta events with streamKind: 'command_output' from the server.
  • Introduces a Zustand store (runtimeToolOutputStore.ts) that buffers command output per thread and itemId, capped at 24,000 characters, and clears on turn start or thread deletion.
  • Extends deriveWorkLogEntries in session-logic.ts to include tool.started entries for command/file-change tools and merge live output into work log entries via itemId correlation.
  • Adds a collapsible 'Show output'/'Hide output' toggle to tool work entries in MessagesTimeline.tsx; output is collapsed by default.
  • Reworks collapseDerivedWorkLogEntries to handle multiple concurrent commands using groupKey and itemId, reducing duplicate rows in the work log.

Macroscope summarized ae5d9cd.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 1, 2026

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: cfc6840b-88f7-42ef-b3c4-b113e8aaeeff

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 and usage tips.

@github-actions github-actions bot added size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Apr 1, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp bot commented Apr 1, 2026

Approvability

Verdict: Needs human review

This PR introduces a significant new feature for streaming live command output to the UI, including new state management, WebSocket subscriptions, and substantial logic changes. Additionally, an open review comment identifies a performance issue with excessive recomputation during streaming.

You can customize Macroscope's approvability policy. Learn more.

Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

activeLatestTurn?.turnId ?? undefined,
runtimeToolOutputByItemId,
),
[activeLatestTurn?.turnId, runtimeToolOutputByItemId, threadActivities],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excessive recomputation of work log on every streaming delta

Medium Severity

The runtimeToolOutputByItemIdRaw Zustand selector returns a new object reference on every appendOutput call (due to immutable spreads in the store). This causes runtimeToolOutputByItemId to create a new Map on every delta, which in turn forces deriveWorkLogEntries to fully recompute — sorting, filtering, and collapsing all activities — on every streaming output chunk. During active command execution with frequent output, this can cause significant unnecessary work.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 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