Skip to content

fix(dashboard): run a requeued steer on its own row instead of a duplicate - #18517

Merged
bolichen97 merged 2 commits into
kirodotdev:mainfrom
Pearcekieser:fix/steer-requeue-duplicate
Nov 10, 2026
Merged

bolichen97 merged 2 commits into
kirodotdev:mainfrom
Pearcekieser:fix/steer-requeue-duplicate

Conversation

@Pearcekieser

@Pearcekieser Pearcekieser commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A message sent as a steer and requeued because the turn ended first is drawn once, not twice.

When a steer is accepted but the turn ends before it is consumed, the transcript shows the message twice. The original steer row is marked "runs as its own message", and an identical user row appears below the Stop card when the queued turn starts.

Why it matters

It looks like the user sent the message twice. A user who steers and then presses Stop hits it every time the stop lands before a tool call, and it makes the transcript an unreliable record of what was sent.

Not a goal

  • Changing what the model sees on replay. Both rows stay in the stored transcript, as on main.
  • Surfaces that render their own message lists without the shared turn grouping, such as the crew window, the member thread panel and the share export. They keep showing both rows, as on main, and the superseded row keeps its "runs as its own message" label there, because UserMessage draws that label for superseded as well as requeued.
  • Changing when a steer is requeued.
  • Automation steers, such as a work-ledger wake steered into a running turn (fix(dashboard): a work-ledger wake steered into a running turn stays a nudge row #22812). Their requeued nudge row and the drained nudge row both stay drawn, as on main. A follow-up extends the retirement and the client helpers to nudge rows after this merges.

What changed (motivation → approach → change)

The steer row is written when the RPC accepts the text. When the turn ends with no steering_consumed echo, the requeue marks that row requeued and queues the text, and the drain then writes the same text again as the new turn's own row. Nothing tied the queued entry back to the row that already held it.

The requeue now records the existing row's mid on the queue entry. The drain still writes its own row after the Stop card, so the turn has the same shape as any queued send. Once that row lands, the drain marks the old row steerState: "superseded", names the new row's mid on it as supersededBy, and broadcasts chat_message_update. The old row is retired only when the entry drained alone and the row still holds exactly the text that ran, so an edited or merged entry keeps both rows. The old row is the only row that holds the steer's decisions_strip receipt, quote and Shared Crew author, so the drain copies them onto the fresh row before it hides the old one.

The transcript grouping skips a superseded steer row only when the row that ran in its place is in the same list. That row must be a non-steer user row with the same text, matched by supersededBy or, in a live tab whose rebuilt row has no mid yet, by the text alone. So a caller that copies the id onto another row in a fork cannot hide the prompt. A view that cuts the successor off still draws the old row. The old row goes by a cut, not an animation. A maintainer accepted this in this comment, because the accent ring #31058 plays on the landed row marks where the message went. replay.py treats superseded like requeued, and docs/system-specs/modules/session.md says so.

Because a superseded row is hidden, the steer lifecycle keys are now gateway-only. api_chat drops steer, steerState, supersededBy and requeued_steer_row_mid from a caller's meta with the existing RESERVED_ROW_META_KEYS gate, so a caller cannot hide the only row of a prompt that ran. Clients send a steer as the top-level steer flag, so no client send changes.

Every client reader of the transcript follows the same rule through one helper, supersededSuccessorIdx in groupDisplayItems.ts:

  • Transcript search skips the hidden row and finds the drawn one.
  • A pin, quote or ?msg=&mid= link saved against the old row lands on the drawn row (drawnSuccessorIdx).
  • refreshSlot, warmSlotCache and switchSlot keep their newer view over a page that predates the drain (pageRegressesSupersededSteer). A switch still installs its paging cursor, and applies the page when its view is older. Each merges the page's queue without the drained steer's entry (queueAfterSupersededDrain).
  • queue_pop no longer matches a persisted steer row by sendId, so the drained row is always rebuilt. An optimistic steer bubble is still matched and replaced.

A pending take-back of a steer whose row is already superseded settles like requeued in useSteerRetract, so nothing goes back into the composer.

Backwards compatibility

Compatible: superseded is a new steer state. Rows on disk with the existing states render as before, and the queue key is popped before any row meta is written.

The diff hides a row from the transcript grouping:

Reader: website/src/pages/chat/groupDisplayItems.ts:groupDisplayItems -- chat -- skips the superseded row; groupDisplayItems.test.ts "does not draw a requeued steer once its own turn has written a row"
Reader: website/src/app-sdk/ChatMessageList.tsx:ChatMessageList -- app -- same skip, so app chat lists match the main transcript
Reader: website/src/hooks/useMessageSearch.ts:useMessageSearch -- chat -- skips the hidden row; useMessageSearch.test.ts "matches only the drawn successor row"
Reader: website/src/pages/chat/page/transcriptPins.ts:jumpToLoadedPinnedMessage -- chat -- lands on the drawn row; drawnSuccessorIdx.test.ts
Reader: website/src/pages/chat/page/transcriptJumps.ts:useTranscriptJumps -- chat -- a share link lands on the drawn row through the same helper
Reader: website/src/store/chat/slotRefresh.ts, slotSwitch.ts -- chat -- refresh, warm and switch drop a page that predates the drain; chatSlice.staleSnapshotRevertsCardSteer.test.ts
Reader: website/src/pages/chat/UserMessage.tsx:UserMessage -- chat -- excludes superseded from the confirmed steer badge in case a host draws the row anyway; such a host shows the requeued lifecycle line and #31055's short receipt, "Jev chose to interrupt"
Reader: src/kiro_crew/dashboard/chat_delivery.py:find_written_steer_row -- chat -- matches only written rows, so a superseded row is never patched again
Reader: src/kiro_crew/dashboard/state.py:is_turn_interrupted -- chat -- the newest user row is the fresh one after the Stop card, as on main; test_the_drain_supersedes_the_requeued_row checks the order
Reader: src/kiro_crew/dashboard/slot_persistence/turn_marker.py:_latest_turn_was_deliberately_stopped -- release -- same tail shape as main
Reader: model history replay -- chat, subagent, cron -- reads both rows, as on main; the change is display only
Reader: src/kiro_crew/context_assembly/replay.py:build_interrupted_turn_preamble -- chat -- treats superseded like requeued (_STEER_STATES_NOT_TAKEN), so a resumed turn never replays a superseded steer as [Steered mid-turn]; test_interrupted_turn_steers.py "a superseded steer is walked past but not carried"

Tests

  • test/test_steer_requeue.py::TestRequeuedSteerShowsOnce, five tests: the drain supersedes the requeued row, writes the fresh row after the Stop card without steer meta, runs the turn on it, and broadcasts the update. A peer steer is superseded too. An edited card keeps the requeued row. A steer requeued before any row existed, or whose row vanished, appends one row and supersedes nothing. Two of these fail with the retire call removed.
  • website/src/test/groupDisplayItems.test.ts: a superseded steer row is not drawn, and a still-requeued one is. The first fails with the skip removed.
  • test/test_steer_requeue.py::TestClientCannotStampSteerLifecycle, two tests: an idle send and a queued send that put steer, steerState: "superseded" and requeued_steer_row_mid in meta land with none of the three. The idle one fails without the reserved keys; the queued path already copies only allowlisted fields and is pinned so it stays that way.
  • test/test_steer_requeue.py::TestRequeuedSteerShowsOnce::test_a_steer_that_drains_as_an_event_keeps_its_user_row: typed text that opens with the cron notice prefix drains as an inject row, and the old user row stays requeued. It failed before the _drains_as_user guard.
  • website/src/store/chat/queue.steerReceipt.test.ts: the queue_pop rebuild keeps the decisions_strip receipt and drops a non-object value. It failed before queueEntryDecisionStrip.
  • test/test_interrupted_turn_steers.py: a superseded steer is walked past and not carried, and the not-taken states are pinned to the dashboard's STEER_STATE_REQUEUED and STEER_STATE_SUPERSEDED. Both failed before the replay change.
  • test/test_chat_runner_base_surface.py: the pinned signature of _mark_steer_row_state now returns the patched row's mid.
  • website/src/test/groupDisplayItems.test.ts: a superseded row whose successor is cut off, as in a fork, is still drawn, and one whose successor has its server mid is hidden. The cut-off case failed on the row-only rule.
  • website/src/test/useMessageSearch.test.ts: search matches only the drawn row, and matches the old row when its successor is cut off.
  • website/src/test/drawnSuccessorIdx.test.ts, five tests: a jump lands on the successor by mid or on the live rebuild by text, and keeps its target when the row is not superseded or the successor is absent.
  • website/src/test/chatSlice.staleSnapshotRevertsCardSteer.test.ts: refresh, warm and switch pages that still show the steer written or requeued are dropped, and a page that agrees it is superseded applies. Each failed with its guard removed.
  • website/src/store/chat/queue.steerReceipt.test.ts: a queue_pop whose sendId matches a persisted steer row still rebuilds, and one that matches an optimistic steer bubble replaces it. Both failed on the previous filter.
  • test/test_steer_requeue.py::TestRequeuedSteerShowsOnce: the stored old row and the chat_message_update frame both carry supersededBy set to the fresh row's mid.
  • test/test_steer_requeue.py::TestRequeuedSteerShowsOnce, two tests: the old row's server author moves to the fresh row and the queue_pop frame, and an edited card carries nothing. website/src/store/chat/queue.steerReceipt.test.ts, two tests: the rebuilt row keeps a valid author from the frame and ignores one that is not an object. The positive tests failed before the carry.
  • website/src/test/chatSlice.staleSnapshotRevertsCardSteer.test.ts: a switch that keeps its view installs the paging cursor. A switch whose view is older than the page applies it with the steer still superseded. In refresh, warm and both switch paths, the page's entry for the drained steer is dropped, an entry only the page lists stays, and the tab's own newer queued rows stay. A page read before the requeue drops nothing, so a send with the same text keeps its card. Where the tab saw the drain, the entry is dropped by the card's queue_id, so a same-text send moved ahead of it keeps its card. Each of these failed on the previous head.
  • website/src/test/groupDisplayItems.test.ts, three tests: a fork row with other text that carries the successor's mid does not hide the prompt, a steer row with the same text and mid is not accepted, and a false mid match is skipped so the real successor later in the list is found. All three failed before the content check.
  • website/src/test/useSteerRetract.test.ts: "takes nothing back for a edit/queue whose requeued row already ran as its own turn" covers a take-back that sees the row superseded. Both cases failed before the useSteerRetract change.
  • website/src/test/SteerDecisionLine.test.tsx, from fix(chat): say when a chosen steer ran as its own turn #31055: the superseded-row case now expects the short receipt, "Jev chose to interrupt", and checks that the row says "its own message" once, because this PR draws the requeued line on a superseded row.

Proof: not provable -- frontend test (prove.py runs Python only)

Each bullet above names the tests that failed without its change.

Manual verification

N/A. The race needs a Stop to land between the steer RPC and a tool call, which the unit tests reproduce directly through steer_into_running_turn, _requeue_unconsumed_steers and _start_next_queued_turn.

Screenshots / video

The sheet below draws the same rows at five moments with the real UserMessage and StopEventCard, filtered through the real isSupersededSteerRow. Frame 1 is the steer row marked requeued above the Stop card. Frame 2 is main today after the queued turn starts, with the text drawn twice. Frame 3 is this PR, with one bubble below the Stop card. Frames 4 and 5 repeat 1 and 3 for a steer that carried a decision receipt and a quote: in frame 5 both are drawn once, on the row below the Stop card, because the drain copies them onto that row and onto the queue_pop frame the client rebuilds it from. website/scripts/capture-steer-requeue-superseded.mjs asserts 1, 2, 1, 1 and 1 user bubbles, that the frame 3 bubble follows the Stop card, and that frames 4 and 5 each draw one steer-decision-line and one quote-card-sent, after the Stop card in frame 5.

Requeued steer, five moments, dark theme

Requeued steer, five moments, light theme

The move from frame 1 to frame 3 is a cut with no animation, and a maintainer accepted the cut in this comment. #31058, now merged, plays a 1.2 s accent ring once on the row the requeued steer lands on, so the reader sees where the message went. The requeued row already tells the reader "Turn ended before this applied, runs as its own message", so the bubble showing up below the Stop card as the next turn's opener is the outcome that label promised. The drain appends the fresh row before it broadcasts the hide, so the worst intermediate frame shows both bubbles for one update, never neither. Animating the old row into the new row's place would need a shared layout identity across rows of the virtualized VirtualTranscript, where either row can be unmounted offscreen, and that is a larger change than this bug fix.

Two recordings play the same change on the real virtualized transcript. website/capture/steer-requeue-live.tsx mounts ChatMessageList with its VirtualTranscript and steps it through the four updates the gateway sends, in order: the steer typed while the turn runs, Stop landing with the row marked requeued, the drain appending the queued turn's own row, and the drain marking the old row superseded. website/scripts/capture-steer-requeue-live.mjs counts the bubbles carrying the steer text on every animation frame.

  • temp-screenshots/steer-requeue-superseded/steer-requeue-live-bottom.webm follows the tail. The settled counts are 1, 1, 2 and 1, and none of the 435 sampled frames shows zero.
  • temp-screenshots/steer-requeue-superseded/steer-requeue-live-scrolled.webm starts 1317 px above the bottom. The first visible row keeps display index 3 at offset -18 px with scrollTop 383 through all four steps.

Hiding the row does not move a reader who has scrolled. The old row sits directly above the Stop card at the transcript tail, so a reader with it above the viewport is at the bottom, where follow-the-tail pins the position. A reader who is not pinned is held by useVirtualChat's anchor-preservation pass, which captures the top visible row's offset before the commit and corrects scrollTop after it, on top of CSS overflow-anchor: auto.

Deferred follow-ups

The UX review deferred two items. Each one got its own upstream issue and its own fix PR, and both have merged.

The replay change and the shared _SUPERSEDED_STEER_CARRIED_KEYS tuple that were deferred on 9a68aef are in this PR now.

Related Issues

Fixes #18516

Sibling sweep

Swept: git grep -n -E "STEER_STATE_REQUEUED|steerState === 'requeued'|steerState !== 'requeued'" -- src website/src
Sibling: src/kiro_crew/context_assembly/replay.py -- changed here
Sibling: website/src/pages/chat/UserMessage.tsx -- changed here
Sibling: src/kiro_crew/dashboard/chat_turn/queue_drain.py -- changed here
Sibling: src/kiro_crew/dashboard/chat_delivery.py -- not affected -- find_written_steer_row matches only written rows

Pattern harvest

Rule candidate: review-prompt
Pattern: a requeue or retry path that hands content back to a writer must carry the identity of the row already written for it, or the writer appends a twin.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title
  • 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

@Pearcekieser
Pearcekieser requested review from a team and KiroCrewCaptain as code owners October 9, 2026 16:22
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 9, 2026
@Pearcekieser
Pearcekieser force-pushed the fix/steer-requeue-duplicate branch from dbe49b6 to 0d12b30 Compare October 9, 2026 17:58
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

chore (non-blocking): Comment History Gate fix, comment-only reword

The Fast Gate failed on dbe49b6 because the Comment History Gate flagged two added comments that read "the old row no longer says what runs", in chat_runner.py and test/test_steer_requeue.py. Both now read "holds different text from what runs". Await Fast Gate and Coverage Gate failed only because they depend on the Fast Gate. Coverage failed closed when frontend-test was skipped.

No code or test logic changed. check_comment_history.py passes locally against the merge-base. Head is now 0d12b30.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ✅ PASS

UX-level review of a22dcfed2f209450ace840dcfd7146dac0b8472f via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

The screenshots show every state. The stated cut is the old row disappearing and the message reappearing below the Stop card; a maintainer accepted it in the linked comment, and recordings exist. No first-time reader has looked, because this fork lane has no blind read; pushing the branch to this repository adds one.

Notes

  • Steps 2→3 move the message from above the Stop card to below it, and the receipt and quote move with it. That cut is accepted, but a reviewer should watch steer-requeue-live-scrolled.webm to confirm a reader who has scrolled up doesn't see the content jump. The anchor-stability check in the capture script is the only proof of that so far.

[UX-REVIEWED] a22dcfe

Description read

[DESCRIPTION-READ] 72f45f843b2799d1280f8e4a48ee7cadc01c83b39210278f481bb3dc9079addd

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 .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, fork) — ✅ PASS

