Skip to content

ui-server: replace the single outgoing draft slot with the G1 snapshot list and 409 DRAFT_OUTGOING_FULL #3588

Closed

Description

@schlessera

Context

Part of #3150. Found while picking up #3155.

#3153 closed on 2026-11-04 with its first acceptance criterion unmet. That criterion, written in under the maintainer's G1 A ruling of 2026-11-03 (#3155 decision and #3153's own decision comment), requires the draft's outgoing to be a list of up to 10 snapshots per chat, with 409 DRAFT_OUTGOING_FULL refused in the creating save's transaction. It says: "The single-outgoing-slot implementation does not satisfy this criterion; a shipped single-slot field needs additive compatibility treatment."

What landed through #3342 is the single slot:

  • DraftOutgoing (packages/ui-sdk/src/protocol.ts:569-574) has { requestId, text, fileIds, state: "held" | "dispatched" }, with no snapshotId, no returned state and no createdAt. Draft.outgoing and DraftSaveRequest.outgoing (protocol.ts:561, :594) are one optional object.
  • The store keeps it in one outgoing_json column (packages/ui-server/src/drafts/store.ts:200, :320-322), and the save sets, clears or keeps that one value (store.ts:493-507, :535-540).
  • DRAFT_OUTGOING_FULL does not exist anywhere in the tree.
  • The decision record says so: "a draft has at most one outgoing snapshot" (docs/decisions/chat-attachments.md, "What ui-server: admit generic chat files and retain specialized content routing #3153 built"). The plan's §6.4 still describes the single slot.

#3155's held-send, recovery-card and queue-full UI (rev 5 §2-§4, browser cases 22-28) consumes this list, so it cannot be built against the shipped field.

Out of scope

The composer UI, the transcript bubbles and their copy (#3155). The upload route, references, pool and sweep, which #3153 delivered. A separate send-intent table, which G1 rejected. Any change to the existing chat_message acceptance semantics beyond moving the matching snapshot's refs to the message.

Scope

Replace the single outgoing slot with the G1 A snapshot list on the host and in the SDK contract, with additive compatibility for the field that shipped on main.

Acceptance criteria

  • A draft carries up to 10 snapshots per chat, each { snapshotId, requestId, text, fileIds, state: held | returned | dispatched, createdAt }, returned on GET /api/drafts/:draftId and set through PUT under the existing If-Match and Idempotency-Key rules.
  • The save that creates a snapshot counts every live snapshot for that chat across tabs and devices in the same immediate transaction and refuses the eleventh with 409 DRAFT_OUTGOING_FULL before any send effect.
  • Cancel (held → returned), upload failure (held → returned), dispatch (held → dispatched) and a recovery read showing non-acceptance (dispatched → returned) edit a snapshot in place by snapshotId and never need a free slot, including at 10 of 10.
  • A slot is released only on confirmed acceptance (that snapshot's refs move to the message in the acceptance transaction), Edit into an empty composer revision, or Delete of a returned snapshot. Nothing is evicted, merged or overwritten. Deleting a returned snapshot starts its files' seven-day clock rather than unlinking them.
  • An ordinary all-ready send also records a dispatched snapshot until acceptance.
  • Every live snapshot's files stay in the draft sub-limit and pool accounting, as the single slot's do now.
  • The shipped single outgoing field gets additive compatibility treatment (or a recorded maintainer ruling if that proves impossible), and docs/plans/chat-attachments.md §6.4 plus the decision record's "What ui-server: admit generic chat files and retain specialized content routing #3153 built" are corrected.

Verification

Tests through bun run test: ten combined slots; the eleventh refused with no chat_message effect; Cancel at 10 of 10; two devices at 9 each racing and exactly one admitted; acceptance moving only the matching snapshot. Mutation: counting only one tab's (or one draft revision's) snapshots fails the race test. bun run check:pr --base origin/epic/3150-attachments.

Contract impact

The draft HTTP contract (docs/integration-contract/wire.md, session drafts) and @schlessera/brain-ui-sdk/protocol change additively: contract label, CONTRACT: commits, same-commit docs and a minor changeset. A breaking retype of the shipped field needs its own ruling first.

Activity

  1. added this to the 0.45.0 milestone on Nov 4, 2026
  2. added
    type: feat
    area: ui-sdk
    area: ui-server
    priority: p2
    agent-ready
    contract
    on Nov 4, 2026
  3. self-assigned this
    on Nov 4, 2026
  4. schlessera commented on Nov 4, 2026

    @schlessera
    OwnerAuthor

    Claiming for implementation (claim token orch-3588-a1). Branch: feat/3588-outgoing-snapshot-list, PR against epic/3150-attachments.

    Collision report: path collision on packages/ui-sdk/src/protocol.ts with draft #3582 (unrelated Apify contract work); closure-only reports otherwise.

  5. schlessera commented on Nov 6, 2026

    @schlessera
    OwnerAuthor

    Delivered on main: #3593 (squash 0ec44c466 on epic/3150-attachments) landed with batch #3656, merge commit 2d6d0e5a5. The batch's full ready-candidate proof (run 42250594660) passed every selected job on that tree. #3656 lists this issue as a closing reference, but GitHub did not close it automatically, so I'm closing it by hand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-readyarea: ui-sdkarea: ui-servercontractpriority: p2type: feat

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions