Repository navigation
fix(crew): a message sent while a crewmate works shows at once - #18565
Conversation
A crewmate's DM is a background slot: its stream state turns busy only on a chunk or tool frame. While the crewmate's turn is thinking, or was already running when the DM opened, the stream state reads idle though the slot's server flag says running and the working indicator shows. With sub-agents out the composer is busy, so its send is a steer, and doSteer read only the stream state: it took the no-turn branch, which sends with no bubble, and the message appeared only on the server echo. doSteer now treats the slot's server running flag as a live turn too, so the optimistic steer bubble is minted at once, exactly as the main chat does. A stale flag is safe: the server dispatches a fresh turn and the receipt's turn ruling demotes the bubble to a plain row.
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Check that the stale-flag case really demotes the bubble to a plain row: a server [DESIGN-REVIEWED] 645b0b4 Description read[DESCRIPTION-READ] 745f0a21c2aefa5caae97f8892a0484beb1ee0a62fda8fda7bb1d22361ef5793 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 |
First Principles Review (Opus 5.5) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS The fix writes out Not justified as shipped
Inventory (4 items) — 3 justifiedIntent: when the user sends a message to a working crewmate, it appears in the thread right away instead of after the server echo. FIX.
[FIRST-PRINCIPLES-REVIEWED] 645b0b4 Description read[DESCRIPTION-READ] 3b31136995f095a6eb26fd5e1e498f2b639cd294307aab8707f207c262e2599a That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Check the stale-flag case by hand: when the server finds no running turn, the steer bubble should turn into a plain user message in place, with no flicker or duplicate. [UX-REVIEWED] 645b0b4 Description read[DESCRIPTION-READ] 5df0b3d32810a7b3049031fd513db924ae3672a29b4ce27171c55fed4fab5206 That sha256 names everything this verdict read: the PR description, plus the 5 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 |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
|
|
|
|
|
|
Self-review (crew-pr-reviewer, read-only): RECOMMEND APPROVE This fixes the crewmate DM case where a message sent while the crewmate is thinking or has sub-agents out shows nothing until the server echo. The fix is at the root: doSteer's "no turn" guard read only this tab's stream state, which a background slot never sets from a thinking frame or a hydrate. It now also reads paneSlot.running (ChatPane.tsx:1292), the same server flag the indicator, crewmateLive and both |
Problem / Motivation
Goal: In a crewmate's chat on the Crew page, a message sent while the crewmate works shows in the thread at once, the way the main chat shows a steer.
Today the "working" ghost shows, the user presses Enter, the composer clears, and nothing appears in the thread until the server echoes the message back. On a slow turn that reads as a lost message.
Why it matters
A DM is a conversation: a message that vanishes for seconds after Enter reads as lost, and the user retypes it. The main chat already lands it at once; the crewmate chat should not be worse.
Not a goal
Why it happens
A crewmate's DM is a BACKGROUND slot (the Members page never makes it the active chat slot), and that one fact splits two readings of "is a turn running":
ChatPane'srunningreads this tab's stream state (slotRun[slot]). For a background slot it turns busy only on a livechunkortoolframe. Athinkingframe, the slot-detail hydrate and the slots snapshot never set it (syncSlotRunningFromServeronly idles a background slot).busyalso read the slot's server flag (paneSlot.running) andsubagents_running.So while the crewmate's turn thinks, or was already running when the DM opened,
runningis false andbusyis true (sub-agents out). The busy composer steers, anddoSteer's first line took the "no turn to inject into" branch:doSend(undefined, true).doSendis busy, so it mints no bubble and waits for the echo.Chain: background slot -> stream state idle ->
doSteer!runningbranch -> busydoSend-> no optimistic bubble -> message shows only on the echo.The main chat is the active slot, whose running state follows the server, so it never takes this path.
What changed (motivation -> approach -> change)
Goal -> make the steer path see the same running turn the indicator sees; nothing else moves.
ChatPane.tsxdoSteer: the "no turn" guard is!running && !paneSlot?.running(was!running). With the server saying a turn runs, the send takes the existing steer path: the optimistic{ steer, optimistic, sendId }bubble lands at once, and thesteer_pushecho reconciles it bysendId, exactly as for a pane that already saw a frame. No new branch, no store change.dispatched && !steeredruling (applySteerReceipt->resolveOptimisticSteer('turn')) demotes the bubble to a plain user row.capture/members-page.tsxgains?subagents=1(radar's slot withsubagents_running, no live frame), andscripts/capture-members-steer-lands-now.mjsdrives the screenshots below. Capture harness only.Backwards compatibility
Compatible: no API, config or data shape changes.
Reader: website/src/components/ChatPane.tsx:doSteer -- pane composer -- the only reader of the changed guard; split-view panes share it and gain the same fix (they are background slots too)
Reader: website/src/test/ChatPane.steerOnly.test.tsx:"busy only with sub-agents" path -- test -- the no-turn branch still runs when the server flag is false, pinned by the new test 3 below
Tests
website/src/test/ChatPane.crewSteerLandsNow.test.tsx(crewmate pane, background slot, serverrunning+subagents_running, no live frame):steer_pushecho settles that bubble in place, one copy.running: false): still the fresh-turn send, no steer bubble.vitest --maxWorkers=1): all 32ChatPane.*suites, theChatPagesteer / busySend / followUpBusySend / sendResponseLate suites,crewmateBubbles,SessionGridViewCoverage: 39 files, 392 tests pass.tsc -p tsconfig.app.json, eslint on touched files,i18n:check: clean.Manual verification
The capture script below asserts each frame before writing it:
before(base commit) draws 0 bubbles after Enter,afterdraws 1./api/chatis held unanswered, so neither frame contains a server echo.Screenshots / video
Before (main): Enter pressed while radar works, the thread shows nothing.
./temp-screenshots/steer-lands-now/01-sent-before.png
After: the message is in the thread at once.
./temp-screenshots/steer-lands-now/01-sent-after.png
Before, recorded:
./temp-screenshots/steer-lands-now/02-sent-before.webm
After, recorded:
./temp-screenshots/steer-lands-now/02-sent-after.webm
Pattern harvest
Rule candidate: a pane-scoped host that gates a branch on "is a turn running" must read the slot's server flag (
paneSlot.running) as well as this tab's stream state, because a background slot's stream state turns busy only on a chunk or tool frame.Pattern:
!runningguards inChatPane.tsxfor a background slot (the indicator andselectComposerBusyalready OR in the server flag;doSteerdid not).Related Issues
Follow-up to #18256 (crewmate live status line) and #17836 (CrewComposer).
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.
02-sent-before.webm
02-sent-after.webm