Repository navigation
fix(dashboard): alias slots share one compaction threshold - #31284
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. Keeping the threshold in the shared Notes
[DESIGN-REVIEWED] 700ddef Description read[DESCRIPTION-READ] 971a3e5716fdcc04b51c192f5ef01fd0f3ee241b3cf7bb0e4b78956a67632765 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 (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The route now relies on a process-global commit table and a second commit hook that only this route uses. Each has a named race behind it, so neither blocks. Notes
What this change shipsInventory (8 items) — 6 justifiedIntent: one compaction threshold shared by every tab on a conversation, so a stale tab cannot overwrite a saved one. This is a FIX (part of #7497).
[FIRST-PRINCIPLES-REVIEWED] 700ddef Description read[DESCRIPTION-READ] d6e1a16edfaf38177cbf227ff9a65f966de43989b4e40600b0a8657de9926f8a That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
cb973a7 to
b70d0ee
Compare
|
|
|
|
b70d0ee to
1af4570
Compare
|
|
1af4570 to
a67eadb
Compare
a67eadb to
76a3847
Compare
|
76a3847 to
11359f4
Compare
|
Alias slots (two live slots on one transcript) each held their own copy of the session's compaction threshold, so the threshold route mirrored a commit onto every alias by hand and ran a second confirm save to re-order the durable record after a stale alias flush. The threshold now lives in the TranscriptBinding the aliases already share for the project directory, behind a _ChatSlot property. A write through one alias is the group's write and every alias's save reads it under the transcript lock, so the mirror, its rollback loops and the confirm save are gone. The route persists before it publishes, as the turn time limit route does: its save writes the new value staged while the shared field keeps the previous one. The commit hook, run in the save's worker under the transcript lock, only records the committed value, which every save of that transcript writes until the route publishes it on the event loop, where every rebind runs. A value that never lands is never visible to an alias's save or to a restore seeding the session's live gate, so a failed or refused request has nothing to undo. The binding records whether anything wrote its threshold, a clear included. A joining slot keeps a live peer's threshold and only fills a peer nothing wrote, as it already does for the directory, and a stored threshold read from disk (a restore or a surfaced channel slot) never replaces a live alias's. Part of #7497
11359f4 to
700ddef
Compare
|
Rebased: main moved in The patch is unchanged by the rebase (range-diff identical). Related backend tests passed locally on the new base. [operator: bolichen97] |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved: PR Readiness passed on 700ddef, and all five review lanes (Opus 5.5, GPT 6.1, Design, UX, First Principles) report no blocking finding on this head. No conflict and no open change request.
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray]: Post-merge review: the change works as intended; a remaining gap is tracked in #32569. |
Problem / Motivation
Goal: A compaction threshold set on one tab of a shared conversation is the threshold every tab on that conversation holds and saves, with no hand-written copy between them.
Two live tabs can point at one transcript (a channel thread opened from the dashboard, for example). Each tab held its own copy of the session's compaction threshold, so a tab still holding the old number could write it back over a threshold another tab had just saved. The threshold route patched this by copying each commit onto every tab on the transcript by hand, and then running a second save to put the durable record back in order after a stale tab's flush. That copy is one of the per-field point patches #7497 names as the root cause.
Why it matters
Each per-field copy is its own patch with its own rollback loops, and a path that misses one lets a stale tab undo a threshold the user was told was saved. Holding the value once removes that failure for this field and makes the route one save instead of two.
Not a goal
turn_timeout_secs,memory_storeoragent_kind: later slices of Single-source transcript-shared slot metadata (alias slots hold divergent per-slot copies) #7497 (turn_timeout_secsalso needs its read-back flag moved with it).reasoning_effortalias handling.What changed (motivation → approach → change)
Tabs on one transcript already share one
TranscriptBindingobject for the project directory (#25899, #26060), and every join site joins it. The compaction threshold now lives in that same object, read and written through a_ChatSlot.autocompact_pctproperty. A write through any tab is the group's write, and every tab's save reads that one value under the transcript lock.With one value there is nothing to copy, so the threshold route's alias copy loop, its two rollback loops and its second confirm save are deleted, leaving one save.
A shared value must never hold a threshold that may not be saved, because every tab, and a tab restored beside them, reads it. So the route now saves the new threshold before any tab holds it, the way the turn time limit route already does: the save writes the requested value, and it reaches the tabs only once that write has landed. From the moment it lands, every other tab's save of that conversation writes it too, and the route then hands it to the tabs on the server's event loop, where every tab move runs, so a tab moving to another conversation at that moment can never carry it there. That holds when the tab is moved during the save, and for a conversation with no stored line yet, whose line another tab's save then creates. A failed or refused request leaves every tab, and the session's live threshold, as they were, so there is no rollback left to get wrong. A tab alone on its transcript sees the same answers as before. A save that waits for the lock while its tab moves to another conversation still writes the threshold of the conversation it saves, not the one the tab just joined.
The shared object also records whether anything has set its threshold, a clear included, the way it already records a directory choice. A tab joining a live peer keeps the peer's threshold, and only a peer nothing has set (a workflow result tab that never read its stored settings) takes the joining tab's. A stored threshold read back from disk, by a restore or a surfaced channel conversation, never replaces a threshold or a clear a live tab saved after it was read.
Backwards compatibility
Compatible: the metadata line keeps the same
autocompact_pctkey and values, and a tab alone on its transcript gets the same responses and stored values as before.Removes nothing:
slot.autocompact_pctstill reads and writes for every caller (now through a property); only the route's alias copy and its second save are gone, because the shared value makes them redundant.Tests
test_alias_slot_shared_project.py: a real save from a tab that joined after its peer set a threshold keeps the stored threshold; the route's save writes its value on the merge and the full-save path while the tabs still hold the old one, and runs both commit hooks; a stored threshold read by a restore or a surfaced channel conversation never replaces a live tab's threshold or clear, nor reaches the session's live threshold; a restored tab gives an unseeded live tab its threshold and keeps a live tab's own; a tab leaving the group keeps its threshold; the edit-resend and rewind copies never writeautocompact_pct.test_session_autocompact_override.py: the alias tests join their tabs the way production does; the route makes exactly one save and hands it the value to write; while the save runs every tab holds the old value, and only a write that landed reaches them and the live threshold, including one whose save raised after landing; a refused request leaves the group alone; a rebind during the save, refused or landed on either save path, set or clear, leaves the old transcript at what its line holds and never carries the request's value to the new one; a tab's save queued behind a real merge writes the committed value before the route hands it to the tabs, for a tab rebound mid-save and for a transcript with no line yet; the commit hook changes no tab's value and leaves nothing behind once the request ends, and a tab moved right after the commit leaves the value on the conversation it landed on; a tab's queued save, merge or full save, writes the threshold of the conversation it saves when the tab leaves it or finishes joining another while the save waits for the lock.test_dashboard_source_link_unlink_hydration.py: the bind-site scan also recognises a site that restores the threshold through the new seed helper.test_chat_persistence_composition_contract.py: the two save signatures carry the new staged argument and the transcript commit hook.test_state_parts_facade.py:autocompact_pctis a property of the slot, no longer an instance field.Determinism: the changed tests ran 20 times at
-n0, 10 times at-n 4 --dist loadgroup --max-worker-restart=2besidetest_transcript_binding_join_sites.pyandtest_slot_metadata_codec.py, and once in a shuffled order (seed 31284), all green.Proof: PROVEN test/test_alias_slot_shared_project.py::test_a_stale_alias_save_keeps_the_peers_threshold, test/test_alias_slot_shared_project.py::test_a_stored_threshold_never_replaces_a_live_aliases[surface-set], test/test_alias_slot_shared_project.py::test_a_stored_threshold_never_replaces_a_live_aliases[surface-cleared], test/test_alias_slot_shared_project.py::test_a_stored_threshold_never_replaces_a_live_aliases[restore-set], test/test_alias_slot_shared_project.py::test_a_stored_threshold_never_replaces_a_live_aliases[restore-cleared] (head b667c510a53d)
Manual verification
N/A — unit coverage sufficient: the change is the in-memory home of one slot field and the order of one route's save, and the tests drive real saves through the transcript lock and the route end to end.
Screenshots / video
N/A — no user-visible frontend surface is touched.
Related Issues
Part of #7497
Sibling sweep
Swept: git grep -nE "slot_history_key((other|peer|s)) ?== " -- src/kiro_crew/dashboard
Sibling: src/kiro_crew/dashboard/chat_api/slot_settings.py:206 -- not affected -- finds one live tab on the committed transcript and writes the binding they all share once, on the event loop, no per-tab copy
Sibling: src/kiro_crew/dashboard/chat_api/slot_settings.py:445 -- tracked in #7497
Sibling: src/kiro_crew/dashboard/session_directive_apply_slot.py:531 -- tracked in #7497
Sibling: src/kiro_crew/dashboard/chat_api/source_links.py:599 -- not affected -- dismissed links are a grow-only union on save, so a stale tab cannot shrink them
Pattern harvest
Rule candidate: review-prompt
Pattern: a per-transcript slot field copied onto alias slots by a loop over
state._slotsmatchingslot_history_keyinstead of living in the sharedTranscriptBindingChecklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)