Repository navigation
feat(web): a running turn grows one summary row above the status line - #521
Conversation
A running turn used to read as the status line alone, so after ten minutes nothing showed it had been busy. The newest held reply now stays in the entries without a row of its own; it splits the turn, so the steps before it close into one summary row whose counts climb with each update, and the steps since it fold into the status line, which still carries the only reply text. The status line also stops stuttering: each new label stays up at least 1.5s (a streaming thought grows through on its first deadline, and a new thread shows its own label at once), a tool that ends between beats hands the line back to the latest reply instead of the thinking word, and the shimmer is phased to the clock so swapping the line's element never starts a second sweep right after one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NoahHendrickson
left a comment
There was a problem hiding this comment.
Code-quality review of f9139af (base 75e66ed). Not approving. The behavior looks right, but the summary row depends on an invisible entry inside upstream's busiest function, and the status line now has two clocks with overlapping rules.
1. The summary row comes from a ghost entry (structural, top priority)
The newest live reply now stays in timelineEntries but draws no row. That makes it a hidden separator that bends the generic work grouper (the nextEntry.kind !== "work" break) and the active-tool tail scan. The entry is still visible to every other derivation that reads those entries: deriveTerminalAssistantMessageIds, failedTimelineRunIds, deriveActiveVisualResponseRunIds, deriveTimelineTurnFolds (which calls timelineRowEntries again), timelineEntryById, attachCreatedThreadSummaries. None of them were written to expect an entry that never becomes a row, and nothing pins how they treat one.
Two smells show the design is borrowed rather than modeled:
- The PR body's "open from review" list has a lone tool row that later turns into the summary row, and a tool still running across an update that gets its own row. Neither is a separate edge case. Both happen because "summary row" here just means "whatever the generic grouper makes of the entries before the ghost", so its shape depends on group size and lifecycle status.
- The rule is split across two functions.
timelineRowEntriesholds everything except the last reply (.slice(0, -1)).deriveMessagesTimelineRowsworks out the last reply again (forkLiveReplyIds(input).at(-1)) and skips it with acontinueplaced in the middle of a roughly 700-line upstream loop (L2387). The two calls have to agree.forkLiveReplyIds(withderiveInFlightSteerAnswerIds+retainedAssistantReplyEntryIds, both O(n)) now runs three times per derive while a turn streams.
Code-judo: model the split once and explicitly. Compute the newest live reply's index a single time. Keep holding every reply as before, so no ghost reaches any consumer. In one fenced fork helper, build the summary as one work row from the run's closed steps before that index; steps after it fall into the status line as they do today. Both open quirks go away, since the summary is a summary row by construction and not by group size. The in-loop continue and the second forkLiveReplyIds call go away too. Upstream's loop keeps one less fork hook, which also lowers sync cost. If you keep the ghost, at least return { entries, unshownReplyId } from timelineRowEntries so it is derived in one place, and drop the row in one post-pass next to the other fork post-passes, not mid-loop.
2. Two clocks for one line (ForkLiveStatusLine.tsx)
useDwelledLabel adds a second state machine on top of the rotation. It has its own arrival counter, its own timer, and its own "a growing thought is the same arrival" rule (label.startsWith(shown.label)), which copies grew in forkStatusLineReconcile. It also needs the caller to pass the rotation's internals in (voices.pinned === null && rotation.voice === "thought"). Because of that, the two machines can disagree about what is showing: the beat restarts on an arrival the dwell is still hiding. The dwell rules (growth passes through, a new arrival waits out the dwell, a thread switch shows at once) are also the only rotation logic without a test. The rest is pure and covered in forkWorkingRowLast.test.ts.
Code-judo: make the dwell part of the pure rotation state. Add a pending arrival that forkStatusLineReconcile queues when an arrival comes in under DWELL_MS after the last one. useStatusLineState's single timer takes the pending arrival at the deadline. The thought parameter, the duplicated growth rule and the second effect all go away, and the dwell becomes table-testable next to its sibling rules.
3. The thread parameter covers for missing identity
"The list reuses this line across threads" is handled by threading ctx.routeThreadKey into the dwell hook and adding branches for it. The rotation state (lap, arrival, voice) carries across threads in the same way. Keying the line by thread at its render site (key={ctx.routeThreadKey}) resets both hooks and removes every thread branch.
4. Shimmer phase copies a CSS constant
SHIMMER_CYCLE_MS = 2200 has to match the CSS animation duration, and nothing enforces that. If upstream retunes the shimmer, this silently goes out of phase. The underlying cause is that the shimmer span remounts when its parent changes from div to button. Either keep the shimmer span out of the swapped element, or read the period from the element (getComputedStyle(el).animationDuration) and drop the copied constant.
5. Stale contract
forkLiveReplyIds still lists "forkShowLatestHeldReply" in its Pick (L1533), but its body no longer reads it. Remove it so the signature matches what the function uses.
The forkStatusLineReconcile change, which hands a settled tool back to the thought, is small and tested, and reads fine.
🤖 Reviewed by Claude Opus 5.5 (claude-opus-5-5) via Claude Code
| } | ||
|
|
||
| /* fork:begin fork-quiet-live-turn — see .fork/customizations.yaml#fork-quiet-live-turn */ | ||
| if (timelineEntry.id === forkUnshownReplyId) continue; |
There was a problem hiding this comment.
This adds a fork continue in the middle of upstream's main row loop, so that an entry every earlier derivation already counted never becomes a row. Can we hold this reply like the others and build the summary row explicitly in one fenced helper, so no ghost entry exists at all? See review point 1.
There was a problem hiding this comment.
I'm keeping this one as is. The unshown reply exists only while the run is unsettled. During that time the run is in activeVisualResponseRunIds (so no turn fold applies), it has no row (so terminal-message meta isn't drawn), and when the turn ends the hold lifts and it renders as before. A hand-built summary row would duplicate upstream's grouping for the summary, which means work-toggle ids, forkTrailSummary, expansion and continuation, and that's more fork surface than this three-line fenced skip. The lone-tool-row quirk is listed in the PR body as a known once-per-turn shape. I also moved the newest-reply derivation to one place (see the reply on L1724).
| const timelineEntries = timelineRowEntries(input); | ||
| /* fork:begin fork-quiet-live-turn — see .fork/customizations.yaml#fork-quiet-live-turn | ||
| While the turn waits on the user, the newest reply shows, since it explains the request. */ | ||
| const forkUnshownReplyId = |
There was a problem hiding this comment.
This is the second derivation of the same newest reply: timelineRowEntries already ran forkLiveReplyIds to .slice(0, -1) it. Please derive it once, for example by returning it from timelineRowEntries, so the two calls can't drift apart and we don't pay the O(n) scans again on every streaming update.
There was a problem hiding this comment.
Fixed in 0e66203, same change as the nit above: one forkLiveReplyIds call per row derive, passed to timelineRowEntries.
| @@ -1532,13 +1532,13 @@ function forkHeldLiveReplyIds( | |||
| | "revealedMessageId" | |||
| | "forkShowLatestHeldReply" | |||
There was a problem hiding this comment.
forkShowLatestHeldReply isn't read here any more. Please drop it from the Pick.
There was a problem hiding this comment.
Fixed in 0e66203. I dropped forkShowLatestHeldReply from both forkLiveReplyIds's and timelineRowEntries's Pick, since neither reads it any more.
| * A streaming thought only grows, so it passes through on its first deadline. The list reuses | ||
| * this line across threads, so a new thread shows its own label at once. | ||
| */ | ||
| function useDwelledLabel(label: string, thought: boolean, thread: string): string { |
There was a problem hiding this comment.
This is a second state machine on top of the rotation: its own arrival counter and timer, a copy of reconcile's growth rule, and it needs rotation internals passed in as thought. Can we move the dwell into forkStatusLineReconcile as a queued pending arrival, driven by the existing timer and tested beside the other rotation rules? A key={routeThreadKey} at the render site would then remove the thread parameter too.
There was a problem hiding this comment.
Partly done in 0e66203. The dwell rules (start, reconcile with growth, end) are now pure functions in forkWorkingRowLast.ts, table-tested beside the rotation's (holds each label for its dwell, letting only a growing thought through). The hook only runs the timer. The thread parameter is gone: WorkingTimelineRow keys the line by routeThreadKey, which resets the rotation too. I kept the dwell on the rendered label and didn't move it into forkStatusLineReconcile. It has to keep showing the text that took the line after the voice behind it changes, for example a tool that settled 30ms after taking the line. Doing that inside the rotation means storing label snapshots in the rotation state. The overlap you describe can only shorten a beat to at least 2.5s visible, never hide a voice.
| const BEAT_MS = 4000; | ||
| const DWELL_MS = 1500; | ||
| /** The shimmer's cycle; theme.custom.css keeps upstream's 2.2s. */ | ||
| const SHIMMER_CYCLE_MS = 2200; |
There was a problem hiding this comment.
This copies the CSS animation duration, and nothing ties the two together. Either avoid the div/button remount of the shimmer span, or read animationDuration from the element.
There was a problem hiding this comment.
Fixed in 0e66203. shimmerLineRef reads animationDuration from the .live-activity-focus span at mount, so nothing copies the CSS duration. Under reduced motion the duration is 0, so no phase is set.
NoahHendrickson
left a comment
There was a problem hiding this comment.
Code review of f9139af7d440301a1141b442749c4299cdcb5085
I found one behavior regression and one nit. The touched suites pass at this commit: forkWorkingRowLast.test.ts, __fork_guards__/forkQuietLiveTurn.test.ts and MessagesTimeline.logic.test.ts, 161 tests.
- An opened status line closes when the next reply lands (
MessagesTimeline.logic.ts:1647). Details and a repro are in the inline comment. - Nit:
forkLiveReplyIdsnow runs twice for each row derive (:1647and:1726).
I checked these and found nothing wrong:
forkShowLatestHeldReplystill shows exactly the newest reply.- Zen is unchanged, because Zen's own filter already drops that entry.
- The streaming fast path is safe: a hidden reply has no row to patch.
- The render-phase
setShowninuseDwelledLabelalways settles. - The shimmer's negative delay locks each mount to the clock. The only offset is the IntersectionObserver's first-callback latency.
🤖 Signed: Claude Opus 5.5 (claude-opus-5-5) via Claude Code
| // The newest stays in the entries: deriveMessagesTimelineRows draws no row for it, but it | ||
| // splits the turn, so the steps before it close into one summary row that grows each update. | ||
| const held = new Set( | ||
| input.forkHoldLiveReplies === true ? forkLiveReplyIds(input).slice(0, -1) : [], |
There was a problem hiding this comment.
Opening the status line no longer survives the next update.
The live group's id comes from its first step after the newest reply (workGroupId(activeWorkAnchor.id)). When the next reply lands, those steps join the summary group, whose id comes from the turn's first step. So the expandedWorkGroupIds entry the user opened no longer matches anything. The trace they were reading folds into a collapsed summary row, and the new live line starts closed. This happens at every update.
On base, held replies were removed before grouping, so the live group was anchored on the turn's first step and kept the same id all turn. An opened line stayed open.
Repro (the deriveMessagesTimelineRows → forkLiveStatusRows fixture with forkHoldLiveReplies: true):
- Update 1:
[t1 ✓, reply a, t3 running]. Open the line, which expandswork-group:t3-entry. - Update 2:
[t1 ✓, reply a, t3 ✓, reply b, t5 running], with the same expanded set. - PR:
work-toggle work-group:t1-entry expanded=false, then a live line onwork-group:t5-entry expanded=false. - Base: the live line stays on
work-group:t1-entry expanded=true.
Two possible fixes:
- Carry the expansion across the split: if the live group's id was expanded, treat the summary group that absorbs it as expanded.
- Anchor the summary and live groups to stable ids.
There was a problem hiding this comment.
Fixed in 0e66203. While replies are held, the live group's id comes from the run (work-group:fork-live:<runId>) and not from its first step, so an opened status line stays open across updates, like on base. The new case keeps an opened status line open when the next reply lands in forkWorkingRowLast.test.ts is your repro. It failed before the fix.
| While the turn waits on the user, the newest reply shows, since it explains the request. */ | ||
| const forkUnshownReplyId = | ||
| input.forkHoldLiveReplies === true && input.forkShowLatestHeldReply !== true | ||
| ? (forkLiveReplyIds(input).at(-1) ?? null) |
There was a problem hiding this comment.
Nit (performance): forkLiveReplyIds(input) already ran inside timelineRowEntries (line 1647). This second call repeats its full scans of the thread: deriveInFlightSteerAnswerIds, retainedAssistantReplyEntryIds and the tail loop. That cost lands on every full derive during a running turn. Computing the list once and passing it down, or having timelineRowEntries return the newest id along with the entries, would avoid it.
There was a problem hiding this comment.
Fixed in 0e66203. deriveMessagesTimelineRows now runs forkLiveReplyIds once and passes the list to timelineRowEntries (new fenced forkLiveReplies parameter). The newest id comes from that same list, so the two can't drift apart.
Each newest reply moved the live group's first step, so its group id changed at every update and a status line the user had opened closed. The live group is now named for the run while replies are held, as the whole turn was before. From review: the held replies are worked out once per derive; the dwell rules move into pure functions beside the rotation's, with a test; the status line is keyed by thread at its render site instead of threading the key into the dwell; the shimmer phase reads the animation's own duration. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A running turn read as the status line alone, so even ten minutes in nothing showed the agent had been busy. The status line also stuttered: a reply, a tool and its settle could flash three labels through it in a few frames, and swapping the line's element restarted the shimmer straight after a sweep.
What changed
MessagesTimeline.logic.ts). Running-turn replies are still held until the turn ends, except the newest, which now stays in the entries but draws no row. It splits the turn: the steps before it close into one summary row ("Ran 6 commands and read 1 file") whose counts climb with each update, and the steps since it fold into the status line. The status line still carries the only reply text. While the turn waits on the user, the newest reply shows in full as before.ForkLiveStatusLine.tsx,forkWorkingRowLast.ts). Each new label stays up at least 1.5s; a streaming thought grows through on its first deadline, and switching to another running thread shows its own label at once. A tool that ends between beats hands the line back to the latest reply, not on to the thinking word.theme.custom.css). Each mount of the line is phased to the clock, so the div/button swap no longer starts a second sweep right after one.Zen, Find and guest share pages keep their reply behavior; the status-line timing fixes apply wherever the line shows. Mobile is unchanged. Manifest entries
fork-quiet-live-turnandfork-working-row-lastare updated, and the guard still pins the held replies to Zen's rule.Checked in the dev desktop app with a real turn: rows during the run are the prompt, the summary row and the status line.
Open from review (left as is): a single finished step before the first update renders as a lone tool row, then becomes the summary row on the next update (at most once per turn); a tool still running across an update gets its own row; the timing fixes are not limited to the modes that hold replies.
Reviewed with sol-loop: 3 rounds with gpt-6.2-sol. Sol verdict: approved
🤖 Signed: Claude Opus 5.5 (
claude-opus-5-5) via Claude Code🤖 Reviewer: GPT-6.2 Sol (
gpt-6.2-sol) via Codex, 3 review rounds; its thread-switch and dwell-growth fixes were applied