Repository navigation
Description
Context
Part of #3150. Found while building #3155's held snapshots on the #3588 snapshot list.
accept (packages/ui-server/src/drafts/store.ts:806-862) releases the accepted request's snapshot with UPDATE session_drafts SET outgoing_snapshots = ? (store.ts:821-823), and does not bump revision whenever the draft is kept (row.revision !== revision or a source mismatch, store.ts:837-845). A tab or device that read the draft before the acceptance still holds the released snapshot in its list. Its next PUT /api/drafts/:draftId passes If-Match, because the revision did not move, and lists that snapshot again. nextSnapshots (store.ts:362-412) finds no prior for its snapshotId (store.ts:389) and treats it as a new one, so the accepted send comes back as a dispatched snapshot. That phantom holds one of the chat's ten slots until someone runs Check, then Delete…, and its file references go back to outgoing.
Scope
- A save cannot recreate a snapshot whose request the host already accepted for that draft.
- A save carrying a stale snapshot list is refused or reconciled, never silently applied.
Out of scope
The client's handling (#3155) and the single-slot outgoing compatibility write, beyond applying the same rule to it.
Acceptance criteria
- A ui-server test, failing first on the current tree: save a draft with a
dispatchedsnapshot, accept its request with the draft kept (a newer revision exists), thenPUTthe old snapshot list under the currentIf-Match. Afterwards no snapshot names thatrequestId, the chat's live count is unchanged, and nooutgoingref points at its files. - Either rule makes that test pass: the acceptance bumps
revisionwhenever it changesoutgoing_snapshots, so the stale save gets409 DRAFT_CONFLICTwithcurrent; ornextSnapshotsrefuses a new snapshot whoserequestIdis insession_draft_sendsfor that draft. The choice and why are recorded indocs/decisions/chat-attachments.md("What ui-server: replace the single outgoing draft slot with the G1 snapshot list and 409 DRAFT_OUTGOING_FULL #3588 built"). - The HTTP API doc's snapshot rules state the behaviour (
docs/http-api.md#outgoing-snapshot-list-additive-0450-3588).
Verification
bun run test for the drafts store and route tests, plus bun run check:pr --base origin/main.
Contract impact
If the revision bump is chosen, a save after an acceptance can newly get 409 DRAFT_CONFLICT. That is within the documented If-Match contract, but it is documented anyway, and the PR carries the contract label and a minor ui-server changeset.
Activity
fix(ui-react): draw no transcript node while no outgoing snapshot nee…
CONTRACT: feat(ui-react): keep each send as an outgoing snapshot and …
fix(ui-react): draw no transcript node while no outgoing snapshot nee…
CONTRACT: feat(ui-react): keep each send as an outgoing snapshot and …
schlessera commentedon Nov 15, 2026
Claimed for implementation. Claim token:
claim-b7a10469. Branch:fix/3733-stale-snapshot-save.collisions: closure-only with draft #3056; no path collisions
CONTRACT: fix(ui-server): version a kept draft when an acceptance rel…
schlessera commentedon Nov 16, 2026
Merged in #4068 as
437ac873ethrough the integration lease (orchestrator merge queue for 0.45.0). Candidate confirmation passed on the exact head; the squash's own main run carries the post-merge heavy categories.