Premise-level review of a22dcfed2f209450ace840dcfd7146dac0b8472f via the fork AI-review pipeline — 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 does not.

First-Principles-Verdict: PASS

Nothing blocks. The fix hides a duplicate the gateway already writes. The tests in this PR show the defect on base. Stored history is unchanged.

What this change ships

Inventory (9 items) — 9 justified

Intent: when a steer is requeued because the turn ended first, the user's message appears once in the transcript instead of twice. FIX.

  1. A requeued steer's text is drawn once after its queued turn starts — justified
  2. Search, pins, quotes and share links aimed at the old row land on the drawn row — justified
  3. Refresh, warm and switch with an older page no longer bring back the duplicate or a dead queued card — justified
  4. The drawn row now carries the steer's decision receipt, quote and Shared Crew byline — justified
  5. A caller can no longer set steer lifecycle keys through api_chat meta — justified
  6. A resumed interrupted turn does not replay a superseded steer as a redirect — justified
  7. Taking back an already-superseded steer settles without returning text to the composer — justified
  8. A surface without the shared grouping shows the requeued line and the short receipt on the old row — justified
  9. Capture pages, scripts and webm recordings committed for UX review — justified

[FIRST-PRINCIPLES-REVIEWED] a22dcfe

Description read

[DESCRIPTION-READ] 1243fedc9df61ed23e259a29da91e640e520e5e75cad00aed3419a0346b447d1

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

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of a22dcfed2f209450ace840dcfd7146dac0b8472f via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the drain links the drained turn's row back to the requeued steer row and hides the old row only while that row is in view, and the rendered evidence covers this revision.

