Repository navigation
fix(history): keep incognito transcripts on 0.7 (backport #13760) - #15261
Conversation
An incognito or temporary chat vanished at every gateway restart: since the member-store simplification (#11780) `_save_slot_to_history` returned early for a non-persistent slot, so nothing of the conversation reached the session JSONL while the mode picker still promised "Keeps the transcript for tab recovery" and Settings said "Every chat still appears in History". The mode was meant to stop the product LEARNING from a chat, not to lose the chat, and every reader that learns -- consolidation, lessons, memory injection, the MCP history tools, the summary, the workflow and task snapshots -- already gates on the transcript's own `memory_mode`. Refusing the write bought no privacy those gates did not already give, and forced a choice between privacy and a usable history. The slot save now writes every mode's transcript and records the STRICTEST mode it can see -- the slot's own or the live execution carrier's, read inside the transcript lock -- so a restart never re-reads a looser mode than the session ran under. A restricted line names no `memory_store`: with no execution carrier written for a restricted session, the store name would read back as the legacy owner claim the identity backfill refuses, and the restart would refuse the chat; left out, the restart reads the session as unbound and the next turn re-selects the member from `agent` under the retained mode. The title upsert of a restricted slot stamps its mode as well, since the on-send titler can write the first line of a session and a mode-less header resurrects as persistent (the ghost header files of the 0.7.0.8 report). Long term this makes the two modes what their descriptions say: a chat the user can reopen from History that teaches the product nothing. The agent prompt, the specs and the user docs say the same thing. Backport of #13760 (first commit, b0cc428) to release/0.7.0. (cherry picked from commit b0cc428)
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify 0.7's remaining transcript readers (consolidation, lessons, memory injection) gate on [DESIGN-REVIEWED] a0387fd |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Verify the second commit against main's 043742b by behavior, not diff — it is a hand-reshaped port, not a cherry-pick, per the description itself. Not justified as shipped
What this change shipsInventory (10 items) — 9 justifiedIntent: FIX — restore the shipped promise ("Keeps the transcript for tab recovery",
The deleted no-persist test pins recorded the regression, not a decision: the base [FIRST-PRINCIPLES-REVIEWED] a0387fd |
GPT 5.6 Review — ✅ no blocking findings (all downgraded on adjudication)GPT 5.6 flagged blocking issues on This comment is updated in place on each push. Review detailsBLOCKING -- src/kiro_crew/dashboard/chat_persistence.py:4482 -- replacement privacy state is published before persistence Adjudication (Opus 4.8) — is blocking on each finding proportionate?Harm rung: LOW. The tighten at Conditions confirmed: restricted-original→persistent-replacement rows-only handoff makes Remedy cost exceeds the harm: the ordering is deliberate ( False positive or not applicable? A repository writer can comment: |
Opus 4.8 Review — ✅ no blocking findingsReviewed Review detailsI've validated the sole candidate against the actual code. Falsification of CANDIDATE 1: The candidate claims a fail-open in No further grounded defect at 80+ survived in the changed lines. No findings. [OPUS-REVIEWED] a0387fd Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
0552bd3 to
81ef8a7
Compare
|
Disposition for the GPT advisory on Kept as is, on purpose. The live holder is tightened before the rows are written so that no reader can see the private rows on disk while the replacement still reads persistent; that is the order main uses too. If the write then fails, the replacement stays stricter than its line, which only withholds learning and summaries from that tab. It never discloses anything, and the replacement's own next save folds the same ratchet. Tightening after the write would reopen the disclosure window this change closes. The branch has been squashed to two commits for PR Hygiene; the tree is byte-identical to 0552bd3. |
81ef8a7 to
16a8d97
Compare
|
Dispositions for GPT on 81ef8a7:
|
16a8d97 to
ff55e6f
Compare
|
Disposition for GPT F1 on 16a8d97 ( |
…heted line The 0.7 shape of the core of #13760's second commit. A persistent slot recreated on a key whose line a restricted slot already tightened kept the line restricted, but the slot itself still read persistent. The session summary and the file export gate on the slot's mode and then read the whole transcript from disk, so they would hand the original's private rows to a model or a file. The save now carries the ratcheted mode onto the live slot and its restricted marker, folds the carried execution_context record to the line's mode, and the summary and export also check the on-disk line, failing closed on an unreadable one. A restricted original's unsaved tail draining onto a same-key persistent replacement's line was refused, so the close returned 500 and the rows the user was watching were lost with no retry path. The rows-only drain now folds the ratchet too: the line is tightened to the stricter mode, its store name is dropped, the live replacement is tightened, and the rows land. A restricted line keeps no carrier and no store, so the first turn after a restart re-selects the member from the `agent` alias. The line now records `restricted_member_id`, the member id the live carrier ran as, and the turn-start binder refuses a re-selection that resolves to a different member (an alias since reassigned) instead of binding that member's memory. The shared transfer bundle (file export and tunnel send) checks the line of the transcript it read, after the read, and the live slot, refusing with TranscriptWithheld. A turn first ratchets its slot to the line, so the binder never builds a persistent execution over a restricted conversation.
ff55e6f to
a0387fd
Compare
|
Dispositions for GPT on ff55e6f (both real, fixed in a0387fd):
|
|
Root cause of the GPT rounds on this PR: the first commit is #13760's commit 1 (b0cc428), which starts writing restricted transcripts. #13760's commit 2 (043742b) carries the guards that make the restricted line authoritative for every in-process reader, and it was not cherry-picked (it builds on main-only machinery). Each GPT round found the next of those guards missing. The second commit here re-implements that intent in 0.7 shape. Every finding so far, mapped to main (origin/main 89b9e76):
From here, a new finding is fixed on this branch only if this backport introduced it and main does not share it. Anything main shares, or 043742b covers, gets a disposition and a maintainer override request instead of another push. |
Problem / Motivation
Goal: On 0.7.x, an Incognito or Temporary chat keeps its transcript across a gateway restart, and still teaches the product nothing.
Since 0.7.0.8, an Incognito or Temporary chat is gone after every gateway restart. The mode picker promises "Keeps the transcript for tab recovery", and Settings says "Every chat still appears in History". Neither is true on 0.7.x today.
This is a backport of #13760 to
release/0.7.0. #13760 is on main and ships in v0.8.0-insider.1. No 0.7.x backport exists yet.Why it matters
Every 0.7.x user who picks Incognito or Temporary loses the chat on the next restart or update. They cannot reopen it from History.
Not a goal
open_slots.jsonstill lists persistent tabs only; the chat is reopened from History.What changed (motivation → approach → change)
_save_slot_to_history(dashboard/chat_persistence.py)memory_modememory_store; pinsrestricted_member_iddashboard/chat_runner.py)dashboard/chat_title.py)bind_session_execution(execution_context.py)dashboard/chat_summary.py), transfer bundle (dashboard/session_transfer.py: export and tunnel send)dashboard/chat_runner.py)The symptom is a lost chat. The cause:
_save_slot_to_historyreturned early for any non-persistent slot, so nothing reached the session JSONL. The fix removes that early return and makes the savedmemory_modea ratchet. A later writer can only tighten it, so a restart never reads back a looser mode than the chat ran under. The learning readers already gate on that field.This PR is the cherry-pick of b0cc428, the first commit of #13760, which carries the whole fix.
chat_summary.pyandsession_export.pykeep refusing a restricted transcript, andsuggestions.pyskips one when it grounds a prompt. The specs,config/prompt.mdanddocs/memory-and-learning.mdsay the same thing.Conflict resolutions against
release/0.7.0:chat_persistence.py,_fresh_fields: kept only the_moderatchet line. The_remember_reasoning_effort_for_restorecall beside it is main-only and was left out.execution_context.py,bind_session_executiondocstring: kept the 0.7 one-line summary and the new ratchet paragraph. Thevouch=paragraphs describe a main-only parameter and were left out.The first commit here is the cherry-pick. The second is the 0.7 shape of the core of 043742b. A persistent slot recreated on a restricted line kept reading persistent, so the summary and export, which gate on the slot and read rows from disk, could hand the private rows to a model or a file: the save now carries the line's mode onto the live slot, its restricted marker and the carried
execution_contextrecord, and both readers check the line itself. A restricted tail draining onto a persistent replacement's line was refused and lost: it now tightens the line and lands, as on main. A restricted line keeps no carrier, so the restart re-selects the member fromagent; the line pins the member id it ran as, and the binder refuses an alias that now names someone else.Not cherry-picked: 043742b itself (+6056/−419 across 51 files). The rest of it hardens hand-overs and more on-disk readers on top of main-only machinery that 0.7 does not have: guarded-write registration, the retraction fence,
TranscriptRevisionChanged, the legacy member-record backfill. A cherry-pick of it conflicts in 10 files against symbols that are absent here.Backwards compatibility
Compatible: every mode that saved before still saves the same way. A restricted chat gains a transcript file where it had none, under the same
memory_modeevery learning reader already gates on.Tests
From #13760, carried as-is:
test/test_ephemeral_sessions.py::TestRestore::test_restore_rebuilds_memory_modelocks the restart path: a restricted slot saved to history is restored by a fresh state with its mode. It fails onrelease/0.7.0(assert 0 == 1) and passes here.TestHistoryPersistenceintest/test_ephemeral_sessions.pyandTestSaveSlotToHistoryintest/test_temporary_chat.pylock that incognito and temporary transcripts reach disk with their mode.test/test_slot_close_recreation_race.pylocks that a same-key persistent recreate cannot relabel a restricted line, and that a restricted hand-over tail tightens a persistent replacement's line, slot, marker and execution record and lands (test_delete_handover_of_a_restricted_tail_tightens_a_persistent_line, ported from main).test_restricted_member_session_persists_transcript_but_no_owner_recordintest/test_chat_agent_selection.pydrives a restricted member chat through a restart: the line pins the member id, a save with no live carrier keeps it, and a re-selection resolving to another member is refused.test/test_session_transfer.pylocks that the bundle refuses a restricted or unreadable line and a slot tightened during the read;test_turn_start_ratchets_a_persistent_slot_to_its_restricted_linelocks the turn-start ratchet. Each fails with its guard removed.TestPersistTitleintest/test_temporary_chat.pylocks that a title upsert stamps the mode and never loosens it.test_same_key_persistent_recreate_is_restricted_like_its_lineintest/test_slot_close_recreation_race.py, plus the restricted-disk-line cases intest/test_session_summary_generate.pyandtest/test_session_export.py, lock the 0.7-only guard. Each fails with its guard removed.The 30 test functions the cherry-pick adds or edits, plus
test/test_session_summary_generate.pyandtest/test_session_export.pywhole, pass locally (162 cases).#14793 is not included. Its test lives in
test/integration/test_memory_bindings.py, andrelease/0.7.0has notest/integration/layer orgateway_bootharness. Bringing it would mean backporting that whole layer, so it is skipped;test_restore_rebuilds_memory_modecovers the restart path at the unit level.Manual verification
N/A: the restart path is covered by
test_restore_rebuilds_memory_mode, and this is a faithful cherry-pick of a fix already running on main.Pattern harvest
Rule candidate: review-prompt
Pattern: a privacy gate placed on the WRITE of a record whose READERS already gate on the record's own mode field; the write gate loses the record without adding privacy.
no linked issue: backport of #13760 and #14793; the tracking issue belongs to #13760 on main.