Repository navigation
feat(chat): backend to merge a fork back into its parent chat - #17165
Conversation
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The merge-back routes add a capability alongside the existing ones and change no default. The one cost worth cutting is the machinery that lets a merge card follow its session across twin slots. Notes
What this change shipsInventory (10 items) — 8 justifiedIntent: let a person bring a fork's new results back into its parent chat, so the parent's agent receives them once. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 1631d95 Description read[DESCRIPTION-READ] d5bf9732061e545821860127479d44a46dee898e643e81f6dfaa866595945ddb 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 No design-level blocker: the take-aways are listed or stripped server-side, nothing renders under Notes
[DESIGN-REVIEWED] 1631d95 Description read[DESCRIPTION-READ] 9f40899ca26789887ba2e6a02573bb532a24d442b862f44c5853c5dd2d7b46b5 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 -- src/kiro_crew/dashboard/chat_turn/prompt_assembly.py:789 -- Cold-start replay delivers pending merge summaries twice
Adjudication (Opus 5.5) — is blocking on each finding proportionate?F1 is downgraded, so it no longer blocks the merge. F1 — LOW. The duplicate needs a cold-start turn: replay only runs when The result is one prompt carrying the summary twice. Nothing crashes and nothing is lost or corrupted. The drain clears the queue ( The suggested fix would mean filtering the current turn's note rows out of both |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
91fe9ae to
481160b
Compare
481160b to
79547df
Compare
79547df to
1e6f42f
Compare
|
|
|
|
|
|
|
@iamwhatever On your r112 hold at
On the current head, |
|
Hold at 4b27edb for maintainer review. The author has answered the Design and First Principles items with one disposition each. The two deferred items are tracked in #23163 and #23164, which describe them. Opus reports no findings, and every check except Sensitive Change Review is green. What still blocks, and what clears each:
I did not re-read the full diff on this head or run the tests. — crew-pr-reviewer (r127) |
|
|
@iamwhatever On your r127 hold at
|
|
HOLD at 2b13715 for maintainer review. This head is a rebase of 4b27edb with no new logic. The GPT cold-start item from r127 now has an accepted disposition that cites main's documented What still blocks, and what clears each:
— crew-pr-reviewer (r133) |
|
HOLD at f55949f for maintainer review. This head is a rebase of 2b13715 onto current main. What still blocks, and what clears each:
— crew-pr-reviewer (r135) |
|
HOLD at 3a312c0 for maintainer review. This head is more than a rebase of f55949f (r135). It adds new logic to move queued merge cards from a closing tab onto another open tab of the same chat: What blocks, and what clears each:
AI findings judged non-blocking:
The deferred items stay tracked in #23163 and #23164. I read the range-diff from the last reviewed head, the AI lane bodies and CI. I did not re-read the whole 14k-line diff or run tests. — crew-pr-reviewer (r136) |
|
HOLD at 21fce89, reserved for human review. This head is a rebase of 3a312c0 (our r136). The range-diff shows only conflict context and one test-helper line ( What holds it, and what clears each:
Deferred items stay tracked in #23163 and #23164. I read the range-diff, lane bodies and CI; I did not run tests. — crew-pr-reviewer (r139) |
|
HOLD (reserved for human review; CI and AI review incomplete) at This head rebases What holds it, and what clears each:
Deferred items stay tracked in #23163 and #23164. — crew-pr-reviewer (r142) |
bolichen97
left a comment
There was a problem hiding this comment.
Requesting changes at 5c8efdc for one point.
dashboard/slot_buffers.py adds a regex in product code. This repository asks new product code not to check text with a regex:
_MERGE_DIGEST = re.compile(r"[0-9a-f]{64}")
is_merge_digest uses it with fullmatch to accept a lowercase SHA-256. The same check needs no regex:
isinstance(value, str) and len(value) == 64 and all(c in _HEX_LOWER for c in value), with_HEX_LOWER = frozenset("0123456789abcdef").
A test with a valid digest, an uppercase one, a 63- and 65-character value, and a non-hex character would cover it.
Separately, Sensitive Change Review cannot pass from a fork, so it will need a maintainer.
|
@bolichen97 Done in fee349d. |
Add the two dashboard routes that draft and commit a fork's merge-back summary, the merge card note that carries the summary into the parent chat, the held-note durability the card relies on, and the History resume changes behind the card's link back to the fork. The dashboard that calls these routes lands in a separate PR stacked on this one. Refs kirodotdev#3816
bolichen97
left a comment
There was a problem hiding this comment.
Approving at 1631d95. The point from my last review is fixed: is_merge_digest now checks a lowercase SHA-256 with a length test and a fixed hex character set, and the diff adds no regex in product code. All other checks pass. Sensitive Change Review cannot pass from a fork, so it needs a maintainer.
Problem / Motivation
Goal: Bring a fork's new results back into the chat it was forked from, merging only what that chat lacks and delivering each summary to its agent exactly once.
A fork is a one-way door today: when it pays off, nothing lands the outcome in the original chat, and its
forked_fromlink is display-only.This is the backend half of #15957, which is stacked on this PR.
Why it matters
Every fork that pays off now costs a manual copy and paste, and every skipped one leaves the parent without context you already paid for.
Not a goal
MAX_FORK_PARENT_KEY_CHARS: it records no parent link, so it isnot_a_fork.api_chat_slot_create,api_chat) first, or refusing a parent open in two slots: main opens one transcript twice on purpose (History resume, a create by name, the hooked resume), so a turn takes its session's cards from whichever slot holds them.What changed (motivation → approach → change)
This PR has no UI: the routes' only caller is #15957's dialog. The note hold and History resume changes apply to every chat now; the feature map lists the endpoints as API-only until #15957.
POST /api/chat/slots/{slot}/merge-back/drafthas the background model summarize the fork messages the parent lacks, as many as it reads in full, and says how many are left and whether the note was cut. It writes nothingPOST /api/chat/slots/{slot}/merge-backwrites the text into the parent as a note whose row carriesmeta.mergedFrom: the merge cardThe card goes through the note path, so the parent's agent sees it after a restart:
api_chat_slot_note's delivery step is nowdeliver_noteinchat_api/slot_note.py, which merge-back calls. That gives the card the note's visibleinjectrow, its next-turn context, and its durable hold. A merge counts as done once that hold is written, not once the agent reads it, or the next draft would summarize a pending card again. A card is consumed once a turn whose prompt the next session holds has taken its context: kiro-cli kept it (_kiro_cli_kept_the_prompt), and no reset beforeend_turn, discard or runtime swap dropped it (_native_session_lacks_the_prompt). That turn marks it consumed on disk, so no restore, flush or other slot sends its context again (a crash before the mark sends it once more). The hold keeps its row until a full save writes it or finds itdelivered. The hold inslot_buffers.pycarries themergedFromblock and both marks through serialize, restore and flush. A merge card's context reaches the parent's next turn from whichever of its slots runs it, within one slot's queue caps; a turn with no card on its session moves nothing (chat_turn/turn_context.py).Merges are incremental and keep no fork-side state.
chat_merge_back.pyreads what the parent has from the parent: the rows the fork copied keep the parent's message ids, and each merge card records the range of fork messages it covered with a fingerprint of them. Only a note row the server delivered, or a held card whose write committed, counts as a card. Everything after the last range that still matches is new.The merge route re-reads both chats rather than trusting the draft, and refuses a merge another tab made, a fork rewound past the draft's end, credential-shaped text (
context_secret_shaped), and a parent whose context queue is full or whose agent has not finished reading earlier merges. Both routes refuse a parent taking turns outside the dashboard: only dashboard turns read a note's context. The draft's fingerprint refuses one whose messages have moved on. A fork records its parent transcript'screated_at(chat_fork.py), so a chat later made on a deleted parent's key is not taken for the parent, and a merge whose parent or fork is deleted while its card is written is not acknowledged. The draft passes the active credential policy before the route returns it. Merges into one parent take turns. Both chats are read in full through the transcript derivation fence, with their rotated archives (derive_messages_chained_full_with_keysinhistory.py, on main's_derive_settled_chain_rows), and checked again as the draft is returned and while the card is written, so an incognito or temporary fork or parent publishes nothing. The module spec and app-kit reference describe it;security_posture_sinks_gateway.pylists the draft as a redaction egress path.Backwards compatibility
Compatible: two new routes and new optional fields. Main accepts two writes this refuses: a dashboard send setting the server-minted
mergedFromornoteId, and a held/notepast the 64 KiB header cap.Reader:
chat_handlers.py:api_chat-- chat -- strips a clientmergedFromandnoteIdfrom the row;test_chat_send_client_meta_survival.py.Reader:
chat_api/resume.py:_live_slot_for_resume-- chat (History resume) -- returns the live slot writing the transcript, so an unbound channel tab'sslack_<ts>stem returns that tab, not a second slot;test_history_resume_returns_the_live_slot_for_the_same_transcript.Reader:
chat_api/resume.py:_hydrate_slot_from_history-- chat (History resume) -- restores the note hold as a restart does (part of #17025); a plain/noteheld at close is written by main's close flush and leaves the hold, so the resume writes it no second time;test_a_plain_note_held_at_close_is_written_once_after_history_resume.Reader:
slot_buffers.pynote hold -- chat -- refuses a transcript recreated on its key after a delete, as the save already did, and holds 20 plain entries plus 10 merge cards;test_deferred_note_persistence.py.Reader:
slot_lifecycle.py:api_chat_slots_cleanup-- chat -- a closed tab holding notes loads its window off the loop before the flush, then rechecks for a replacement on the same transcript, which takes the tail through the handover drain; that drain also loads each window off the loop before reading it;test_cleanup_recreate_during_note_preload_uses_handover.Reader:
slot_turns.py:has_pending_context_seat-- apps -- counts merge cards a running turn took, so/contextand/notefind fewer seats;test_an_inflight_merge_card_holds_a_pending_context_seat.Reader: the first-turn history settle (
_turn_settle_debts) -- chat -- calls_kiro_cli_kept_the_prompt, unchanged;test_recovery_l1_chat_runner.py. The three prompt-keeping helpers live inchat_turn/turn_stats.py, and_message_without_merge_cardsand_turn_landsare held on the turn (chat_turn/turn_locals.py) because_queue_recoveryand the phases main moved out of_run_chatread them.Reader: a fork made before this version -- chat -- has no parent
created_at: it merges only into an older chat on the parent's key, and a missing or zone-less time isparent_unconfirmed;test_chat_merge_back.py.Reader: an older build after a downgrade -- release -- ignores
delivered,consumedandmerged_from(a card it replays as a second row counts as one card here; a held card loses its label) and restores only the first 20 held entries;test_a_card_replayed_by_a_downgrade_counts_as_one_card.Tests
test_transcript_derivation_seam.pyandtest_history_bindings.py: the guarded full-chain read lives inhistory_derivation.py, bound onConversationLog;history_schema.pymakesforked_from_created_atslot-owned metadata.history_projection.py'smetadata_record_for_updateis the record the writer saves, and the note hold measures it, with every merge card already marked consumed and delivered, against the 64 KiB header cap the export reads: a note that would cross it is refused with 413deferred_note_header_fulland nothing is evicted (TestEnqueueDurabilityintest_deferred_note_persistence.py, three boundary tests).5fd96a0f2with CI's pytest pins: the 247 tests this diff adds or changes, plus the four files where it changes only data (553 node ids), passed 20 runs at-n0, 10 runs at-n 4 --dist loadgroup --max-worker-restart=2besidetest_history.pyandtest_chat_persistence_composition_contract.py(982 passed each), and one run in a shuffled order (seed 14521). The fourclose_before_resumecalls intest_chat_merge_back.pyfix a Windows clock tie: with a throwaway plugin that floorstime.time()to the 15.625 ms Windows tick, the file without them failed 7 of 8 runs (13resume_conflictfailures across three tests) and with them passed 8 of 8. Six tests that delete a transcript and make another on its key pin both creation stamps, since two made in one Windows clock tick get the same stamp: with every new transcript and chat stamped with one constant time, the tests without the pins failed all 7 of their cases and with them passed all 7 (measured over main397f4beef). With onerelease.set()removed,test_notes_wait_behind_a_durable_write_and_keep_their_orderfails in 13 s and its output names the missed release (over main334335182). The 12 tests the previous push added or changed (13 node ids) passed 20 runs at-n0, 10 at-n 4 --dist loadgroup --max-worker-restart=2beside the same two files (442 passed each), and one shuffled run (seed 13646), over main5dbde278a.test_a_turn_slot_whose_transcript_was_deleted_takes_nothingnow pins both creation stamps too: with every stamp forced to one constant it fails without the pins and passes with them, and it passed 20 runs at-n0, 10 at-n 4 --dist loadgroup --max-worker-restart=2beside the same two files, and one shuffled run (seed 16618), over main65e13d6b2. The tests the last four pushes add or change, with every test that calls a helper they changed (51 node ids), passed 20 runs at-n0, 10 at-n 4 --dist loadgroup --max-worker-restart=2beside the same two files (480 passed each), and one shuffled run (seed 22273), over main67c1304b0. Each test written for a defect these pushes fix fails with that fix reverted. The fourTestSidebarRowParenttests passed 20 runs at-n0, 10 at-n 4 --dist loadgroup --max-worker-restart=2beside the same two files (433 passed each), and one shuffled run (seed 2431), over maincbf2b3614. Two checked that a merge card's retirement never loaded a tab whose window was still pending; this push removes that scan, andtest_consumption_does_not_load_a_pending_sidebar_twinchecks the same of consumption. The other two fail with the merge routes' window load removed.TestMerge::test_a_credential_shaped_summary_is_refused_without_a_cardand its two queue-full siblings passed 20 runs at-n0, 10 at-n 4 --dist loadgroup --max-worker-restart=2beside the same two files (432 passed each), and one shuffled run (seed 30986), over main2987fc9f9. It fails when a credential-shaped merge only skips its context half, which lands a card with no context; without the credential check indeliver_note, main's/notetests intest_pending_context_secret_refusal.pyfail. For main's test: ratchet fixed short waits; add await_until and LoopHop helpers #19248 wait ratchet,test_chat_merge_back.pywaits on the events and state it asserts throughkiro_crew.testing.wait(await_until,async_wait_until,LoopHop) instead of short fixed timeouts; it passed 20 runs at-n0, 10 at-n 4 --dist loadgroup --max-worker-restart=2beside the same two files, and one shuffled run (seed 5798), over main395106a39. The 25 tests this push adds or changes passed 20 runs at-n0, 10 at-n 4 --dist loadgroup --max-worker-restart=2beside the same two files (468 passed each), and one shuffled run (seed 30409), over main54b0c64ba. The 36 tests this push adds or changes passed 20 runs at-n0, 10 at-n 4 --dist loadgroup --max-worker-restart=2beside the same two files (480 passed each), and one shuffled run (seed 24020), over mainb6a7b33fb. With the bounded replay guard's cap, its stamped-first eviction, its survival after the mark, the queued-twin drop, the live-hold mark, the mark's write check or its retry after the turn removed, the test written for that part fails. With the consumed mark's stamp, its restore or drain guard, its flush skip, its union carry, the full save's retirement check, the turn'sfinallystamp or its_turn_landsread removed, the test written for that part fails. The 51 tests this push changes, or that call a helper it changed (73 node ids), passed 20 runs at-n0, 10 at-n 4 --dist loadgroup --max-worker-restart=2beside the same two files (173 passed each), and one shuffled run (seed 466), over mainbc72245a35. The draft runs one composed redaction pass: with the exfiltration-URL and credential passes run one after the other instead,test_a_credential_split_by_a_url_end_is_redacted_from_the_notefails on the half of the credential the URL's end leaves. With the draft on the companion-blindsecurity.redactinstead ofredact_via_context,test_the_active_credential_policy_redacts_the_draft_notefails: a token only a loaded companion's credential policy matches reaches the JSON. It, the other 43 tests inTestDraftand the merge test that reads a card's title (45 node ids) passed 20 runs at-n0, 10 at-n 4 --dist loadgroup --max-worker-restart=2beside the same two files (145 passed each), and one shuffled run (seed 490), over main3d6cda4f3. With the duplicate check where a turn takes cards from its session's other slots, where the prompt is built, or where consumed cards are reported removed, or with an undeliverable turn-slot copy counted as already queued, the test written for that part fails. Those five tests and every test that calls a function they cover (58 node ids) passed 20 runs at-n0, 10 at-n 4 --dist loadgroup --max-worker-restart=2beside the same two files (158 passed each), and one shuffled run (seed 518), over main64576241e. The binding-rebuild test and the nine card-replay tests whose helpers it borrows (10 node ids) passed 20 runs at-n0, 10 at-n 4 --dist loadgroup --max-worker-restart=2beside the same two files (116 passed each), and one shuffled run (seed 714), over mainc5078a984. That test, the other 44TestDrafttests and the merge test that reads a card's title (46 node ids) passed 20 runs at-n0, 10 at-n 4 --dist loadgroup --max-worker-restart=2beside the same two files (152 passed each), and one shuffled run (seed 580), over main988fad008.test/test_chat_merge_back.py,_merge.py,_merge_hold.pyand_routes.py(one file split in four for the 2,000-line cap): the planner on head forks, tail forks, a second merge, a rewound fork, another fork's cards, merged ranges that lost messages at their start or in their middle (they stop counting, so the next draft covers what is left), and a card an earlier build stored with atailkey; the block validator, which requires every field and leaves out a key it does not read; a card row written twice, as a downgrade replays it (it counts once); the fingerprint, which follows the messages' text and not only their ids; the held-note round trip; both routes end to end against a real conversation log, including a fork made by the real fork route, a parent mid-turn, a restart, a parent a restart left as a sidebar row (both routes load its window off the event loop), two merges of the same messages, a reply switched to another variant through the real switch-variant route, both before its merge and after it, another merge covering the start of a draft, a busy fork transcript, a credential in the model's note, one cut in two by a URL's end, a draft that covers only what the summarizer reads in full (a long reply whole, a first message over the limit alone, the rest left for the next draft), a draft that never ends on the first of two pre-id rows with the same stamp, role and text, a model note over the limit (it comes back cut and markedtrimmed), a message sent while the fork is read, a merge of a fork mid-turn or one that starts a turn while the merge reads or at its source check (refused as running, not as a stale draft), a fork whose rows predate message ids, a fork whose older messages sit in its rotated archive, a parent whose rows sit in its rotated archive, two tabs merging at once while the first card's write fails, a parent rewritten from its first message, a fork or parent made private while its summary is written, a fork or parent made private before its card is written, a restricted or unreadable parent, a parent chain that changes before the draft is returned, a parent that moved on since the draft (the merge still goes through), a merge into a parent open in two slots whose next turn runs in the other one, a plain note on such a parent (the slot it was posted to delivers it, once), a parent's turn ending, or the parent being saved, while the card's write runs, fails, or finds the fork made private, a chat made on a deleted parent's key, the same with aworkflow-<run_id>tab of the deleted parent still open (the new chat's first and second turns take none of its cards), a fork made before this version (it merges into its own parent, is refused by a chat made on the key after it, and is refused as unconfirmed, not deleted, when a creation time is missing or has no timezone), a parent deleted and replaced while its card is written (nothing is shown under its key), a parent that cannot be read right after its card is written (the merge is still acknowledged), a turn on one of a parent's two slots taking no more card context than one slot holds, a card's context surviving a save and a restart until a turn takes it (for an idle parent, a parent mid-turn, a rows-only save and a twin parent), a turn whose prompt kiro-cli did not keep (an error before the send, a Stop, an empty-response re-queue: the card goes back to the queue), one that kept it without landing (promise-only with and without its continuation, a leaked tool call, a completed compaction, a backend error after output streamed: the card is marked consumed in a tracked write, is not sent again, and its hold waits for a save that proves its row), a row-less card whose row never committed (its hold survives a failed save, window trimming and the turn) and one whose row did (itsdeliveredmark retires it), and one that completes (its landing save drops the hold; a twin's save, or one whose window predates the row, keeps it marked consumed until a save proves the row, a malformed hold on disk proves nothing, a live copy merged with disk keeps both marks, and consumption loads no pending sidebar twin; no restart, restore while the mark is being written, twin that queued the context first or rows-only handover sends the context again, nor does a failed mark write in the same process or a Stop inside the mark write; a consumed card whose row never committed comes back as its row alone), merges made while a turn reads earlier cards (those cards count toward the limit until that turn ends), a failed turn handing cards back without passing either queue limit, a delivered card rotated out of the live file before a restart, including one a rows-only save wrote (that save marks it delivered too), a card in a channel parent retiring after a restart, after the parent is bound to its thread, and after its context is dropped as another session's, the routes' full-corpus scans running off the event loop, a fork deleted, replaced or given a new chain while its card is written, the fork rewound or a covered reply switched while its card's write holds it (refused as stale, nothing written), a message added after the covered range then (still merged), a running turn's cards keeping their queue seats, a merge refused when the parent's whole context queue is full (no card written), a card whose context the flush cannot queue (the next restore queues it), a user row or an unstamped row claiming a card, the parent's cards, queue or running slot changing while the merge computes its cursor, a denied audit event for every privacy refusal, a parent outside the dashboard (a channel thread, a scheduled job, an unbound channel tab) refused by both routes before anything is read, a parent closed and reopened from History before its next turn (the card's context reaches that turn once and its hold retires, so a restart delivers nothing again), a parent closed while its card is written and then reopened (the card comes back once), a plain note held across a close and a History resume (written once), a History resume of a channel tab's file stem while its colon-form key is live (it returns the live slot), a History resume of a chat aworkflow-<run_id>slot holds (it returns that slot), a create naming the chat beside that slot (the card reaches a turn on either, the new chat's first turn included), a hooked resume publishing the chat beside it, a card held through a restart and a failed turn (delivered once), an app token or a claimless internal-secret caller on either route through the real auth middleware (the uniform 404), and every refusal.test_chat_runner_coverage_merge_cards.pypins that a verbatim replay after an empty response, an image failure, a provider reset after the prompt-busy retries, an owed sub-agent completion or any turn that does not land carries the card once, that a completion held for sign-in keeps no card frame and keeps its completion mark, that a failed replay leaves it queued, and that a refusal's fallback replay carries the card once, because the refused turn consumed it._queue_recoveryre-queues a verbatimmessagewithout the card's frame: the thinking-binding rebuild passes the turn's message, andtest_a_thinking_binding_rebuild_replays_the_card_once, which pins that it carries the card once, fails with that substitution removed.test_recovery_l1_chat_runner.pypins that the first-turn settle and the card's consumption read one_kiro_cli_kept_the_prompt. A process death after output streamed (a typed one and a pipe death) puts the card back on the queue with its hold intact, and the recovery turn sends it once. So does a retained-image recovery that discards the conversation, for a summary over 2,000 characters; a draft taken while a card's write is in flight offers the range again if the write fails, and cannot merge it twice if it commits. A compaction failure after output and a runtime death reported as a stop reason put the card back too, andtest_members_dm_thread.pyshows a vetoed agent switch on a crewmate thread returning its card.test_transcript_derivation_seam.pycovers the guarded full-chain read, including a chain member that joins after validation, and no longer lists merge-back among the plain reads. It also scans the two new publication holds for awaits.test_json_object_body_guard.pyandtest_slot_running_readers.pyregister the merge body's cap and the movedrunningread, andtest_no_config_dir_in_async.pycovers the coroutine inchat_turn/turn_context.py.test_chat_runner_coverage_merge_cards.pypins which context a turn takes from its session's other slots: merge cards for that session only, never a plain note, never across an app or between two incarnations of the session's transcript (a slot that has not read its transcript yet gets the identity in a worker thread, off the event loop), and no more than one slot's queue holds, expired entries taking no place in it (an expired card on another slot opens no identity read), the rest left in place, and that a turn whose session holds no card drains its own queue and changes no other. It also pins that a card queued twice, on the turn's slot and another slot of its session, on two other slots, or twice in one queue, reaches the prompt once and is reported consumed once, that a copy the turn's slot cannot deliver (one stamped with another session) does not stop the deliverable copy from moving, and that plain context posted twice is delivered twice.test_dashboard_chat_fork.py,test_dashboard_chat_lifecycle.py(the delete witness),test_dashboard_chat_history.py(the resume's metadata read) andtest_session_control_create_filing.py: the fork records its parent transcript'screated_at(nothing when it is over-long, and no parent link at all when the parent's key is over-long), both saves write it, and every restore path brings it back, while a saved parent link that is not text or is over-long is discarded on every restore path, with only an over-long one's length logged, so both routes answernot_a_forkandslot_projection.pyprojects no fork link, and acreated_atthat is not text or is over-long restores empty, as on a legacy fork; the delete witness tells a proven delete from an unreadable transcript, whilesession_was_deletedstill refuses on both; the resume reads the transcript's metadata off the event loop;test_deferred_note_persistence.pypins that a hold never merges into a transcript recreated on its key, that only a note's own write makes it durable while it awaits that write, that notes held behind a card's write keep their order and are delivered however that write settles, that a failed flush keeps a card's context, that a tab restored as a sidebar row settles its hold on its first window load and that a flush on a row still pending settles it first (a committed note keeps one row and a card's context is queued once), and the ceilings: 20 plain entries and 10 more for merge cards only, and that a restored entry keeps a boundedid,clsandsession(an over-long id or class is replaced, an over-long session drops the entry).test_flush_exception_safety.pypins that a failed flush puts a note's context back with it,test_slot_metadata_codec.pythat a restore at the 30-entry hold ceiling queues every committed card's context, each counted once, andtest_chat_send_client_meta_survival.pythat/api/chatstripsmergedFromandnoteId.Manual verification
N/A for a person: this PR adds no UI, and its routes have no caller until #15957.
test_chat_merge_back.pydrives both routes end to end through the real handlers and a real conversation log, with a fork made by the real fork route.Screenshots / video
N/A: no UI change. The dashboard and its screenshots are in #15957.
Related Issues
Design: #3816 (comment)
Refs #3816. #15957, stacked on this PR, closes it.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)