Notes

  • The client-side staleness handling (pageRegressesSupersededSteer, queueAfterSupersededDrain, three reducer branches) costs more than the server change does. Any future steer state that hides a row should reuse this one helper rather than add a fourth branch.
  • _SUPERSEDED_STEER_CARRIED_KEYS copying is written twice in queue_drain.py, once for the queue_pop frame and once for the row. A single helper would stop the two copies drifting apart when a key is added.

[DESIGN-REVIEWED] a22dcfe

Description read

[DESCRIPTION-READ] e1cce5068b632e6c2cbe668213e225c19b522856c4046849b660ccd34bbd568c

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

GPT 6.1 Review (fork) — ✅ no blocking findings (all downgraded on adjudication)

Reviewed a22dcfed2f209450ace840dcfd7146dac0b8472f via the fork AI-review pipeline; updated in place on each push.

Opus 5.5 adjudication downgraded every blocking finding. Downgraded: the remedy each one needs is disproportionate to the harm it prevents. Adjudication downgraded all 1 blocking finding(s): the remedy each one requires is disproportionate to the harm it prevents.

Review details

BLOCKING -- website/src/store/chat/transcript.ts:325 -- Text fallback resurrects a drained steer after queue reordering

else drained.set(m.content, (drained.get(m.content) ?? 0) + 1)
Trigger: Move another same-text queued send ahead of a requeued steer while the queue is held, and start a refresh. Run the steer alone with “Run now”, then switch away and back before that refresh resolves. The switch installs the persisted successor without landedFromSteer; the delayed refresh calls queueAfterSupersededDrain, which removes the other send instead of the drained steer.
Outcome: hydrateQueuedBubbles reinstalls the drained steer's stale queue card beside its executed row, displaying the message twice; Edit and Cancel on that card return 404.
Anchor: defect
Fix: Identify the drained entry using its durable sendId; retain its queue ID for sends without one instead of falling back to the first same-text entry.

