Repository navigation
fix(chat): keep a send made while the opened slot's page is still loading - #18658
Conversation
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Check that the farm's 900 ms hold, which is time-based, still covers the gap between [DESIGN-REVIEWED] a59b55d Description read[DESCRIPTION-READ] 3af723e75a7df232e33a741de76230b0499263499b963d4dc9662983f386c560 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 |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Check that a reader scrolled up mid-transcript sees no scroll jump when the held tail row is measured about 900 ms after it is appended. [UX-REVIEWED] a59b55d Description read[DESCRIPTION-READ] 2bf3039c03cf90155f5422f5977a4519c64b6f4fe6c783d2087e91401d676337 That sha256 names everything this verdict read: the PR description, plus the 3 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) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Check that the farm's 900 ms hold on newly appended rows is the right level: the cause is that the farm's What this change shipsInventory (3 items) — 3 justifiedIntent: a message the user sends right after opening a chat by link stays on screen (a FIX, closes #18485).
[FIRST-PRINCIPLES-REVIEWED] a59b55d Description read[DESCRIPTION-READ] cb30db1c39373180a9c233d5d068849d21cd93fee847c4548860cca01bb28e70 That sha256 names the PR description this verdict read. 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: |
|
Verification evidence for the two shapes this PR fixes. All runs drive the real dashboard against the same ephemeral gateway 1. The user bubble vanishes (CI line 439, "element(s) not found")Forced condition: a local-only spec opens Parent ( Fix ( 2. The bubble is found twice (strict-mode violation)Same spec without the delay, Parent: 3/30 and 1/16 runs hit it. The second copy sits inside the measure farm's hidden box ( Fix: 0/30 (and 0/30 on a second run). 3. The two flaky specs, repeated
(61 = the auth setup project + 30 + 30.) The same 30× under heavy load — Unit tests on the parent
|
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: |
aefee93 to
2d1143b
Compare
2d1143b to
a59b55d
Compare
iamwhatever
left a comment
There was a problem hiding this comment.
This fixes a sent bubble that vanished when you sent a message right after opening a slot by deep link. The cause is fixed at its root: switchSlot.fulfilled replaced the view with a page that was read before the send. pending now records a baseline (_switchLiveFrom), and fulfilled keeps only user rows past that baseline that carry a sendId and are not already on the page by identity. A cached row the server dropped is not brought back, and a send the page already caught is not doubled. The MeasureFarm change holds rows appended since the last count for one idle window. That closes the double-render gap, and its only side effect is that an appended row is measured up to 900 ms later. I read the full diff and both new tests. They cover the optimistic case, the echoed case, the no-double case, the ordering with a streamed reply and the no-resurrection case, and the description shows 3 of 5 failing on the parent. The Design, UX and First Principles lanes all PASS on head a59b55d, checks are green, base is main, and no change request is open. — crew-pr-reviewer
…state refreshSlot.fulfilled rebuilt the transcript from a count-matched page and kept only the head above the page's first row (olderHeadAbovePage), then copied the page's run verdict. A send made while the fetch was in flight (the refresh fires on socket reconnect and on chat_done) is newer than the page, so the rebuild dropped the user's row, and the page -- read before the send -- idled the slot (slotRunning, pendingTurnSlot) under the turn the send opened, offering Resume on a running turn. The liveFrameSeq guard protected only slotState. Give refreshSlot a dispatch-time baseline (liveFromAtDispatch), keep the user rows past it with a sendId the page does not carry (tailNotInPage), and skip the page's idle run verdict when such rows exist -- the pagePredatesLiveSend guard switchSlot.fulfilled already uses (kirodotdev#18658 / kirodotdev#19263). Fixes kirodotdev#19267
…state refreshSlot.fulfilled rebuilt the transcript from a count-matched page and kept only the head above the page's first row (olderHeadAbovePage), then copied the page's run verdict. A send made while the fetch was in flight (the refresh fires on socket reconnect and on chat_done) is newer than the page, so the rebuild dropped the user's row, and the page -- read before the send -- idled the slot (slotRunning, pendingTurnSlot) under the turn the send opened, offering Resume on a running turn. The liveFrameSeq guard protected only slotState. Give refreshSlot a dispatch-time baseline (liveFromAtDispatch), keep the user rows past it with a sendId the page does not carry (tailNotInPage), and skip the page's idle run verdict when such rows exist -- the pagePredatesLiveSend guard switchSlot.fulfilled already uses (#18658 / #19263). Fixes #19267
…state refreshSlot.fulfilled rebuilt the transcript from a count-matched page and kept only the head above the page's first row (olderHeadAbovePage), then copied the page's run verdict. A send made while the fetch was in flight (the refresh fires on socket reconnect and on chat_done) is newer than the page, so the rebuild dropped the user's row, and the page -- read before the send -- idled the slot (slotRunning, pendingTurnSlot) under the turn the send opened, offering Resume on a running turn. The liveFrameSeq guard protected only slotState. Give refreshSlot a dispatch-time baseline (liveFromAtDispatch), keep the user rows past it with a sendId the page does not carry (tailNotInPage), and skip the page's idle run verdict when such rows exist -- the pagePredatesLiveSend guard switchSlot.fulfilled already uses (#18658 / #19263). Fixes #19267
Problem / Motivation
Goal: A message you send right after opening a chat stays on screen.
Open a session by link (
/chat?sid=…) and send at once. The bubble shows, then vanishes. It only comes back when the reply ends. The E2E specmember-memory.spec.ts › a legacy configured default member keeps V1 …does exactly this and fails onexpect(messages.getByText(prompt)).toBeVisible()(line 439) on unrelated branches, passing only on a retry (#18485).A second, rarer shape in the same spec: the text query finds the bubble twice for a few frames and fails Playwright's strict mode.
Why it matters
A sent message that disappears looks lost. People send it again and the agent does the work twice. The E2E gate has a zero-flaky ceiling, so this one spec also reddens any PR it lands on.
Not a goal
slot.agentiskirocrew): that PR changes which agent a plain session gets, and the spec will follow it there.What changed (motivation → approach → change)
Opening a slot runs
switchSlot:pendingmakes the slot active (the composer is live), the page fetch goes out,fulfilledreplaces the view with the page. A send in that window appends the bubble (and its echo gives it the servermid), but the page was read before the send, sofulfilledwiped it. The reducer already re-attached a reply that streamed in during the fetch; it never re-attached the user's own row.pendingnow records how many rows the view held when the fetch went out (_switchLiveFrom,website/src/store/chat/state.ts).fulfilled(website/src/store/chat/slotSwitch.ts) keeps the user rows past that mark that carry asendIdand are not on the page by identity (tailNotInPage), in send order, ahead of the re-attached reply. Rows from the restored cache are below the mark, so a row the server dropped cannot ride back in; a page that already caught the send is matched bymid/sendIdand not doubled.The double bubble comes from the off-screen measure farm. A tail append reaches its
countone commit before the window mounts the row, so a tick in that gap read the row as unmeasured and unmounted and rendered a hidden copy into the transcript column. The farm (website/src/hooks/virtualizer/MeasureFarm.tsx) now holds indices appended since its last count for one idle window (FARM_IDLE_MS): an appended row is either about to mount (the observer measures it) or sits below a reader who scrolled up (the farm reaches it after the hold).The spec itself is unchanged: it was right to expect its bubble.
Backwards compatibility
Compatible: one optional transient field on
ChatState; every existingswitchSlot.fulfilledpath produces the same transcript when nothing was sent during the fetch (liveSendsis empty), and the farm only delays picking appended rows by 900 ms.Removes nothing: additive guards only.
Tests
website/src/test/chatSlice.switchSlotLiveSend.test.ts(new): still-optimistic bubble kept when the page predates it; kept after its echo set the servermid; not doubled when the page already carries it; kept ahead of a reply that streamed in during the fetch; a cached row the page dropped is not resurrected. On the parent tree 3 of the 5 fail (toEqual([['user', …]])gets[]).website/src/test/measureFarm.test.tsx: new case — an appended tail index is held for one idle window, then swept; a later append holds only the appended index while rows above keep sweeping. Fails on the parent (renderItemcalled with0inside the window).Determinism proof, forced condition: a local Playwright spec routes the slot-detail response to be fetched at once and delivered 4 s later, then sends. Parent: 2/2 fail with
count=0and only the reply row on screen. Fix: 3/3 pass,count=1(log excerpt in a PR comment). Double-bubble shape underEmulation.setCPUThrottlingRate(4), 4 workers: parent 3/30 and 1/16 runs show a second<p>under the farm'sdata-farm-index="0"box; fix 0/30 (twice).Manual verification
Both specs against the same ephemeral gateway
test_playwright_e2e.pyboots,--repeat-each 30,--retries 0, one worker (a local harness seeds 30 legacy aliases and indexes them per repetition; that harness is not part of this PR): results posted in a PR comment (idle run; and a 2-CPUtasksetrun with four busy loops, where line 439 passed 30/30 and the only misses were the Capabilities editor dialog taking over 5 s to paint under that load — not a race, not seen in CI).Related Issues
Closes #18485
Pattern harvest
Rule candidate: review-prompt
Pattern: a reducer that replaces a view with a fetched snapshot must carry forward every local row appended after the fetch was issued, not just the last one of one role.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)