Skip to content

fix(crew): hold each step on the crewmate status line so it stops flickering - #18528

Merged
iamwhatever merged 1 commit into
mainfrom
fix/crew-status-line-flicker
Oct 12, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
fix/crew-status-line-flicker

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: The crewmate's one-line live status is calm and readable: each tool step stays on screen long enough to read instead of flashing past a line that mostly says "Thinking".

Builds on #18256 (CrysisDeu), which collapsed a crewmate's live work to one status line. Since then the line flickers: tool titles flash by in tens of milliseconds and the line reads "Thinking" most of the time.

Why it matters

The line is the only live sign of what a crewmate is doing. When it flickers, a reader cannot follow the work, and the steady motion is distracting beside the transcript.

Not a goal

  • The DM header pill (useSlotActivity / pillActivity.ts) is unchanged; it keeps the raw reading.
  • No change to what the slot status record says, or to normal (non-crewmate) chat.

What changed (motivation → approach → change)

Symptom → cause: useSlotActivity reads "Thinking" as soon as a tool call returns. A fast call returns almost at once, so each title showed only for the call's own life, and every gap between calls was Thinking.

Change: the chat line now passes its reading through a small new hook, useHeldActivity (website/src/components/chat/useHeldActivity.ts), wired in CrewmateLiveActivity.tsx. It only delays what the line shows:

  • each step stays at least 600ms;
  • a finished tool's title stays 1.5s before Thinking, so the next tool usually replaces it directly;
  • when a hold ends the newest step wins, and a tool that started and ended inside a hold still gets its turn before Thinking;
  • stopping / compacting swap at once;
  • a pending swap is dropped when a newer reading arrives or the line unmounts.

