feat: add ability to see live output of commands#1665
feat: add ability to see live output of commands#1665sethigeet wants to merge 7 commits intopingdotgg:mainfrom
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 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. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
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], |
There was a problem hiding this comment.
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.


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
UI Changes
A "Show Output" button is added for the commands:
Checklist
Note
Medium Risk
Adds a new WebSocket stream carrying provider runtime
command_outputdeltas and threads it through client state and work-log collapsing logic; correctness depends on stableitemIdcorrelation 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
subscribeProviderRuntimeToolOutputEventsthat forwards providercontent.deltaevents wherestreamKindiscommand_output.On the client, introduces
runtimeToolOutputStore(per-thread/per-itemIdbuffer with a 24k char cap) and wires it into the root websocket event loop, clearing output onthread.deletedandthread.turn-start-requested.deriveWorkLogEntriesis extended to keep relevanttool.startedrows, correlate tool lifecycle rows usingitemId/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
itemIdanddatafor started/updated/completed events while ensuringcommand_outputdeltas 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
subscribeProviderRuntimeToolOutputEvents) that emitscontent.deltaevents withstreamKind: 'command_output'from the server.deriveWorkLogEntriesin session-logic.ts to includetool.startedentries for command/file-change tools and merge live output into work log entries via itemId correlation.collapseDerivedWorkLogEntriesto handle multiple concurrent commands usinggroupKeyanditemId, reducing duplicate rows in the work log.Macroscope summarized ae5d9cd.