Skip to content

fix(e2e): member-memory legacy V1 spec -- stale page idles the slot under a deep-link send - #19263

Merged
iamwhatever merged 1 commit into
mainfrom
unflaky/member-memory-legacy-v1-send
Oct 12, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
unflaky/member-memory-legacy-v1-send

Conversation

@CrysisDeu

@CrysisDeu CrysisDeu commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A message sent right after opening a chat by link keeps the chat busy until the reply comes.

Open a session by link (/chat?sid=…) and send at once. For a few seconds the composer stops saying Message … and says Last turn was interrupted — press Resume, or just type instead, while the reply is on its way. The E2E spec member-memory.spec.ts:396 › a legacy configured default member keeps V1 … does exactly this and fails at line 440: getByPlaceholder(/message/i) finds no element for 5 s, then the spec passes on a retry, which the zero-flaky ceiling turns into a red job. Seen on two unrelated heads that both already carry #18658: run 38128323368 (head dbc9c3e) and head 09c21fe (fix/8683-stdin-redirect-scan).

Why it matters

A composer that says the turn was interrupted, right after you sent, tells you your message failed. People press Resume or send 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

  • The E2E harness: no retry, timeout or ceiling change.
  • The spec: unchanged. It is right to expect its placeholder to stay.
  • How the gateway announces a turn start over the socket.

What changed (motivation → approach → change)

Opening a slot runs switchSlot. pending makes the composer live and sends the page fetch. A send made in that window opens a turn: startLocalTurn marks the slot running and pending. The page was read before the send, so it says running: false. #18658 made fulfilled keep the sent row; it still copied the page's run verdict, so slotRunning went false and pendingTurnSlot was cleared under a turn the server was already running. "User row last, slot idle" is the shape selectContinuable offers Resume on, so ChatInput swapped its placeholder. Nothing re-asserted the run until the reply's first chunk; a slots frame saying running that landed before the page was overwritten with it.