The held step belongs to one crewmate. The Members page rebinds ONE ChatPane to the newly picked crewmate without remounting it, so ChatPane.tsx now keys the line by slot (<CrewmateLiveActivity key={slotKey} …/>): a rebind is a fresh mount and shows that crewmate's own reading at once, never the previous one's held step (buluoray's review).

Docs: docs/system-specs/modules/crew-mode.md (the crewmate chat status line) and the feature-map "Crewmate chat" row now describe the hold: 600ms per step, 1.5s before Thinking, stopping/compacting at once, chat line only, keyed by slot.

The fade under prefers-reduced-motion was already off and stays off.

Backwards compatibility

Compatible: the component's props and the pill's reading are unchanged; only the chat line's display timing changes.

Removes nothing: no path, key, record or function is taken away; the line still shows every reading kind, just held briefly.

Tests

website/src/components/chat/CrewmateLiveActivity.test.tsx (new, fake timers, renders the real component):

  • a finished tool title holds 1.5s, then Thinking;
  • a burst of fast tools goes title to title with no Thinking in between;
  • a tool that ended inside a hold still shows before Thinking;
  • a newer reading supersedes a pending swap: the stale timer never fires late (reddens when the effect's clearTimeout cleanup is removed);
  • stopping swaps at once.

website/src/test/ChatPane.crewmate.test.tsx (one new case): both crewmates busy, A's line shows a tool title, the pane is rebound to B (same ChatPane, new slotKey) and B's line reads B's "Thinking…" synchronously, with A's title gone. Red without the key (B's line showed "Checking the triage queue"), green with it.

Red-before for the hold: with CrewmateLiveActivity.tsx reset to main and the hook file present, the three hold tests fail and the stopping test passes. With the fix, all pass. crewmateBubbles, useSlotActivity, ChatPane.crewmate and ChatPane.workingLoader tests pass (80 tests). i18n:check, tsc -p tsconfig.app.json, eslint (--max-warnings 0 on changed files), check_feature_map.py and docs-lint.sh pass.

Manual verification

A throwaway harness mounted the real CrewmateLiveActivity beside a raw reading of the same scripted burst (six fast tool calls, 70–140ms each, with 150–250ms of thinking between). Sampling both rows every 50ms over 5s:

  • before: 12 swaps, each tool title visible about 100ms, Thinking in between;
  • after: 5 swaps, each title visible 550ms or more, Thinking only after the burst ends.

Screenshots / video

Top row: the raw reading (as on main). Bottom row: this PR. One frame every 150ms.

Frame series of the calm line

calm-line.webm

Related Issues

Closes #18527

Builds on #18256.

Pattern harvest

Not generalizable: a display-timing choice for one live status line; there is no code shape a rule could catch.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@iamwhatever
iamwhatever requested review from a team and KiroCrewCaptain as code owners October 9, 2026 16:53
@iamwhatever
iamwhatever requested a review from buluoray October 9, 2026 16:53
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 3e970b1b7c83f5b9aa8b422e7beec6449fa35420 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

A tool title can stay on screen up to 1.5s after its call has returned. Confirm that delay is acceptable, since the header pill shows the real-time state.

[DESIGN-REVIEWED] 3e970b1

Description read

[DESCRIPTION-READ] 544f72eae076ee8101ce21eafdf03e0eacf42ea7cad369d8837413f47e858a41

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of 3e970b1b7c83f5b9aa8b422e7beec6449fa35420 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: PASS

Check that the header pill reading "Thinking…" while the chat line still holds the last tool title for up to 1.5s doesn't look like a contradiction.

[UX-REVIEWED] 3e970b1

Description read

[DESCRIPTION-READ] 03cb7b28d22b33089c86e5303fb6eff8bd27a09e4b0f33a6f77b7ef0ce8a309c

That sha256 names everything this verdict read: the PR description, plus the 4 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 3e970b1b7c83f5b9aa8b422e7beec6449fa35420 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

Check that the #18256 owner accepts the rewritten spec line. The header pill and the chat line can now disagree for up to 1.5s.

What this change ships

Inventory (6 items) — 5 justified

Intent: FIX (#18527). Make a crewmate's one-line live status readable instead of a line that flashes tool titles and mostly says "Thinking".

  1. Each step on the chat line stays at least 600ms — justified
  2. A finished tool's title stays 1.5s before "Thinking…" — justified
  3. A tool that started and ended inside a hold still shows before "Thinking…" — justified
  4. Stopping and compacting swap at once — justified
  5. Switching the pane to another crewmate shows that crewmate's own step at once (key={slotKey}) — justified
  6. The crew-mode spec no longer says the pill and chat "can never name one moment differently"; for up to 1.5s they may disagree — undeclared: the description says only that the docs "now describe the hold", not that this guarantee was relaxed

[FIRST-PRINCIPLES-REVIEWED] 3e970b1

Description read

[DESCRIPTION-READ] f426fa2727aa7c28d53393340555b2703824f6d5f040d65647c4473d7f2af9ca

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 3e970b1b7c83f5b9aa8b422e7beec6449fa35420 — this comment is updated in place on each push.

Review details

No findings that block the merge.

FINDING — website/src/components/chat/useHeldActivity.ts:41 — the replay only fires when the step on screen is a tool (shown.kind === 'tool'). Here is the failing sequence: the line shows "Thinking…", then tool C opens and returns inside that 600 ms HOLD_STEP_MS hold. When C opens, a timer is queued to show it. When the reading flips back to thinking, the effect's cleanup clears that timer. Because shown.kind is 'thinking', next = activity and the hook returns at sameActivity. C's title never appears, even though the doc comment and crew-mode.md say "a tool which started and finished inside the hold still gets its turn". This happens whenever a long tool's "Thinking…" is followed by a fast tool call, and also for a fast first tool right after mount. → Fix: keep a ref to the last tool actually shown, and replay lastTool whenever a non-urgent thinking reading arrives while that tool has never been shown, whatever kind shown is.

[OPUS-REVIEWED] 3e970b1

Verdict parsed from the review's SHA-scoped output markers for commit 3e970b1b7c83f5b9aa8b422e7beec6449fa35420.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 3e970b1b7c83f5b9aa8b422e7beec6449fa35420: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 3e970b1b7c83f5b9aa8b422e7beec6449fa35420 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 3e970b1

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 3e970b1b7c83f5b9aa8b422e7beec6449fa35420: <one-sentence reason>

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 9, 2026

@buluoray buluoray left a comment

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.

Thanks, the hold logic itself is sound and well tested. I checked the three things that matter most for a display-delay hook:

  • Turn end / cancel / error: the line is mounted only while the crewmate is live (ChatPane.tsx:1838), so when a turn ends the component unmounts, the pending timer is cleared and the held state goes with it. stopping/compacting bypass the hold. Good.
  • Ordinary chat: untouched. Only CrewmateLiveActivity uses the hook, and the header pill still reads useSlotActivity directly.
  • Mutation check: removing the skipped-tool substitution, the 1.5s tool→Thinking hold, or the urgent zero-wait each reddens exactly one of the new tests. Removing the clearTimeout cleanup keeps the suite green.

Blocking: a held step can appear in another crewmate's chat. The Members page rebinds one ChatPane to a new slot without remounting it (MembersPage.tsx:4327, no key; ChatPane's own comment at :302 describes this). CrewmateLiveActivity has no key either. So if the user switches from crewmate A to crewmate B while both are working, crewmateLive stays true, the component stays mounted, and useHeldActivity keeps A's shown/lastTool. B's line then shows A's last tool title for up to 1.5s while B's header pill shows B's real state. I reproduced it on the real component: render a tool title, rerender with Thinking, and after 1000ms the line still shows the first title. Before this PR the swap was instant, so this is new, and it names the wrong subject rather than just a delayed one. Fix: <CrewmateLiveActivity key={slotKey} activity={liveActivity} />, ideally with a test that rerenders under a new key and expects the new reading at once.

Follow-ups (non-blocking, but please fold them into the same commit):

  • The owning spec still describes the old contract. docs/system-specs/modules/crew-mode.md (around line 1655) says the line is the pill's own reading, so "the header and the chat can never name one moment differently", and that it shows "Thinking…" once the call returns. The feature-map "Crewmate chat" row says "the pill reads the same". Both should describe the intentional hold (≥600ms per step, 1.5s before Thinking, stopping/compacting immediate, chat line only).
  • Pin the timer cleanup with a test, for example a newer reading superseding a pending one, or no update after unmount.
  • Minor: the stopping / compacting line break in the hook's doc comment.

CI on 81ec5de: 86 success, 11 skipped, 0 failures.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Self-review (crew-pr-reviewer, read-only): CHANGES NEEDED

This PR calms the crewmate's one-line live status by passing the reading through a new useHeldActivity hook (each step held at least 600ms, a finished tool title held 1.5s before Thinking, stopping/compacting at once). The hold logic itself is sound and its four tests prove it. But the head is still 81ec5de, the same commit buluoray reviewed, so none of the CHANGES_REQUESTED points are addressed. (1) Blocking, confirmed: website/src/components/ChatPane.tsx:1838 renders <CrewmateLiveActivity activity={liveActivity} /> with no key. The Members page rebinds one ChatPane to a new slot without a remount, so useHeldActivity's shown/lastTool carry crewmate A's tool title into crewmate B's line for up to 1.5s, naming the wrong subject. That is a new regression (main swapped at once). Fix: add key={slotKey} (or the slot id) at ChatPane.tsx:1838, plus a test that rerenders under a new key and expects the new reading at once. (2) docs/system-specs/modules/crew-mode.md (~line 1655) and the feature-map "Crewmate chat" row still say the line is the pill's own reading and can never differ from the header. Update them to describe the intentional hold. (3) Add a test that pins the timer cleanup (a newer reading supersedes a pending one, or no update after unmount); today removing clearTimeout keeps the suite green. (4) Minor: rejoin the split "stopping / compacting" line in the doc comment in website/src/components/chat/useHeldActivity.ts. CI is green, but buluoray's change request is still open. — crew-pr-reviewer

@iamwhatever
iamwhatever marked this pull request as draft October 9, 2026 23:32
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Moved to draft by crew-pr-reviewer: the self-review above is CHANGES NEEDED. Draft keeps this PR from merging and turns auto-merge off. Once the points above are fixed, mark it ready with gh pr ready 18528 and it will be re-reviewed on the new head. — crew-pr-reviewer

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision labels Oct 9, 2026
@iamwhatever
iamwhatever force-pushed the fix/crew-status-line-flicker branch from 81ec5de to 5d5d911 Compare October 12, 2026 07:33
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Thanks @buluoray — all four points are in the new head 5d5d911 (still one commit, rebased on main).

Blocking — a held step could show in another crewmate's chat. Fixed in ChatPane.tsx: <CrewmateLiveActivity key={slotKey} activity={liveActivity} />, with a comment naming the rebind. A new slot is a fresh mount, so useHeldActivity starts from that crewmate's own reading. Test: ChatPane.crewmate.test.tsx → "rebinding the pane to another working crewmate shows THAT crewmate's step at once, never the held one". Both crewmates are busy in the slots frame, A's line shows a tool title, the SAME pane is rerendered with B's slotKey, and B's line must read B's "Thinking…" synchronously (no timer advance) with A's title gone. Red without the key (B's line read "Checking the triage queue"), green with it.

Spec and feature map. docs/system-specs/modules/crew-mode.md (the crewmate chat status-line paragraph) now says the two surfaces share one seam for WHAT the crewmate is doing and can differ only on WHEN the chat line says it, then spells out the hold: ≥600ms per step, 1.5s before "Thinking…", newest step wins (a tool that ran inside a hold still gets its turn), stopping/compacting at once, pending swap dropped on a newer reading or unmount, chat line only (the pill is not delayed, so for up to 1.5s the pill can say Thinking while the line still names the returned tool), and keyed by slot because of the rebind. The feature-map "Crewmate chat" row says the same in short form and lists useHeldActivity.ts.

Timer cleanup test. CrewmateLiveActivity.test.tsx → "a newer reading supersedes a pending swap: the old timer is cleared, never fires late": Step A, then Thinking pending (1.5s), Step B arrives at 100ms and takes the line at 600ms; at the moment the stale Thinking timer would have fired the line still reads Step B. Mutation: replacing return () => clearTimeout(id) with a no-op reddens exactly this test.

Doc comment line break. Fixed (stopping / compacting on one line), and the comment now also states the cleanup and the per-slot ownership.

Local: the five named vitest files pass (80 tests), i18n:check, tsc, eslint --max-warnings 0, check_feature_map.py and docs-lint.sh pass.

@iamwhatever
iamwhatever marked this pull request as ready for review October 12, 2026 07:34
@iamwhatever
iamwhatever requested a review from buluoray October 12, 2026 07:34
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 12, 2026
…ckering

Builds on #18256. The live reading flips to Thinking the moment a tool call
returns, so fast calls flashed past a line that mostly said Thinking. The
chat status line now holds each step for 600ms and a finished tool's title
for 1.5s before Thinking. The newest step wins when a hold ends, and a tool
that ran inside a hold still gets its turn; stopping/compacting swap at once.
The line is keyed by slot: the Members page rebinds one ChatPane to another
crewmate without remounting it, so a rebind starts from that crewmate's own
reading, never from the previous one's held step. The header pill is
unchanged. The crew-mode spec and feature map describe the hold.
@iamwhatever
iamwhatever force-pushed the fix/crew-status-line-flicker branch from 5d5d911 to 3e970b1 Compare October 12, 2026 08:03
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 12, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Head is now 3e970b1: the same single commit rebased onto main, which had just landed fixes for the inherited reds (the wait-discipline ratchet re-baseline #19329 and the FilePathMenu in-app chip tests #19288). No change to the diff. CI on 3e970b1: 101 checks, 0 failing, PR Readiness passed, all review lanes PASS.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Self-review (crew-pr-reviewer, read-only): RECOMMEND APPROVE

This fixes the flicker in the crewmate live status line. The root cause is that useSlotActivity flips to Thinking as soon as a fast tool call returns. The new useHeldActivity hook changes display timing only: 600ms per step, 1.5s before Thinking, stopping/compacting at once. The header pill and the slot record are untouched. I traced the hook's effect through the burst, skipped-tool, same-title-repeat and urgent cases and found no stale or wrong step. The effect's clearTimeout cleanup drops a superseded swap. buluoray's earlier request is addressed: the blocking cross-crewmate leak is fixed by <CrewmateLiveActivity key={slotKey} …/> in ChatPane.tsx, with a ChatPane rebind test that is red without the key. crew-mode.md and the feature-map row now describe the intentional hold, including the up-to-1.5s pill/line divergence. A supersede test pins the timer cleanup, and the doc-comment line break is fixed. Head 3e970b1 (committed 2026-10-12) is green, with PASS on Design/UX/First Principles and no findings from Opus/GPT. buluoray's CHANGES_REQUESTED on 81ec5de is still formally open, so buluoray needs to re-review or dismiss it before merge. — crew-pr-reviewer

@iamwhatever
iamwhatever enabled auto-merge (squash) October 12, 2026 15:48

@buluoray buluoray left a comment

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.

LGTM. I checked this at head 3e970b1. This supersedes my request changes on 81ec5de.

What it brings: the crewmate status line holds each step briefly instead of flashing through tool titles, and switching to another working crewmate shows that crewmate's step at once.

My earlier blocker is fixed. ChatPane.tsx:1989 now renders <CrewmateLiveActivity key={slotKey} .../>. The Members page still rebinds one ChatPane without a key, so this component key is what resets the held state on a switch. Removing the key reddens the new test "rebinding the pane to another working crewmate shows THAT crewmate's step at once, never the held one".

Earlier follow-ups, also done:

  • crew-mode.md now describes the hold (600ms per step, 1.5s before Thinking, stopping/compacting swap at once, pending swap dropped on supersede or unmount, keyed by slot), and the feature map matches.
  • Removing the clearTimeout cleanup (useHeldActivity.ts:52) now reddens "a newer reading supersedes a pending swap: the old timer is cleared, never fires late".
  • Also checked: urgent = false reddens "swaps to stopping at once"; shortening the tool-to-Thinking hold reddens "keeps a finished tool title on screen before falling back to Thinking".

The range-diff since 81ec5de touches only the key, the spec/feature map, a doc comment and two tests; the hold logic is unchanged. The two changed test files pass, 20/20. CI at this head: 92 success, 9 skipped, 0 failed.

Non-blocking: compacting has no zero-wait test of its own; only the stopping test catches the urgent path.

Not verified: no live browser run; the rebind behaviour is proven through the RTL test.

@iamwhatever
iamwhatever merged commit ff47dcc into main Oct 12, 2026
102 checks passed
@iamwhatever
iamwhatever deleted the fix/crew-status-line-flicker branch October 12, 2026 16:05
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(crew): crewmate one-line status flickers between tool titles and Thinking

2 participants