[BLOCK-MERGE-DOWNGRADED] a22dcfe
[GPT-REVIEWED] a22dcfe

Adjudication (Opus 5.5) — is blocking on each finding proportionate?

F1 — Harm is LOW. It needs several things at once: two queued sends with the same text, one moved ahead of a requeued steer while the queue is held, then "Run now", then a switch away and back while a refresh is still in flight. All of that has to pass the pageRegressesSupersededSteer gate (patch slotRefresh.ts:1674, slotSwitch.ts:1730). After that, the text fallback at transcript.ts:325 drops the wrong entry, and hydrateQueuedBubbles(..., true) shows the stale card (queue.ts:77-111). The result is visible, not silent: a second card whose Edit and Cancel return 404. It fixes itself on the next refresh. A refresh whose page shows the row superseded takes the normal path at slotRefresh.ts:571, and hydrateQueuedBubbles(list, queue) with preserveLiveQueue=false rebuilds every queued row from the server listing (queue.ts:90,94,102).
The real fix costs more than this rare, self-correcting glitch is worth. It means carrying the steer's sendId onto the requeued queue entry, the superseded row and the listing, and adding a third identity tier to a function that already matches on landedFromSteer id and then on text.

[ADJUDICATION] a22dcfed2f209450ace840dcfd7146dac0b8472f total=1 uphold=0 downgrade=1
DOWNGRADE F1 website/src/store/chat/transcript.ts:325 reason=disproportionate-remedy
[GPT-ADJUDICATED] a22dcfed2f209450ace840dcfd7146dac0b8472f

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed a22dcfed2f209450ace840dcfd7146dac0b8472f via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] a22dcfe

