Repository navigation
fix(dashboard): save and close sessions written before execution_context - #12116
Conversation
A chat record written before the one-SQLite-store member memory landed names a member's V2 store in ``memory_store`` but carries no canonical ``execution_context``. ``read_session_execution`` refuses such a record as identity, and ``_save_slot_to_history`` called it unguarded, so every periodic flush and every close of that session raised ``UnknownMemoryStore: session has no canonical member identity``. The close handler then restored the slot, and the tab could never be dismissed. The transcript write is not private-memory access: the carrier only decides retention there. That one refusal now has its own type, ``MissingExecutionIdentity``, raised only at the two absent-carrier sites; the save catches exactly it and falls back to the slot's own ``memory_mode`` (already required to be ``persistent``). An unreadable record, a present-but-malformed carrier and an undeclared store stay plain ``UnknownMemoryStore`` and still fail the save. Authorizing private memory from a store name stays refused where it is read for that purpose.
|
Intent: A chat whose record was written before |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 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: |
Design Review (Fable 5) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS The legacy-record fix covers one consumer; history consolidation asks the same retention-only question and still fails on the same records. WatchThe fix catches The description concedes "Not yet re-verified on the host with this patch." The new close test drives SuggestionsLegacy records are never healed, so every save of every legacy chat takes the raise-and-catch path forever; writing a retention-only carrier back on first successful save would retire [DESIGN-REVIEWED] 70099cc |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Description admits "Not yet re-verified on the host" that reproduced the bug — confirm a real pre-#11780 record actually closes before merge. Not justified as shipped
What this change shipsInventory (5 items) — 3 justifiedIntent: let a crew-member chat created before
The identity refusal itself respects the pinned decision at [FIRST-PRINCIPLES-REVIEWED] 70099cc |
Opus 4.8 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: |
|
|
|
|
|
bolichen97
left a comment
There was a problem hiding this comment.
Approved: fix-class, readiness:passed, no conflict.
…ext (kirodotdev#12116) A chat record written before the one-SQLite-store member memory landed names a member's V2 store in ``memory_store`` but carries no canonical ``execution_context``. ``read_session_execution`` refuses such a record as identity, and ``_save_slot_to_history`` called it unguarded, so every periodic flush and every close of that session raised ``UnknownMemoryStore: session has no canonical member identity``. The close handler then restored the slot, and the tab could never be dismissed. The transcript write is not private-memory access: the carrier only decides retention there. That one refusal now has its own type, ``MissingExecutionIdentity``, raised only at the two absent-carrier sites; the save catches exactly it and falls back to the slot's own ``memory_mode`` (already required to be ``persistent``). An unreadable record, a present-but-malformed carrier and an undeclared store stay plain ``UnknownMemoryStore`` and still fail the save. Authorizing private memory from a store name stays refused where it is read for that purpose. Co-authored-by: EC2 Default User <ec2-user@ip-172-31-10-71.ec2.internal>
Problem / Motivation
Closing a chat that was created before the one-SQLite-store member memory landed (#11780) does not work: the tab disappears and comes straight back. The gateway log shows the same error on every attempt and on every periodic flush of that chat:
The chat's record names a member's V2 store in
memory_storebut has noexecution_context, because that field did not exist when the record was written.Why it matters
Anyone who had a crew-member chat open across the upgrade cannot close it. Its transcript is also never flushed again, so new rows in that chat are lost on restart.
What changed (motivation → approach → change)
history_save_failed, slot is restored to the list_save_slot_to_historyasksread_session_executionfor the retention mode; a record with a private store and noexecution_contextis refused as identity, and the save propagated that refusalMissingExecutionIdentity; the save catches exactly it and uses the slot's ownmemory_modesrc/kiro_crew/execution_context.pyraisesMissingExecutionIdentity(declared insrc/kiro_crew/memory_stores.py, a subclass ofUnknownMemoryStore) at the two places a readable record marks a member or a V2 store but carries noexecution_context.src/kiro_crew/dashboard/chat_persistence.pycatches only that type inretention_allows_writeand falls back to the slot'smemory_mode, which that function already requires to bepersistent.The transcript write is not private-memory access: the carrier only decides retention there, and a record with no carrier has no stricter retention than the slot's own. Reading such a record for private memory stays refused. An unreadable record, a present-but-malformed
execution_context, and an undeclared store stay plainUnknownMemoryStoreand still fail the save.Backwards compatibility
Compatible:
MissingExecutionIdentitysubclassesUnknownMemoryStorewith the same message, so every existingexcept UnknownMemoryStore/except ValueErrorand everypytest.raises(UnknownMemoryStore)still matches. No accepted input is rejected.Tests
test/test_legacy_session_history_save.py:_close_sloton such a record archives it and does not restore the slot (fails on main withSlotCloseError: failed to save history)temporaryslot still writes nothingexecution_contextstill fails the savememory_storestill fails the saveMissingExecutionIdentityManual verification
Reproduced on a host upgraded to
bc0d2b0cf: akirocrew-conductorchat from the previous build could not be closed, with the traceback above atchat_persistence.pyretention_allows_write. Not yet re-verified on the host with this patch; the close test drives the same_close_slotpath.Related Issues
no linked issue: found on a live host, no issue was filed.
Pattern harvest
Rule candidate: review-prompt
Pattern: a guard that resolves identity/authorization is called from a persistence path that only needs a retention mode, so an identity refusal fails the write
Checklist
feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)