Repository navigation
fix(dashboard): run a requeued steer on its own row instead of a duplicate - #18517
Conversation
dbe49b6 to
0d12b30
Compare
|
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 No code or test logic changed. |
UX Review (Opus 5.5, fork) — ✅ PASSUX-level review of 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
[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 |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of 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 shipsInventory (9 items) — 9 justifiedIntent: when a steer is requeued because the turn ended first, the user's message appears once in the transcript instead of twice. FIX.
[FIRST-PRINCIPLES-REVIEWED] a22dcfe Description read[DESCRIPTION-READ] 1243fedc9df61ed23e259a29da91e640e520e5e75cad00aed3419a0346b447d1 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of 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
[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 |
GPT 6.1 Review (fork) — ✅ no blocking findings (all downgraded on adjudication)Reviewed 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 detailsBLOCKING -- website/src/store/chat/transcript.ts:325 -- Text fallback resurrects a drained steer after queue reordering
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 |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
|
span=1214d080c01b
|
|
span=861c010be78e
|
|
span=ccf40a7ee24a
|
|
span=e1ab3d4f6840
|
|
span=e3c7c6fc76e8
|
0d12b30 to
8c770f4
Compare
|
span=31b44c64a08f
|
|
span=8d3da0b34990
The finding held, and the same gap existed in a third reducer, so I closed all of them at once.
A dropped page is older than what the tab already shows, and a later warm, switch or refresh replaces it. |
|
span=6bc96aa502a2
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.
|
iamwhatever
left a comment
There was a problem hiding this comment.
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)
|
@iamwhatever thought (non-blocking): carrying a mid on queue_pop The 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. |
|
@iamwhatever chore (non-blocking): the two deferred UX items are now upstream issues, each with its own fix PR
Both issues carry the This PR also needs a rebase onto main for the steer take-back change in #23388, which added a |
bolichen97
left a comment
There was a problem hiding this comment.
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).
|
@bolichen97 rebased onto main as |
@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? |
|
@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:
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. |
|
Maintainer decisions on the two open findings at 378e370:
|
|
span=f0a7e4ee70c7
A row that carries the matching Tests in
|
|
span=2a8715274e8d
A page that shows the steer Test: "keeps a same-text send on a page read before the requeue" in |
|
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. |
|
span=d0cfad1260e9
Tests:
|
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
left a comment
There was a problem hiding this comment.
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.pygoes 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
queueAfterSupersededDrainsame-text fallback also still needs a disposition. - The new functions in
transcript.tssit betweenpreserveSettledUpsertRowsand its JSDoc. Moving them above that doc block would fix it.
|
note (non-blocking): the same-text fallback in The fallback runs only when three things are true. The page shows the steer 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 |
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
UserMessagedraws that label forsupersededas well asrequeued.nudgerow and the drainednudgerow both stay drawn, as on main. A follow-up extends the retirement and the client helpers tonudgerows 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_consumedecho, the requeue marks that rowrequeuedand 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
midon 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 rowsteerState: "superseded", names the new row'smidon it assupersededBy, and broadcastschat_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'sdecisions_stripreceipt,quoteand Shared Crewauthor, 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
userrow with the same text, matched bysupersededByor, in a live tab whose rebuilt row has nomidyet, 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.pytreatssupersededlikerequeued, anddocs/system-specs/modules/session.mdsays so.Because a superseded row is hidden, the steer lifecycle keys are now gateway-only.
api_chatdropssteer,steerState,supersededByandrequeued_steer_row_midfrom a caller'smetawith the existingRESERVED_ROW_META_KEYSgate, so a caller cannot hide the only row of a prompt that ran. Clients send a steer as the top-levelsteerflag, so no client send changes.Every client reader of the transcript follows the same rule through one helper,
supersededSuccessorIdxingroupDisplayItems.ts:?msg=&mid=link saved against the old row lands on the drawn row (drawnSuccessorIdx).refreshSlot,warmSlotCacheandswitchSlotkeep 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_popno longer matches a persisted steer row bysendId, 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
supersededsettles likerequeuedinuseSteerRetract, so nothing goes back into the composer.Backwards compatibility
Compatible:
supersededis 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
supersededfrom 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
writtenrows, so a superseded row is never patched againReader: 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
supersededlikerequeued(_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 putsteer,steerState: "superseded"andrequeued_steer_row_midinmetaland 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 aninjectrow, and the old user row staysrequeued. It failed before the_drains_as_userguard.website/src/store/chat/queue.steerReceipt.test.ts: thequeue_poprebuild keeps thedecisions_stripreceipt and drops a non-object value. It failed beforequeueEntryDecisionStrip.test/test_interrupted_turn_steers.py: asupersededsteer is walked past and not carried, and the not-taken states are pinned to the dashboard'sSTEER_STATE_REQUEUEDandSTEER_STATE_SUPERSEDED. Both failed before the replay change.test/test_chat_runner_base_surface.py: the pinned signature of_mark_steer_row_statenow returns the patched row'smid.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 servermidis 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 bymidor 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 steerwrittenorrequeuedare dropped, and a page that agrees it is superseded applies. Each failed with its guard removed.website/src/store/chat/queue.steerReceipt.test.ts: aqueue_popwhosesendIdmatches 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 thechat_message_updateframe both carrysupersededByset to the fresh row'smid.test/test_steer_requeue.py::TestRequeuedSteerShowsOnce, two tests: the old row's serverauthormoves to the fresh row and thequeue_popframe, and an edited card carries nothing.website/src/store/chat/queue.steerReceipt.test.ts, two tests: the rebuilt row keeps a validauthorfrom 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 stillsuperseded. 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'squeue_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'smiddoes not hide the prompt, a steer row with the same text andmidis not accepted, and a falsemidmatch 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 rowsuperseded. Both cases failed before theuseSteerRetractchange.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_steersand_start_next_queued_turn.Screenshots / video
The sheet below draws the same rows at five moments with the real
UserMessageandStopEventCard, filtered through the realisSupersededSteerRow. Frame 1 is the steer row markedrequeuedabove 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 thequeue_popframe the client rebuilds it from.website/scripts/capture-steer-requeue-superseded.mjsasserts 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 onesteer-decision-lineand onequote-card-sent, after the Stop card in frame 5.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.tsxmountsChatMessageListwith itsVirtualTranscriptand steps it through the four updates the gateway sends, in order: the steer typed while the turn runs, Stop landing with the row markedrequeued, the drain appending the queued turn's own row, and the drain marking the old rowsuperseded.website/scripts/capture-steer-requeue-live.mjscounts the bubbles carrying the steer text on every animation frame.temp-screenshots/steer-requeue-superseded/steer-requeue-live-bottom.webmfollows 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.webmstarts 1317 px above the bottom. The first visible row keeps display index 3 at offset -18 px withscrollTop383 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 correctsscrollTopafter it, on top of CSSoverflow-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.
[Stopped]card, where "Jev chose: interrupt this turn" reads as a decision about the new turn. fix(chat): say when a chosen steer ran as its own turn #31055 shows "Jev chose to interrupt, but this runs as its own message" on a row that no turn took, and "Jev chose to interrupt" on a requeued row that already shows the lifecycle line.The replay change and the shared
_SUPERSEDED_STEER_CARRIED_KEYStuple 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
writtenrowsPattern 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