@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 9, 2026
@Pearcekieser

Pearcekieser commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor Author

span=1214d080c01b
note (non-blocking): could look like the steer was dropped

Outcome: addressed in the PR description and 8c770f4.
The text never leaves the screen: the fresh row lands first and opens the next turn, with that turn's activity under it, before the old row is hidden. The requeued label shown in frame 1 tells the reader it runs as its own message. The PR description now has a Screenshots section with the cut's stated reason and a still sheet of the three moments, built from the real UserMessage, StopEventCard and isSupersededSteerRow. Commit 8c770f4 adds the capture page and a runner that asserts 1, 2 and 1 user bubbles and that the fix frame's bubble follows the Stop card.

@Pearcekieser

Pearcekieser commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor Author

span=861c010be78e
note (non-blocking): cause of the cut

Outcome: addressed in the PR description and 8c770f4.
Accurate. The chat_message_update broadcast flips the old row to superseded and both list builders skip it. That is the intended mechanism. The PR description now has a Screenshots section with the cut's stated reason and a still sheet of the three moments, built from the real UserMessage, StopEventCard and isSupersededSteerRow. Commit 8c770f4 adds the capture page and a runner that asserts 1, 2 and 1 user bubbles and that the fix frame's bubble follows the Stop card.

@Pearcekieser

Pearcekieser commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor Author

span=ccf40a7ee24a
note (non-blocking): severity medium

Outcome: addressed in the PR description and 8c770f4.
Agreed on frequency. Main today draws the text twice in this exact case, which is the trust problem this PR fixes; frame 2 of the sheet shows it. The PR description now has a Screenshots section with the cut's stated reason and a still sheet of the three moments, built from the real UserMessage, StopEventCard and isSupersededSteerRow. Commit 8c770f4 adds the capture page and a runner that asserts 1, 2 and 1 user bubbles and that the fix frame's bubble follows the Stop card.

@Pearcekieser

Pearcekieser commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor Author

span=e1ab3d4f6840
note (non-blocking): animate or state a reason

Outcome: addressed in the PR description and 8c770f4.
Took the second option. The description now states why the cut is used: a shared layout identity would have to span rows of the virtualized VirtualTranscript, where either row can be unmounted offscreen, which is a larger change than this fix. The PR description now has a Screenshots section with the cut's stated reason and a still sheet of the three moments, built from the real UserMessage, StopEventCard and isSupersededSteerRow. Commit 8c770f4 adds the capture page and a runner that asserts 1, 2 and 1 user bubbles and that the fix frame's bubble follows the Stop card.

