Repository navigation
feat(fork): one live status line at the bottom of a running turn - #356
Conversation
The transcript showed "Working for Xs" at the head of the active turn with a
divider under it, plus a separate thinking or running-tool row, so a turn had
two status lines and the answer streamed in below the indicator.
Following Claude Code, the working row now trails the turn without a divider
and absorbs the live row above it: working mark, current activity ("Thinking",
"Running vp", a startup label), turn timer, and a chevron that opens the
running group. The fold runs on useStableRows' output, so upstream's row
derivation and tests are untouched. An open group's details and viewed images
stay above the line, which stays mounted so the toggle keeps focus. Failed and
approval live rows keep their own upstream row.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NoahHendrickson
left a comment
There was a problem hiding this comment.
Reviewed commit 08d1f1c30577fae6b6401b71cb45e3cae6ab3fea against the PR diff for base cd5c8493e13afb9c1db10d0314ec25556e4558f8. A focused fixture harness reproduced both row-folding cases. Verification covered the row transform; browser behavior and the full suite remain unverified.
| const working = rows[index] as WorkingRow; | ||
| const rest = rows.toSpliced(index, 1); | ||
| let liveIndex = rest.length - 1; | ||
| while (liveIndex >= 0 && trailsLiveGroup(rest[liveIndex])) liveIndex -= 1; |
There was a problem hiding this comment.
[P2] Keep the current tool in the status line when commentary arrives. The existing keeps separated in-progress tool runs visible fixture in MessagesTimeline.logic.test.ts models a running command followed by assistant commentary. Before the second command arrives, derivation emits [working, work-live, message]. The tail scan stops at the message and leaves both the in-progress tool row and a generic “Working for…” footer. This breaks the single status line during that interval even when only one tool is running. Select the latest eligible activity in the active turn across intervening transcript rows and retain any other groups’ disclosures.
There was a problem hiding this comment.
Fixed in a3bf8c6. The fold now takes the turn's latest foldable live row from wherever it sits (findLastIndex), so [working, work-live, message] becomes [message, working] with the tool on the line. Separated runs fold only the latest; earlier ones keep their row. Both cases are tested with deriveMessagesTimelineRows using the upstream fixture's inputs.
| const liveByMerged = new WeakMap<WorkingRow, ForkLiveRow>(); | ||
|
|
||
| function foldsIntoStatusLine(row: MessagesTimelineRow | undefined): row is ForkLiveRow { | ||
| if (row?.kind === "thinking") return true; |
There was a problem hiding this comment.
[P2] Show the failed tool when the live group is collapsed. When the last running command fails while the turn stays active, deriveMessagesTimelineRows suppresses its work-live row and emits a grouped thinking row. The existing failed-command fixture in MessagesTimeline.logic.test.ts covers that shape. This unconditional branch folds it into a generic “Thinking” footer, and the failed entry appears only after expanding the group. The failure check below never sees that entry. Carry the failed-group state through derivation and keep a visible failure row or label while the group is collapsed.
There was a problem hiding this comment.
Fixed in a3bf8c6. A grouped thinking row (upstream's failed-tool shape) no longer folds, so the failure keeps its upstream row above a plain "Working for…" line. A test derives it from a failed command.
NoahHendrickson
left a comment
There was a problem hiding this comment.
Code-quality review of 08d1f1c3.
The overall shape is right. Folding useStableRows' output in a fork module, letting the working row host the line so the toggle stays mounted, and keeping isRowUnchanged untouched is the correct seam, and the upstream edits stay small and fenced. Approval bar not met, for two reasons:
- The merged row's payload is hidden in a module-global side table.
liveByMergedplus a{ ...working }clone that exists only to be a WeakMap key means the type of the rowWorkingTimelineRowreceives never says it carries a live row. A reader has to know to callforkStatusLineLiveRow. Put the live row on the row itself and the side table and its lookup go away (inline atforkWorkingRowLast.ts:16). - The fold's exception rule is written against row shapes upstream doesn't produce. Upstream's failed-tool live row is a
thinkingrow with agroupId, andfoldsIntoStatusLinefolds everythinkingrow. Thework-livefailure check is effectively unreachable. So the documented "a failed tool keeps its own upstream row" doesn't happen, and the hand-cast fixtures in the unit test hide that (inline atforkWorkingRowLast.ts:18).
Smaller, inline: forkLiveStatusRows encodes "rows that trail the live group" twice (by kind, then by id prefix). ForkLiveStatusLine's labels are a hand-kept mirror that has already drifted.
One side effect worth knowing, with no change asked: the fold runs after upstream's adjacency pass, so continuesWorkLog on the row just above a folded live row is stale. The row still thinks a work-log row follows it, and gets pb-0. That's tolerable because the status line brings its own pt-1, but it is a cost of folding at this layer. Name it in the manifest watch comment next to the row-order assumption so the next sync doesn't rediscover it.
File sizes are fine: every touched upstream file grows by a few fenced lines, and the new modules are small.
Reviewed by Claude Opus 5.5 (Claude Code).
| // while unchanged; these caches keep that identity through the fold. | ||
| const folded = new WeakMap<MessagesTimelineRow[], MessagesTimelineRow[]>(); | ||
| const mergedByWorking = new WeakMap<WorkingRow, { live: ForkLiveRow; merged: WorkingRow }>(); | ||
| const liveByMerged = new WeakMap<WorkingRow, ForkLiveRow>(); |
There was a problem hiding this comment.
This hides the row's real shape in a module-global side table.
liveByMerged plus the { ...working } clone in mergedWorkingRow exist only to attach data to a row without saying so in its type. WorkingTimelineRow gets an Extract<TimelineRow, { kind: "working" }> and has to know about an out-of-band lookup (forkStatusLineLiveRow) to find out it is really a status line. Nothing in the row, React DevTools, or the type tells you, and a future consumer of rows (minimap, motion, scroll anchoring) can't see it either.
Make it explicit data instead:
export type ForkStatusLineRow = WorkingRow & { readonly forkLive: ForkLiveRow };
export function isForkStatusLine(row: WorkingRow): row is ForkStatusLineRow {
return "forkLive" in row;
}
function mergedWorkingRow(working: WorkingRow, live: ForkLiveRow): ForkStatusLineRow {
const cached = mergedByWorking.get(working);
if (cached?.forkLive === live) return cached;
const merged = { ...working, forkLive: live };
mergedByWorking.set(working, merged);
return merged;
}That deletes liveByMerged and forkStatusLineLiveRow. mergedByWorking also gets simpler, because the cached value is the merged row and no { live, merged } pair is needed. The fenced branch in WorkingTimelineRow becomes if (isForkStatusLine(row) && !shimmer), and ForkLiveStatusLine can take row: ForkStatusLineRow and drop its separate live prop. The extra field is safe: isRowUnchanged runs before the fold, and frames compare by identity, which mergedByWorking still keeps.
There was a problem hiding this comment.
Fixed in a3bf8c6. The live row is now explicit data: ForkStatusLineRow = WorkingRow & { forkLive } with an isForkStatusLine guard. liveByMerged and forkStatusLineLiveRow are gone, and mergedByWorking caches the merged row directly.
| const mergedByWorking = new WeakMap<WorkingRow, { live: ForkLiveRow; merged: WorkingRow }>(); | ||
| const liveByMerged = new WeakMap<WorkingRow, ForkLiveRow>(); | ||
|
|
||
| function foldsIntoStatusLine(row: MessagesTimelineRow | undefined): row is ForkLiveRow { |
There was a problem hiding this comment.
This predicate doesn't match the rows upstream emits, so the documented exception is mostly dead code.
- Failed tool. When the latest tool failed, upstream does not build a
work-liverow.activeWorkRowis gated on!latestToolFailed(MessagesTimeline.logic.ts:1726-1728). Instead it pushes akind: "thinking"row with the failed group'sgroupId(MessagesTimeline.logic.ts:2297-2318). Line 19 folds everythinkingrow, so that row is folded and renders as "Thinking · 12s ›". The manifest and PR body say a failed tool keeps its own upstream row. - Unreachable check. The
workEntryDisplayIndicatesToolFailurecheck here effectively never fires. An activeactiveWorkRowholds a running or succeeded entry, and the mid-timelinework-liverows needtoolLifecycleStatus === "inProgress"(MessagesTimeline.logic.ts:1662-1665). - Pending approval. The same failed-group
thinkingrow is the one upstream keeps while an approval waits.ThinkingTimelineRowturns offactive/shimmerwhenpendingApprovals.size > 0.ThinkingLabeldoesn't, so the folded line keeps reading as live "Thinking" while the agent is actually waiting on the user.
The unit test can't catch any of this. row(kind, id, extra) as MessagesTimelineRow lets it build a work-live with toolLifecycleStatus: "failed", a shape upstream never produces.
Pick one rule and encode it against the real shapes:
- If failed groups should keep their row, exclude
thinkingrows that carry agroupId, since that is upstream's failed-group shape. Then delete thework-livefailure check. - If they should fold, delete the failure check and fix the intent text.
Either way, build the test fixtures with deriveMessagesTimelineRows (or at least typed literals) instead of casting arbitrary objects. Otherwise the exception tests only prove the predicate agrees with itself.
There was a problem hiding this comment.
Fixed in a3bf8c6. Exclusion is now thinking with a groupId; the unreachable work-live failure check is deleted (the approval check stays). Fixtures are now built with deriveMessagesTimelineRows, including the failed-command shape.
| const working = rows[index] as WorkingRow; | ||
| const rest = rows.toSpliced(index, 1); | ||
| let liveIndex = rest.length - 1; | ||
| while (liveIndex >= 0 && trailsLiveGroup(rest[liveIndex])) liveIndex -= 1; |
There was a problem hiding this comment.
"Rows trailing the live group" is encoded twice, and the redundancy leaks into the control flow.
First trailsLiveGroup walks back by kind (any expanded work / any viewed-images). Then every(...) re-checks the same rows by id prefix. The re-check also needs live.groupId !== undefined inside the callback, folds && live to recover the narrowing the boolean dropped, a nested ternary, and the rows[index] as WorkingRow cast above.
The id prefix alone is the rule, and the kind walk can go:
const workingIndex = rows.findIndex((row) => row.kind === "working");
const working = rows[workingIndex];
if (working?.kind !== "working") return remember(rows, rows);
const rest = rows.toSpliced(workingIndex, 1);
const liveIndex = rest.findLastIndex((row) => row.kind === "thinking" || row.kind === "work-live");
const live = rest[liveIndex];
const trailsLive = (row: MessagesTimelineRow) => row.id.startsWith(`${live?.groupId}:`);
if (foldsIntoStatusLine(live) && rest.slice(liveIndex + 1).every(trailsLive)) {
return remember(rows, [...rest.toSpliced(liveIndex, 1), mergedWorkingRow(working, live)]);
}
return remember(rows, workingIndex === rows.length - 1 ? rows : [...rest, working]);That removes trailsLiveGroup and the cast, and the early returns read straight down. The id prefix is upstream's private ${groupId}:details / ${groupId}:viewed-images scheme (expandedWorkGroupRow / viewedImagesRows). It is now load-bearing, so name it in the manifest's watch comment for MessagesTimeline.logic.ts next to the row-order assumption.
There was a problem hiding this comment.
Resolved in a3bf8c6 by removing the trailing-row rule entirely. The fold picks the latest live row anywhere in the turn, and the rows after it (details, images, commentary) stay put, so neither the kind walk nor the id-prefix check exists any more. The cast and nested ternary went with it.
| import { SidebarV2WorkingMark } from "./SidebarV2StatusIndicator"; | ||
| import type { ForkLiveRow } from "./forkWorkingRowLast"; | ||
|
|
||
| function ThinkingLabel() { |
There was a problem hiding this comment.
These labels are a hand-kept copy of upstream's, and the manifest admits it ("The live labels mirror ThinkingTimelineRow and LiveWorkEntryTimelineRow here"). A mirror that only a watch comment keeps in sync is copy-paste by another name, and it has already drifted:
- Thinking.
ThinkingLabelrepeatsproviderStartingLabel ?? liveAnswerPreview ?? "Thinking"but drops thependingApprovals.size === 0gating next to it (see the predicate comment). - Work.
WorkLabelre-derives LiveWorkEntryTimelineRow's precedence (thought-is-status, reasoning, thread-read label, plain label) with a different thought test:row.entry === row.thoughtversus upstream'sthoughtLine !== "" && row.entry === row.thought.
Some simplification is deliberate (one truncated line, no markdown). But put the label decision in one pure function in this module, e.g. forkStatusLineLabel(live, activity, threadTarget): string, with a unit test row per upstream case. Then the rule the sync has to check is a few lines in one place, not two JSX components.
There was a problem hiding this comment.
Fixed in a3bf8c6. The label decision is one pure forkStatusLineLabel with a test row per case (thinking, provider startup, zen preview, tool, reasoning). The approval gate drift is moot: the grouped thinking row no longer folds, and upstream only appends a plain thinking row with no pending approvals. Reasoning entries read "Thinking"; upstream's thought previews stay in the open group (deliberate one-line condensing, noted in the manifest).
NoahHendrickson
left a comment
There was a problem hiding this comment.
Code review of 08d1f1c305: 3 findings, each checked against the code. None blocks the main path (thinking line or running tool folding into the bottom line), but #1 shows up on every first open of a running group.
- Status line slides when you open its group. The motion module's details-row skip no longer fires on the folded shape. (inline:
forkTimelineRowMotion.tsx) - A failed live group gets folded anyway. That goes against the stated exception, and with an approval pending it shows a busy "Thinking" line. (inline:
forkWorkingRowLast.ts,ForkLiveStatusLine.tsx) - While compacting or setting up a worktree, the running tool disappears. (inline:
TimelineWorkGroupRows.tsx)
Checked and not raised: the worktree-setup card now sits above the working line (matches the PR's "trails everything" design), and continuesWorkLog on the row before the folded live row (spacing matches the flush log line it replaces).
🤖 Generated with Claude Code
| if (!thread.liveIds.has(working.id)) arrived.push(working); | ||
| start -= 1; | ||
| } | ||
| if (start > 0 && !isLiveRow(rows[start]!) && isLiveRow(rows[start - 1]!)) start -= 1; |
There was a problem hiding this comment.
The status line slides on the first open of a running group. After the fold, the live row is gone from rows, so an open group comes out as […, settled, g:details, working]. Once the working row is skipped, rows[start] is g:details and rows[start - 1] is a settled row, not a live one. So this skip never fires.
The walk then records g:details as arrived: it isn't in known on the first open, and ENTERING_ROW_KINDS doesn't matter here because insertedAt is set for any arrival. The working row's container top grows by the height of the details while insertedRecently() is true, so the line animates from translateY(-delta) down through the details the user just opened. That breaks the module header's promise that "mid-list group expansion" stays still. Viewed-images rows hit this too.
The new test in forkTimelineRowMotion.test.ts builds […, live, details("g"), working], but the fold never produces that shape (the live row is removed), so the test passes while this path goes untested. A possible fix: when the tail is a working row, also skip the trailsLiveGroup rows (work with isExpandedToolGroup, viewed-images) before the walk.
There was a problem hiding this comment.
Fixed in a3bf8c6. When the tail is the working row, the motion walk marks the open group's details and viewed-images rows known instead of arrived, so opening the folded group doesn't slide the line. New test: [a, working] then [a, g:details, working] leaves insertedRecently() false.
| const liveByMerged = new WeakMap<WorkingRow, ForkLiveRow>(); | ||
|
|
||
| function foldsIntoStatusLine(row: MessagesTimelineRow | undefined): row is ForkLiveRow { | ||
| if (row?.kind === "thinking") return true; |
There was a problem hiding this comment.
A failed live group gets folded, which goes against the stated exception. When latestToolFailed, upstream sets activeWorkRow to null and instead pushes { kind: "thinking", id: LIVE_ACTIVITY_ROW_ID, groupId, expanded }, followed by ${groupId}:details and ${groupId}:viewed-images (MessagesTimeline.logic.ts ~2306–2321). Every thinking row returns true here, and the trailing ids all start with ${groupId}:, so this row folds into the status line.
The manifest and PR body say "a failed tool … keeps its own upstream row". The keeps a failed live row test only covers a work-live row with a failed status, and upstream rarely produces that while it's active. The real failure shape, a grouped thinking row, has no test.
Possible fix: fold thinking only when row.groupId === undefined, since the grouped form only appears on the failed path. Add a test case for that shape.
There was a problem hiding this comment.
Fixed in a3bf8c6. Grouped thinking rows no longer fold, with a derived test for the failed-command shape.
|
|
||
| function ThinkingLabel() { | ||
| const { liveAnswerPreview, providerStartingLabel } = use(TimelineRowActivityCtx); | ||
| return providerStartingLabel ?? liveAnswerPreview ?? "Thinking"; |
There was a problem hiding this comment.
With an approval pending, the line looks busy. This follows from the fold above. Upstream's ThinkingTimelineRow sets live = ctx.pendingApprovals.size === 0 and turns off activity and shimmer with the comment "nothing is thinking then". This label drops that gate, so a folded failed group with a pending approval renders the animated SidebarV2WorkingMark plus "Thinking" while the turn is actually waiting on the user.
If the fold in forkWorkingRowLast.ts excludes grouped thinking rows, this mostly goes away. Otherwise, gate the label on pendingApprovals.
There was a problem hiding this comment.
Resolved by the fold change in a3bf8c6. The grouped thinking row (the one upstream keeps while an approval waits) no longer folds, and a plain thinking row is only appended when no approval is pending.
| const shimmer = isPreparingWorktree || compacting; | ||
| /* fork:begin fork-working-row-last — see .fork/customizations.yaml#fork-working-row-last */ | ||
| const forkLive = forkStatusLineLiveRow(row); | ||
| if (forkLive && !shimmer) { |
There was a problem hiding this comment.
While compacting or setting up a worktree, the running tool disappears. forkLiveStatusRows drops the live row regardless of activity state, but this branch only renders it when !shimmer. If a tool is still running (work-live, active) when isCompacting / row.compacting or isPreparingWorktree turns on, the line falls back to the plain "Compacting for…" row. The running-tool label and the chevron that opens its group both disappear until compaction ends.
Upstream's LiveWorkEntryTimelineRow has no compaction gate (only ThinkingTimelineRow blanks itself), so upstream keeps the tool visible here. This path is rare, but it's a silent loss. One option: skip the fold in forkLiveStatusRows when the live row is a work-live. That needs the shimmer state, which this function doesn't have. The other option: render ForkLiveStatusLine with the compaction label as its text instead of falling through.
There was a problem hiding this comment.
Fixed in a3bf8c6. When compaction or worktree setup owns the line, WorkingTimelineRow renders a folded running tool's upstream LiveWorkEntryTimelineRow above it, so the label and chevron stay visible. The thinking row is left blank there, as upstream does.
Review found the fold written against shapes upstream never emits. A failed tool arrives as a grouped thinking row, which folded into a busy "Thinking" line, and commentary after a running tool left two lines. The fold now takes the turn's latest plain thinking row or active work-live from wherever it sits, leaves the grouped (failed) thinking row on its own line, and carries the live row on the row as `forkLive` instead of a side table. Labels are one tested rule, a running tool keeps its upstream row while compaction owns the line, and opening the folded group no longer slides the line. Tests now build rows with deriveMessagesTimelineRows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Addressed both reviews in a3bf8c6; each inline thread has a reply. On the review-level notes: the |
A running turn showed "Working for Xs" at the top of the turn with a divider under it, plus a separate thinking or running-tool row, so there were two status lines and the answer streamed in below the indicator.
Following Claude Code, a running turn now shows one status line at the bottom:
How it's built:
custom/forkWorkingRowLast.tsfoldsuseStableRows' output. Upstream's row derivation, row equality and their tests are untouched.custom/ForkLiveStatusLine.tsxrenders the line.MessagesTimeline.tsxandTimelineWorkGroupRows.tsx.forkTimelineRowMotionlearns that the working row now trails an open group's details row.fork-working-row-lastwith a guard test.Unchanged on purpose: the "Worked for Xs" fold divider still appears at the top of the turn once it ends, and the timer still covers the whole turn.
Known follow-up (from review, deferred as a rare path): if you scroll away from the live end mid-turn and the status line is near the top of the screen, opening the group can put its details just above the viewport.
Reviewed with sol-loop: 3 rounds with gpt-6.2-sol on high. Sol verdict: approved
Implemented with Claude Opus 5.5 in Claude Code (T3 Code).
🤖 Generated with Claude Code