Skip to content

ui-server: read one chat-deletion operation's outcome without re-admitting it #3455

Closed

Description

@schlessera

Context

Part of #3234. Ruled by the maintainer on #3231 (D1 A, 2026-11-03). The ruling put this route in #3230's scope, but #3230 closed as completed with the epic's first batch before the ruling could be folded in. This issue carries it instead.

POST /api/chat-deletions (createChatDeletionRoutes, packages/ui-server/src/routes/chat-deletions.ts:39-61) is the only way a client can learn the outcome of a deletion operation. Repeating it with the same operationId retries cleanup, and if the first request never arrived it admits the deletion. A client that lost the reply to its first POST therefore cannot ask what happened without possibly deleting the chat. That is why #3231's "Check now" for an unanswered request (state O2 in #3231 design brief rev 5) cannot be a read on the current contract.

The host already keeps a principal-bound record per operation. chatRetirement, packages/ui-server/src/ws/chat-lifecycle.ts:199, looks one up by (operationId, principalId). The catalog exposes it at packages/ui-server/src/ws/session-catalog.ts:322, and createChatDeletion().delete, packages/ui-server/src/ws/chat-deletion.ts:78, already uses it to build the receipt with chatDeletionReceipt, packages/ui-server/src/ws/chat-deletion.ts:41-44. The receipt shape is ChatDeletionReceipt, packages/ui-sdk/src/protocol.ts:2366-2373, documented under "Explicit chat deletion (additive, #3230)" in docs/http-api.md.

Scope

Add GET /api/chat-deletions/:operationId. It is authenticated and principal-bound, it only reads, and it adds no authority. For the calling principal it answers one of these:

  • the current ChatDeletionReceipt for that operation (same shape and content-free store outcomes as the POST success);
  • not_admitted: no retirement is recorded under that operation for this principal.

An operation recorded for another principal, or not recorded at all, answers the same not_admitted. The answer reveals nothing about other principals' operations or chats.

Out of scope

The #3231 UI. Changing POST semantics, refusal reasons or receipt shape. Any write, retry, cleanup or admission triggered by the read. Listing operations. Recording refused attempts. Owner recording for typed-only chats (#3337).

Acceptance criteria

  • GET /api/chat-deletions/:operationId returns 200 with the current ChatDeletionReceipt when the calling principal has a retirement recorded under that operationId. status and stores reflect the latest recorded cleanup, so a read after a restart or a Retry shows progress.
  • Otherwise it returns a content-free not_admitted answer with one documented status code and body. The response is byte-identical for an unknown operation, another principal's operation and a refused attempt, and never echoes a title, session id, history owner id or backend.
  • The route performs no write. A test proves that calling it for an unknown operationId and then POSTing that operationId behaves exactly like a first POST, and that calling it never starts or resumes cleanup (store outcomes and the running map are unchanged).
  • The same authentication rules as the POST apply: unauthenticated 401; agent, ambient-without-owner-mapping and revoked callers refused without existence leakage. A principal revoked between lookup and response gets 401, not the receipt. Responses carry Cache-Control: no-store, and :operationId is bounded like the POST's ids.
  • not_admitted means nothing was retired under that operation at the moment of the read. docs/http-api.md states this, and states that a request still in transit can be admitted afterwards, in which case chat_retired follows as usual. The read waits for committed catalog writes, as chatRetirement already does.
  • The route is mounted in createApp. It appears in docs/http-api.md (route table and the explicit-deletion section), docs/http-api-coverage.md and the integration-contract index, and the HTTP supported-mount and mount-lifetime fixtures are updated.

Verification

Extend packages/ui-server/tests/chat-deletion.test.ts with real file-backed SQLite. Cover receipt after a successful POST, receipt progress after a partial cleanup and retry, not_admitted for unknown, foreign and refused operations (asserting byte-identical bodies), no admission or cleanup side effect from a read, auth refusals, and the read after a host restart. Run bun run test packages/ui-server/tests/chat-deletion.test.ts packages/ui-server/tests/http-supported-mounts.test.ts, typecheck and bun run check:pr --base origin/main. Keep failing-first and restored mutation receipts for: returning another principal's receipt, a distinguishable foreign versus unknown body, and the read triggering cleanup.

Contract impact

Additive HTTP route and response shape. Label contract, use a CONTRACT-prefixed implementation commit, update the authoritative HTTP docs and the integration-contract index in the same commit, update the API report if a public type is added (for example a not_admitted answer type in @schlessera/brain-ui-sdk/protocol), and add a minor changeset. No existing shape changes.

Filed 2026-11-03 from the maintainer ruling on #3231 D1 (A), which named #3230; #3230 had closed as completed before the ruling was folded.

Activity

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

    @schlessera
    OwnerAuthor

    Claiming (token claim-3455-df71). Branch feat/3455-chat-deletion-read, based on epic/3234-chat-deletion (@ d38eb1e) under the per-epic integration process. Path collisions detected (detection only): #3456 (same epic; docs/http-api.md, chat-lifecycle.ts, session-catalog.ts), #3342, #3386, #3404, #3407, #3443, #3448 (docs/http-api.md / protocol.ts). I'll avoid editing #3456's files beyond the docs table rows.

  4. added this to the 0.45.0 milestone on Nov 3, 2026
  5. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    PR #3473 (against epic/3234-chat-deletion, head cd913e8dc) implements the read-only GET /api/chat-deletions/:operationId. It is ready for review, with milestone 0.45.0. It closes when the epic batch lands on main. Claim retained while the PR is live (claim-3455-df71).

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-servercontractpriority: p2type: feat

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions