Collapse work details during final answer streaming#3152
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 |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a50270e. Configure here.
| turnId: event.payload.turnId, | ||
| role: event.payload.role, | ||
| text: nextText, | ||
| ...(event.payload.phase !== undefined ? { phase: event.payload.phase } : {}), |
There was a problem hiding this comment.
Phase not persisted in projection
Medium Severity
The PR writes phase on thread.message-sent projection upserts, but the projection message schema, SQL row mapping, and snapshot hydration never define or read phase. After a reload or snapshot-based thread fetch, assistant messages lose final_answer, so deriveFinalAnswerStartedTurnIds cannot early-collapse work during streaming.
Reviewed by Cursor Bugbot for commit a50270e. Configure here.
ApprovabilityVerdict: Needs human review This PR introduces new user-facing behavior (collapsing work details during final answer streaming) across multiple system layers. An unresolved review comment identifies a medium-severity bug where the phase field isn't persisted, causing the feature to break after thread reload. You can customize Macroscope's approvability policy. Learn more. |


What Changed
Why
When an agent is working, the timeline shows tool calls and progress updates. Once the final answer starts, those details should move out of the way immediately so the answer is easier to read.
The old behavior was based on the final message being finished. That was too late, and if the user was actively trying to read the message, it would be jarring as everything shifted upward.
UI Changes
This changes when the work-session section collapses during a streaming response.
Before: the work session stays open until the final answer finishes.
After: the work session collapses when the final answer starts streaming, like Codex desktop.
before_after.mov
Checklist
Note
Medium Risk
Touches orchestration events, provider ingestion, and timeline folding logic; changes are additive (optional phase) but affect live streaming UX and message projection.
Overview
Adds an optional assistant message
phase(commentary|final_answer) end-to-end so the chat timeline can tell commentary from the final answer.Codex maps lifecycle item
phaseinto runtimemessagePhase; provider runtime ingestion caches phase per runtime item and message and attaches it to assistant delta commands. Orchestration (decider, projector, SQL projection) and the web store persist and mergephaseon streaming updates.UI:
MessagesTimelinefolds the active turn’s “worked for…” section as soon as any assistant message in that turn hasphase === "final_answer", including while it is still streaming—instead of waiting for the turn to settle or streaming to finish.Reviewed by Cursor Bugbot for commit a50270e. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Collapse work details during final answer streaming by propagating message phase end-to-end
phasefield ('commentary' | 'final_answer') on messages across contracts, server orchestration, and client state, sourced from provider item lifecycle events in CodexAdapter.ts.thread.message.assistant.deltacommands, which flow through the decider and projector into persisted thread state.deriveFinalAnswerStartedTurnIdsand updatesderiveTurnFoldsto fold commentary/tool activity turns as soon as afinal_answer-phase message starts streaming, without waiting for the turn to settle.Macroscope summarized a50270e.