@Pearcekieser

Pearcekieser commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor Author

span=e3c7c6fc76e8
note (non-blocking): no exit animation

Outcome: addressed in the PR description and 8c770f4.
The cut is deliberate and the reason is now stated in the description. The requeued row already reads "Turn ended before this applied, runs as its own message", so the bubble showing up below the Stop card is the outcome that label promised. The drain appends the fresh row before it broadcasts the hide, so the worst intermediate frame shows both bubbles for one update, never neither. The PR description now has a Screenshots section with the cut's stated reason and a still sheet of the three moments, built from the real UserMessage, StopEventCard and isSupersededSteerRow. Commit 8c770f4 adds the capture page and a runner that asserts 1, 2 and 1 user bubbles and that the fix frame's bubble follows the Stop card.

@Pearcekieser
Pearcekieser force-pushed the fix/steer-requeue-duplicate branch from 0d12b30 to 8c770f4 Compare October 9, 2026 18:28
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 9, 2026
@Pearcekieser

Pearcekieser commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor Author

span=31b44c64a08f
issue (non-blocking): stale docstring in _mark_steer_row_state

Outcome: Fixed in the next commit. The docstring now says the drain, after it appends this turn's own row, marks this row superseded so the client draws the text once.

@Pearcekieser

Pearcekieser commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor Author

span=8d3da0b34990
issue (blocking): every snapshot reducer now drops a page that predates the drain

Outcome: fixed in 646fe81.

The finding held, and the same gap existed in a third reducer, so I closed all of them at once. pageRegressesSupersededSteer was only called from refreshSlot.fulfilled. There are three reducers that write a fetched transcript page, and now all three run it before they merge:

  • refreshSlot.fulfilled checks against the active view, which is unchanged.
  • warmSlotCache.fulfilled checks against slotMessages[key], the background pane's cache, right after the active-slot guard.
  • switchSlot.fulfilled checks against the view that pending restored, right after its active-slot guard.

A dropped page is older than what the tab already shows, and a later warm, switch or refresh replaces it. chatSlice.staleSnapshotRevertsCardSteer.test.ts adds one warm test and one switch test. Each holds a stale page showing the steer as requeued or written against a cache that already retired it. Both failed with their guards removed.

@Pearcekieser

Pearcekieser commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor Author

span=6bc96aa502a2
issue (blocking): the queue_pop match skips only persisted steer rows, not the optimistic bubble

Outcome: fixed in 646fe81.

The finding held. The filter from 450e7cc also skipped the optimistic steer bubble, which is still the placeholder for that send when the steer races the end of its turn before any row is persisted. removeQueuedMessage now excludes only meta.steer rows that are not optimistic, as you suggested. An optimistic bubble is matched and spliced as before, and a persisted steer row still makes the reducer rebuild.

queue.steerReceipt.test.ts adds that race: a lone queue_pop whose sendId matches an optimistic steer bubble. It now leaves one non-optimistic row, and it failed on the previous filter with two. The persisted-row test from 450e7cc still passes. tsc and i18n are clean, and all 4 frontend shards pass apart from MarkdownRenderer.domGolden, which fails the same way locally and is not in this diff.

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

Requesting changes at 646fe81. Only the tracking is left.