switchSlot.fulfilled (website/src/store/chat/slotSwitch.ts) now treats an idle page that does not carry a live send (liveSends, the rows #18658 keeps) as read before that send. For such a page it leaves the run state alone: slotState, slotRunning, slotStopping, pendingTurnSlot and the chunk floor stay what the send, a live slots frame or a chunk set. A page that reports running, or one that already carries the send, lands exactly as before. Kept, not forced: a send whose POST was refused (endLocalTurn) stays idle.

The other reducer that replaces the view from a page, the reconnect / end-of-turn refresh in slotRefresh.ts, is left as is: it has no live-send baseline at all (it drops the row too), so its fix is the whole pair and is tracked in #19267.

Backwards compatibility

Compatible: one condition in one reducer branch; every switchSlot.fulfilled with no send during the fetch (liveSends empty) writes the same state as before.

Removes nothing: additive guard only.

Tests

  • website/src/test/chatSlice.switchSlotLiveSend.test.ts: an idle page that predates the send leaves the slot running and pending and selectContinuable false; the same after a live slots frame confirmed the turn (pending mark already retired); a chunk floor raised during the fetch survives the page; a refused send is not revived; a page that caught the send takes its idle verdict; a running page lands as before. On the parent tree the first three cannot pass: fulfilled writes slotRunning = false and lastChunkSeq = undefined there.

Manual verification

N/A — unit coverage sufficient: the symptom is a pure reducer outcome (slotRunning/pendingTurnSlot after switchSlot.fulfilled), and the placeholder is derived from it by existing selectors with their own tests. The E2E spec on CI is the integration check.

Screenshots / video

Why no screenshot: no layout, copy or style changes; the composer keeps the placeholder it already showed, where before it swapped to the interrupted-turn one for a few seconds.

Related Issues

Closes #19260

Pattern harvest

Rule candidate: review-prompt
Pattern: a reducer that replaces a view with a fetched snapshot must carry forward every local state the user established after the fetch was issued — rows AND run state — not one of them.

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

@CrysisDeu
CrysisDeu requested review from a team and KiroCrewCaptain as code owners October 12, 2026 04:24
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 12, 2026
@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

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

UX-Verdict: PASS

Check that the member-memory E2E spec passes on its first try. That is the only thing showing the composer keeps its "Message …" placeholder after a send from a chat opened by link.

[UX-REVIEWED] 235b02a

Description read

[DESCRIPTION-READ] a2473bd9c4de025687cfd5d3cb5df3bb0b10459d6291993291acda4f6f7ed4a7

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 .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 12, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 235b02a0bb6380a2ca5961b59cefc2477b8a7864 — 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 member-memory.spec.ts:396 passes on this head's E2E run with no retry. That spec is the only integration evidence for the fix.

What this change ships

Inventory (3 items) — 3 justified

Intent: after opening a chat by link and sending right away, the chat stays busy until the reply arrives, instead of briefly offering Resume. This is a FIX (closes #19260; three of the added tests fail on base).

  1. When an idle page fetched before a deep-link send lands, the slot stays running and pending, so the composer keeps its "Message …" placeholder — justified
  2. A chunk floor raised by the reply during the fetch survives that stale page instead of being cleared — justified
  3. A page that already carries the send, or that reports running, sets the run state exactly as before, and a refused send stays idle — justified

[FIRST-PRINCIPLES-REVIEWED] 235b02a

Description read

[DESCRIPTION-READ] 6d966ce349361c80f98816a962cd2fd37c3a5c4b88f6310274932b1e65b4b774

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 12, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Check one race: an idle page that misses the send, landing after the turn's own done frame, must leave the slot idle, not keep it running.

[DESIGN-REVIEWED] 235b02a

Description read

[DESCRIPTION-READ] 5780a360d9f10a69942f8f271005f32e77b93ed418a2260050bf79648bf7ea8b

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 12, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 235b02a0bb6380a2ca5961b59cefc2477b8a7864 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 235b02a

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

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 235b02a0bb6380a2ca5961b59cefc2477b8a7864 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 235b02a

Verdict parsed from the review's SHA-scoped output markers for commit 235b02a0bb6380a2ca5961b59cefc2477b8a7864.

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

@CrysisDeu

Copy link
Copy Markdown
Contributor Author
  • accepted-and-deferred — span=0deff587df34 refresh sibling (slotRefresh.ts run verdict)

The refresh path is a different fetch with a bigger gap: it has no live-send baseline at all, so a send during that fetch loses its ROW as well as its run state (switchSlot got the row half in #18658; this PR adds the run-state half on that same baseline).
Guarding only the run verdict there would leave a vanished bubble on a busy slot; the honest fix is the whole pair (baseline + liveSends + guard), which is beyond this PR's frozen goal (the deep-link open).
Tracked in #19267 (deferred-finding, assignee, Due 2026-10-26); the PR description names the refresh path as left as is.

@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 12, 2026
@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in website/src/store/chat/lifecycle.ts, website/src/store/chat/state.ts, test/test_chat_handlers_composition_contract.py, test/test_chat_persistence_composition_contract.py since this head went green (d6341a8 -> 8f6baa0); CI re-running.

@CrysisDeu
CrysisDeu force-pushed the unflaky/member-memory-legacy-v1-send branch from cf5d9f3 to 63acb42 Compare October 12, 2026 05:32
@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 12, 2026
@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Main is red on this head's base (8f6baa0) in two jobs this PR does not touch, same jobs fail on main run 38207918790: Frontend Tests (4) (FilePathMenu.inApp.test.tsx, tracked in #19282) and Backend Tests (Windows) (1) (test_app_cron_timeout_manifest.py, fix in flight: #19280). This PR waits for those fixes to land, then rebases; no override, no rerun.

@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
@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Rebased onto main 0a47021, which carries both main-red fixes (#19280, #19288); CI re-running.

@CrysisDeu
CrysisDeu force-pushed the unflaky/member-memory-legacy-v1-send branch from 63acb42 to 235b02a Compare October 12, 2026 08:07
@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 iamwhatever 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.

This PR fixes the composer switching to the "Last turn was interrupted" placeholder right after a deep-link send. The cause was switchSlot.fulfilled copying running: false from a page that was read before the send. Now an idle page that does not carry a live send (liveSends) leaves slotState, slotRunning, slotStopping, pendingTurnSlot and the chunk floor as the send, a live slots frame or a chunk set them. I read the reducer around the change. The slotState assignment moved below the message merge, with no early return in between, so every path still sets it, and a fetch with no live send writes exactly the old state. I tried to make it revive or stick a turn. A send whose POST was refused stays idle, because endLocalTurn already set that. A page that caught the send, or reports running, lands as before. A chunk floor raised during the fetch survives. Each of these is a test, and the first three cannot pass on the parent tree. The other refresh reducer (slotRefresh.ts) is left alone and tracked in #19267, which is the right scope. Checks are green and all three lanes PASS. — crew-pr-reviewer (deep re-check)

@iamwhatever
iamwhatever enabled auto-merge (squash) October 12, 2026 17:19
@iamwhatever
iamwhatever merged commit b679439 into main Oct 12, 2026
102 checks passed
@iamwhatever
iamwhatever deleted the unflaky/member-memory-legacy-v1-send branch October 12, 2026 17:20
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 12, 2026
mbriones98 pushed a commit to mbriones98/KiroCrew that referenced this pull request Oct 12, 2026
…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
mbriones98 pushed a commit that referenced this pull request Oct 12, 2026
…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
mbriones98 pushed a commit that referenced this pull request Oct 12, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants