Repository navigation
fix(chat): scope file-change chips to the turn that made them - #14710
iamwhatever merged 1 commit into
Conversation
|
Intent: File-change chips from a turn that ended without its own assistant row land on that turn's synthetic anchor, not on the previous turn's answer. |
Design Review (Fable 5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Eyeball one live aborted file-changing turn: the chips-only empty bubble after the error row is unit-pinned but never seen rendered. Suggestions
[DESIGN-REVIEWED] b441fc2 Description read[DESCRIPTION-READ] 702f1c734b773d60416bb8fae367d1a82b29b455f6cd5f07e6893d2213225753 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Fable 5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS
Every load-bearing premise checks out on base: the front-trim exists ( What this change shipsInventory (8 items) — 8 justifiedIntent: FIX — chips from a turn attach to that turn's own reply, never an earlier answer or a foreign row (#14708, #14829).
[FIRST-PRINCIPLES-REVIEWED] b441fc2 Description read[DESCRIPTION-READ] 781ea6b959e979fa945db65289a3b4aa2467273bea4281883aa4f1575ac904e6 That sha256 names the PR description this verdict read. Recompute it with |
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Opus 5 Review (fork) — ✅ no blocking findingsReviewed |
|
|
5e1cad4 to
f11769d
Compare
|
Pushed f11769d (rebased onto current main, single commit) in one push:
|
|
self-added: yes
|
|
f11769d to
4b81cd3
Compare
|
Pushed 4b81cd3 (rebased onto current main, single commit). The saturated-window fallback from the previous head is gone. |
|
self-added: yes
|
|
self-added: yes
|
|
Pushed cdafbbe (rebased onto current main, single commit).
|
|
self-added: no
|
|
self-added: yes
|
cdafbbe to
f50dcb2
Compare
|
Pushed a new head, rebased onto current Fix for Opus's finding on The GPT fenced finding (F1, pre-existing, #14829) is unchanged by this head and still needs a repository writer to record the override. |
|
self-added: no
|
f50dcb2 to
052095a
Compare
|
Pushed a new head, rebased onto current This head removes the fenced GPT finding at the root instead of waiting on an override: the file-change flush now anchors chips only to a reply row this runner recorded when it appended it ( Local pre-push review: the pinned GPT and Opus reviewer processes failed to start on this host three times (ACP initialize timeouts during a memory-pressure window), so the pre-push pass was a self-review against the two extracted CI contracts, not an independent model review. The CI lanes on this head are the first independent read. |
052095a to
ca6e1c9
Compare
|
Same-tree retrigger, no code change (tree identical to On |
_flush_file_changes scanned every assistant row in the slot, so a turn that changed files and ended without its own assistant row wrote its chips onto the previous turn's answer. It now takes the same turn boundary _attach_turn_stats uses and scans only this turn's rows, creating the synthetic anchor when the turn has none. Fixes kirodotdev#14708
|
Same-tree retrigger, no code change (tree identical to On |
ca6e1c9 to
b441fc2
Compare
iamwhatever
left a comment
There was a problem hiding this comment.
Reviewed. _turn_rows / _note_reply_row / the flush filter scope chips to the rows this turn wrote; the fallback always adds a new row so chips are never hidden; every reply slot.append in _run_chat goes through _flush_segment or _persist_partial_reply and both record the row; id list capped at _MAX_SLOT_MESSAGES and cleared at turn entry and flush; one runner per slot; no new file reads.
Non-blocking: notice rows (Slack approval failure, unattended decline, agent switch) are no longer anchors, so a turn with only those gets an extra empty row; no test that _persist_partial_reply records its row or that the turn-entry clear happens; test_the_mid_turn_clear_resets checks source structure rather than behaviour.
Problem / Motivation
Goal: File-change chips appear under the turn that changed the files, never under an earlier answer.
A turn that edits files through tools and then ends without an assistant row of its own (provider error, cancel before any text, a synthetic backend-failure turn) writes its chips onto the previous turn's answer.
Why it matters
The chips are how a user finds out what an aborted turn wrote to disk. Placed on the earlier answer they say the wrong turn made the change, and a user who reads the earlier answer as unchanged misses edits that happened.
Not a goal
What changed (motivation → approach → change)
_turn_rowsmeta.mid) of the row at the window's tail at turn start._flush_file_changes(turn_boundary, turn_start_mid)slot._turn_reply_mids); with none, appends a synthetic content-less assistant row that carries only the chips._run_chat_turn_start_midbeside_turn_msg_boundaryat entry, at dispatch, and on the mid-turn clear (beside the existingassistant_textreset, which stays), and passes both at the two flush sites._note_reply_rowmeta.midinslot._turn_reply_mids. Called by_flush_segmentand_persist_partial_replyon the row they append; the list is a new_ChatSlotattribute insrc/kiro_crew/dashboard/state.py, cleared at turn entry and by the flush, and bounded at_MAX_SLOT_MESSAGES(a row older than the window cap has been trimmed and cannot be an anchor)._flush_file_changesinsrc/kiro_crew/dashboard/chat_runner.pywalkedreversed(slot.messages)for the first assistant row and only created its synthetic anchor when the whole slot had none. Any session with history has an earlier assistant row, so the fallback never ran and that row was mutated.A window index is not enough to fix it.
_ChatSlot.appendfront-trims at_MAX_SLOT_MESSAGESand pins the length there, so on a saturated window the index captured at turn start names the wrong row: an empty slice on a turn that answered, or an earlier turn's row on one that did not. A row identity does not move with the trim. Rows after the identified row are this turn's; an identified row that has left the window means every remaining row arrived after it. Only a tail row with no id (a transcript restored from a pre-id disk format) falls back to the index, clamped to the window so a stale value yields no rows, never an earlier turn's.The synthetic anchor has empty content. It lands after the turn's error row (every
exceptbranch appends that row before thefinallyflush), and an assistant row with text there is read bystate.is_turn_interruptedand its twinselectTurnInterruptedas the turn's reply, which hides the trailing error and removes the composer's Resume control. Every last-conversational-row scan looks through an empty assistant row, andinvisibleText.ts::isHiddenInvisibleAssistantRowkeeps a row with chips drawn, so the chips render and the error still decides the verdict.mainhas the same shape only on a first-ever aborting turn; this PR would otherwise reach it on every turn that aborts before text (Opus finding oncdafbbe).The live window is shared.
workflow_inject.pyappends a workflow completion into the originating slot as an assistant row with no in-flight guard, and the Slack gateway writes sub-agent completions under the same role, so a row that landed after this turn's last append and before its flush is the newest assistant row in the turn without being its reply (#14829). Position cannot tell the two apart; identity can, so the flush attaches only to a row the runner recorded when it appended it and otherwise falls to the synthetic anchor.mainpicks that injected row too (its whole-window walk), so this closes a pre-existing hole rather than a regression of this PR.docs/system-specs/modules/learn-cron-dashboard.mdstates the turn-scoped attach target and the identity rule.Backwards compatibility
Compatible: both parameters default to the old whole-slot scan (
turn_boundary=0,turn_start_mid=None). A_ChatSlotalways carries_turn_reply_mids, so a caller that appends an assistant row directly and expects the chips on it now registers it with_note_reply_row(two existing tests updated); a slot double without the list keeps the position rule. The synthetic row's text becomes empty; nothing insrc/,website/ortest/matched the old wording.Tests
test/test_file_change_snapshots.py::TestFlushFileChanges:test_turn_boundary_keeps_chips_off_the_previous_turns_answer: prior answer, new user row, one change. The prior answer stays clean; the chips sit on a new assistant row. Fails on the whole-slot scan.test_trimmed_window_still_finds_this_turns_rows_by_identity: a turn that answered and was front-trimmed keeps its chips; no synthetic row.test_trimmed_window_with_no_answer_never_reaches_an_earlier_turn: same trim, turn aborted; the earlier row stays clean and a synthetic row is added.test_evicted_start_row_means_every_row_is_this_turns: the turn-start row was trimmed away; the newest assistant row is the anchor.test_idless_start_row_falls_back_to_the_clamped_index: an id-less tail row with a stale index yields the synthetic row, not the earlier answer.test_the_mid_turn_clear_resets_the_boundary_id_beside_the_text: reads the runner'sEVENT_CLEAR_STATUSbranch and requires bothassistant_textand_turn_start_midto be reset there, so the new capture is added beside the accumulator reset and never replaces it.test_synthetic_message_created_when_no_assistant_textpins the empty anchor content.test_aborted_turn_with_chips_still_reads_as_interrupted:[user, error]plus a flush yields[user, error, assistant(chips)]andis_turn_interruptedis True; fails on the previous anchor text.test_injected_assistant_row_is_never_the_anchor:[user, injected workflow_result row]plus a flush leaves the injected row's meta untouched and adds the synthetic anchor; fails on the position rule.test_own_reply_wins_over_a_later_injected_row: a recorded reply followed by an injected row gets the chips; the injected row does not, and the flush clears the identity list.test_flush_segment_records_the_reply_identity: the production reply path registers the row it appends.test_reply_identities_are_bounded_at_the_window_cap: with the cap pinned to 2, three recorded rows leave the newest two ids.snapshot_turnharness, which executes the runner's lifted flush statements, seeds_turn_msg_boundaryand_turn_start_mid.Manual verification
N/A — unit coverage sufficient: a pure helper plus a guard, each path with a direct test.
Related Issues
Fixes #14708
Fixes #14829
Pattern harvest
Rule candidate: review-prompt
Pattern: end-of-turn attach that locates this turn's rows by a window index in a list that front-trims
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)