The fix still looks sound. A requeued steer row is superseded only when its entry drains alone with identical text, and only after the new row is appended (queue_drain.py#L1108-L1109). The new lifecycle keys are reserved from caller meta (chat_handlers.py#L589-L606). The Design and First Principles questions from r116 have replies. Every blocking GPT/Opus finding on the later heads has a disposition, all current-head lanes pass, and CI is green.

Still open from r116: the two deferred UX items (the receipt below [Stopped], and the bubble moving by cut) are tracked only in Pearcekieser#46 and #47 on your fork. The description says an upstream issue needs a PR, but you opened several kirodotdev/KiroCrew issues today. Please open one issue per item in kirodotdev/KiroCrew and link each one under Deferred follow-ups, or fix them here.

Non-blocking: the Design lane suggests carrying the old row's mid on queue_pop so the client can drop its text-match and stale-page heuristics. A short reply is enough.

Reviewed head: 646fe81

— crew-pr-reviewer (r120)

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

@iamwhatever thought (non-blocking): carrying a mid on queue_pop

The queue_pop frame is broadcast before the drain appends its row, so the successor has no server mid yet when the frame goes out. To put it on the frame, the drain would have to mint the mid first and hand it to slot.append, which changes the order between the pop and the row write. The text match only runs when supersededBy names a row that is not loaded, and the stale-page guard would still be needed for pages fetched before the drain. I would rather do that reordering as its own change than add it to this fix.

The two UX items are still waiting on a decision from Pearce: open them upstream or fix them here. I will link whichever it is under Deferred follow-ups.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

@iamwhatever chore (non-blocking): the two deferred UX items are now upstream issues, each with its own fix PR

Both issues carry the deferred-finding label and a Due: 2026-11-20 line. The account cannot set an assignee here. Both fixes work on main without this PR, so they can merge in either order. The Deferred follow-ups section of this description now links all four.

This PR also needs a rebase onto main for the steer take-back change in #23388, which added a retracted state in the same code. The rebase is ready, superseded joins requeued and retracted in the not-taken set, and it goes up when a fork CI slot frees.

bolichen97
bolichen97 previously approved these changes Nov 8, 2026

@bolichen97 bolichen97 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.

Approving at fff1394. A steer that is accepted but requeued because the turn ended first is now drawn once: its original row is marked superseded only when its entry drains alone with the same text, and only after the new row is appended. Replay skips superseded steers, and the new lifecycle keys are reserved from caller meta. No regex is added, and all checks pass.

@iamwhatever, could you re-review? Your change request at 646fe81 left only the tracking of the two deferred UX items. They are now upstream issues with the deferred-finding label and a due date: #31054 (the receipt below [Stopped], fixed by #31055) and #31057 (the row a requeued steer lands on, fixed by #31058).

iamwhatever
iamwhatever previously approved these changes Nov 8, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor

@bolichen97 rebased onto main as aff7b2a0a (only a rebase; conflicts in queue_drain.py, queue.ts and wire.ts kept both sides). The push dropped your approval at fff139412; could you re-approve once CI is green?

@iamwhatever

Copy link
Copy Markdown
Contributor
  • fixed: a pending take-back that only sees superseded restores the steer to the composer (queue_drain.py:194 / useSteerRetract.ts:400)

fixed in 378e370. useSteerRetract now settles a take-back whose row is superseded the same way as requeued: the requeued steer already ran as its own drained turn, so nothing goes back into the composer.
Test: takes nothing back for a edit/queue whose requeued row already ran as its own turn in useSteerRetract.test.ts; both cases fail on aff7b2a and pass on this head.

@bolichen97 this head adds that one follow-up commit on top of the rebase, so it is not only a rebase any more. Could you re-approve once CI is green?

@iamwhatever

Copy link
Copy Markdown
Contributor

@Pearcekieser @bolichen97 after the take-back fix (378e370), two new blocking findings landed in the same superseded-row mechanism, so I am stopping here rather than starting another fix round:

  • needs-a-decision: The superseded steer row is dropped, not moved (UX BLOCK)

The old bubble unmounts (isHiddenSupersededSteer in groupDisplayItems.ts / ChatMessageList.tsx) while its successor appears below the Stop card, with no transition. Options: animate one element between the slots (shared layoutId keyed on supersededBy), or state in the description why a cut is acceptable. That is a product call.

  • needs-a-decision: Caller-supplied IDs can hide an unrelated forked prompt (groupDisplayItems.ts:118)

A successor is matched by meta.mid alone; in a fork, a caller can send a message whose mid equals the copied row's supersededBy and hide the original prompt. GPT's suggested fix: accept an ID match only from a non-steer user row with the same content. GPT's adjudication stage failed to run on this head, so the finding was not weighed for proportion.

Both sit in the hide-and-redirect logic this PR adds, so the author should pick the shape for that logic before the next round.

@bolichen97

Copy link
Copy Markdown
Contributor

Maintainer decisions on the two open findings at 378e370:

  1. UX, the superseded steer row is dropped, not moved: accept the cut. The row the requeued steer lands on already plays the accent ring from fix(dashboard): flash a requeued steer's own row once when it lands #31058 (Requeued steer bubble moves by cut, with no transition, when its own turn starts #31057), and that marks where the message went, so no shared-element animation in this PR. Please say so in the description, under the superseded-row behaviour, and link fix(dashboard): flash a requeued steer's own row once when it lands #31058. The UX block can then be cleared with an owner-decision override that links this comment.
  2. GPT, a caller-supplied id can hide an unrelated forked prompt: fix it as suggested. In groupDisplayItems.ts, accept a supersededBy match only from a non-steer user row whose content equals the superseded row's. Add a fork test where a different message carries the matching mid and the original prompt stays visible.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

span=f0a7e4ee70c7

fixed in 6e9fdb9: supersededSuccessorIdx in website/src/pages/chat/groupDisplayItems.ts accepts a supersededBy match only from a non-steer user row whose text equals the superseded row's text, as bolichen97 decided in issuecomment-6726263401.

A row that carries the matching mid but fails the check is skipped, and the scan goes on, so a real successor later in the list is still found. The live-tab fallback, a non-steer user row with no mid and the same text, is unchanged. Grouping, search, pins and links all read this one helper.

Tests in website/src/test/groupDisplayItems.test.ts:

  • a fork row with other text that carries the successor's mid does not hide the original prompt
  • a steer row with the same text and mid is not accepted
  • a false mid match is skipped, and the real successor after it is found

All three failed on 378e370 and pass on f87509c.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

span=2a8715274e8d

fixed in 3f9e435: queueAfterSupersededDrain in website/src/store/chat/transcript.ts now drops a queue entry only when the page shows the steer requeued.

A page that shows the steer written was read before the requeue, so its queue holds no entry for the steer, and nothing is dropped. A send with the same text that the tab missed keeps its card, which is the trigger in this finding. A page that shows the steer requeued holds the steer's own entry at the queue head, because _requeue_unconsumed_steers inserts it at index 0, so the first entry with that text is the one that drained.

Test: "keeps a same-text send on a page read before the requeue" in website/src/test/chatSlice.staleSnapshotRevertsCardSteer.test.ts. It fails on f87509c and passes on 8667fc9.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in docs/system-specs/modules (connections, crew-mode, dashboard-token-auth, kas-auth), src/kiro_crew/dashboard (token_auth, token_auth_paths, handlers/connections, routes/agent_config) and five tests that import them since this head went green (7432436 -> 585058a); CI re-running.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

span=d0cfad1260e9

fixed in 1223f7b: the drain now carries the superseded steer row's server-stamped Shared Crew author with its receipt and quote.

MESSAGE_AUTHOR_META_KEY joins _SUPERSEDED_STEER_CARRIED_KEYS in src/kiro_crew/dashboard/chat_turn/queue_drain.py, so both readers take it: the queue_pop frame and the drained row that stays drawn. The value is copied as a new dict, and only when the target has no author of its own. On the client, removeQueuedMessage in website/src/store/chat/queue.ts keeps an author from the frame on the rebuilt row only when messageAuthor accepts it, so the byline survives both the live rebuild and a reload.

Tests:

  • test/test_steer_requeue.py::TestRequeuedSteerShowsOnce::test_the_author_moves_to_the_drawn_row and test_an_edited_card_does_not_carry_the_author
  • website/src/store/chat/queue.steerReceipt.test.ts: "keeps a valid author from the pop frame on the rebuilt row" and "ignores an author that is not an object"

Both positive tests failed on 08f0807 and pass on b2fb83e.

Pearcekieser and others added 2 commits November 10, 2026 00:09
A pending Edit or "Queue instead" take-back that first sees its row as
`superseded` fell through to the turn-ended branch and put the steer back in
the composer, although the requeued steer had already run as its own drained
turn. Treat `superseded` like `requeued`: settle without restoring
(Opus 5.5 on aff7b2a).

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified on a22dcfe: the drain hides the old requeued row only when four checks hold. The entry drained alone, it wrote a user row, the row is still a requeued user steer, and its text equals what runs. The successor row is written before the hide goes out, and replay treats superseded as not taken. The new backend tests drive the real steer, requeue, Stop and drain sequence, and removing the hide call fails 4 of them. The new tests have no sleeps, wall-clock reads or ports.
Security: adding steer, steerState, supersededBy and requeued_steer_row_mid to the reserved row-meta keys only narrows what a caller can stamp through /api/chat. No in-tree sender puts those keys in meta. The client hides a row only for a non-steer user successor with the same text.
Done well: when a check fails, the code falls back to what main does today, so the worst case shows the text twice and never loses a message.
Optional:

  • queue_drain.py goes from 1,545 to 1,675 lines. Moving the superseded-steer helpers and the carry loop, which is written twice, into a sibling module would bring it back under the 1,600 target.
  • Screenshot frames 4 and 5 show receipt wording from before #31055, which this head's tests forbid. Please re-capture them at this head. The queueAfterSupersededDrain same-text fallback also still needs a disposition.
  • The new functions in transcript.ts sit between preserveSettledUpsertRows and its JSDoc. Moving them above that doc block would fix it.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): the same-text fallback in queueAfterSupersededDrain stays. The size split and the doc-block move go to a follow-up PR.

The fallback runs only when three things are true. The page shows the steer requeued, the tab already holds that row superseded, and the tab has no landedFromSteer id for it. That happens after a refresh replaced the live rebuild with the stored row. Such a page was read after the requeue and before the drain. _requeue_unconsumed_steers puts the steer's entry at index 0, so the first queue entry with that text is the steer's own entry. The filter drops one entry for each retired row, so a same-text send queued later keeps its card. If the user moved a same-text card ahead of it before the page was read, the tab keeps the other of the two cards. The count and the text are still correct, so no message is lost or shown twice.

Frames 4 and 5 show the receipt text from before #31055. The tests on main pin the #31055 text, so only the frames are out of date.

The follow-up PR moves the superseded-steer helpers and the carry loop out of queue_drain.py into a sibling module, and moves the new transcript.ts functions above the preserveSettledUpsertRows doc block. It changes no behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Steer cut off by Stop shows the user message twice

4 participants