Skip to content

ui-server: decide owner bindings so typed-only chats can be deleted #3337

Closed

Description

@schlessera

Context

Found while implementing #3230. The retirement ledger from #3228 resolves a chat's owner only from recorded host ownership: a dialogue owner (created by a live conversation or by adopting a host-only history) or a voice conversation epoch (resolveChat, packages/ui-server/src/ws/chat-lifecycle.ts:77-116). A chat that only ever had typed turns has neither, so POST /api/chat-deletions refuses it as unavailable. That is the approved conservative default ("native-only legacy ownership is never guessed"), but it means most typed chats cannot be deleted today.

Part of #3234.

Decision (maintainer, 2026-11-02, confirmed 2026-11-03): option 1

When an authenticated typed request creates a backend session, record a minimal, content-free owner row (principal, session). New typed chats become deletable by their owner. Legacy chats with no binding keep refusing as unavailable; ownership is never guessed for them. This creation-owner record is its own concept, with semantics distinct from the existing dialogue owner. It must not create, imply or change a dialogue owner, and it must not change dialogue paging or retention for undeleted chats. The deletion decision record documents the difference.

Rejected: option 2, keeping today's behaviour (only chats with voice or host-only history are deletable) and explaining the refusal in #3231's copy.

Scope

Write the owner row on the session-creation path for an authenticated typed request, make resolveChat accept it as positive ownership for deletion, and include it in retirement so deleting the chat removes or fences it like the other host ownership records.

Out of scope

Backfilling or inferring owners for legacy chats. Changing dialogue-owner creation, dialogue paging or retention. New deletion authority for agents, ambient callers without an owner mapping or foreign principals. UI copy (#3231).

Acceptance criteria

  • A typed-only chat created after the change can be deleted by its owner through POST /api/chat-deletions.
  • A typed-only chat created before the change still refuses as unavailable.
  • A foreign principal still refuses without existence leakage, with the same body as an unknown chat.
  • The row holds no content (no title, prompt text or excerpt). Writing it does not create a dialogue owner and leaves dialogue paging and retention for undeleted chats byte-identical. A test asserts the dialogue pages of an undeleted typed chat before and after the change.
  • docs/decisions/chat-history-deletion.md records the creation-owner record, how it differs from the dialogue owner and why legacy chats are not backfilled. docs/plans/chat-history-deletion.md is updated where it describes owner resolution.
  • A keyless, file-backed SQLite test proves the first three criteria. Keep a failing-first or restored mutation receipt: removing the creation-time write makes the new-chat deletion refuse, and resolving owners without the row makes the legacy case still refuse.

Verification

bun run test packages/ui-server/tests/chat-deletion.test.ts plus the session-creation and dialogue suites the change touches, typecheck and bun run check:pr --base <epic base>. Record the mutation receipts in the PR.

Contract impact

None on the wire. More chats become deletable, but the POST /api/chat-deletions request, receipt and refusal shapes are unchanged. A migration for the owner row is internal storage. If the change adds a capability flag or a client-visible field, classify it under the integration contract first.

Triage 2026-11-03: folded the maintainer ruling (option 1, content-free creation-owner row, distinct from dialogue owner, documented in the deletion decision record) into the body; replaced the open question.

Blocked by #3461

2026-11-03: PR #3456's ready-candidate runtime_host (run 41622134234) failed on the maintenance-busy automatic-index race filed as #3461. That race exists independently of this change. Under the strict-flake rule the proof is not rerun into green; this issue waits on #3461.

Activity

  1. added
    type: featA new capability or a change in user-visible behaviour.
    area: ui-serverHono app factory: turn coordinator, auth, session catalog, routes, cron.
    priority: p2Wanted, not scheduled. Pulled in when a milestone has room.
    needs: decisionBlocked on a maintainer or designer ruling, not on code.
    on Nov 2, 2026
  2. schlessera commented on Nov 2, 2026

    @schlessera
    OwnerAuthor

    Decision (maintainer, 2026-11-02): option 1. When an authenticated typed request creates a backend session, record a minimal content-free (principal, session) owner binding. New typed chats then become deletable by their owner through POST /api/chat-deletions. Legacy chats with no binding still refuse as unavailable, and foreign principals still refuse without revealing whether the chat exists. The binding must not change dialogue paging or retention for undeleted chats. Where it differs from the existing dialogue-owner semantics, document the difference in the deletion design.

  3. added
    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.
    needs: decisionBlocked on a maintainer or designer ruling, not on code.
    and removed
    needs: decisionBlocked on a maintainer or designer ruling, not on code.
    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.
    on Nov 2, 2026
  4. self-assigned this
    on Nov 3, 2026
  5. added this to the 0.45.0 milestone on Nov 3, 2026
  6. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Claim claim-3337-7a7d: picking this up on branch feat/3337-typed-chat-owner-binding, based on epic/3234-chat-deletion at d38eb1eb5. The PR targets the epic branch.

    Label correction (2026-11-03): needs: decision was re-added at 10:00Z, apparently from the stale 08:52 epic summary. The maintainer ruling already selects option 1, so I restored agent-ready and removed needs: decision. Milestone 0.45.0.

    Path collisions reported (detection, not locks): #3342, #3386, #3404, #3407, #3446 touch bridge.ts, session-catalog*.ts or docs/plans/chat-history-deletion.md. #3342 also adds a 075_ migration on another epic branch.

  7. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Decision (maintainer, 2026-11-03): option 1 is confirmed. When a typed request creates a session, record a minimal content-free owner row (principal, session). Legacy chats keep refusing as unavailable, and dialogue paging and retention must not change. The record's semantics are distinct from the dialogue owner, and that difference must be documented in the deletion decision record (docs/decisions/chat-history-deletion.md).

    The body now carries this ruling in place of the open question. Its acceptance criteria add the dialogue-pages invariance test and the decision-record update, and the 2026-11-02 ruling's other criteria are unchanged. Labels already match: needs: decision was removed earlier today, and agent-ready stays. This is for the current claimant's information; nothing else changes.

  8. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Implementation is in #3456, based on epic/3234-chat-deletion at d38eb1eb5, head 3cbdf5a3e, milestone 0.45.0. It is marked ready, and hosted candidate proof is requested.

    • Behaviour: a typed chat whose session an authenticated request creates records a content-free owner binding (migration 075), so its owner can delete it. Chats that existed before, and native-only sessions first seen on a resume, still refuse as unavailable. Foreign callers get the same answer as for a chat that does not exist.
    • Proof: a keyless file-backed SQLite test through the real host, bridge, write worker and endpoint, with 6 mutation receipts. check:pr passed.
    • Gap: the provider-history guard runs only in hosted CI, because this host lacks unprivileged user namespaces.

    The issue closes when the epic batch lands on main. The claim stays while the PR is live.

  9. added
    blockedWaiting on another issue or an upstream dependency. Say which in the body.
    on Nov 3, 2026
  10. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    PR #3456's ready-candidate runtime_host failure (run 41622134234) was diagnosed as a maintenance-admission race that exists independently of this change, not a regression. It is filed as #3461. This issue now carries Blocked by #3461 and blocked. Details are on the PR. The implementation stays on PR #3456 at head 3cbdf5a3e.

  11. removed
    blockedWaiting on another issue or an upstream dependency. Say which in the body.
    on Nov 3, 2026
  12. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Blocker #3461 closed: its fix, #3467, merged to main as 1ea260971. Removing blocked. PR #3456 on epic/3234-chat-deletion can be refreshed and proved.

  13. schlessera commented on Nov 4, 2026

    @schlessera
    OwnerAuthor

    Epic #3234 batch 3 landed on main through #3551 as merge commit b9e3c112aa942fad81133848a32baef3e416ac6e (parents 2fa67923d and 15f40f32c, the squash of #3456). The ready-candidate proof is CI run 41782439539: all 17 selected jobs passed on checkout 7695d2f1f, whose tree 4167aceaa is the landed tree.

    Delivered:

    Still open, so this issue stays open: one acceptance criterion requires docs/decisions/chat-history-deletion.md to record three things:

    • the creation-owner record
    • how it differs from the dialogue owner
    • why legacy chats are not backfilled

    The landed decision record has none of this; it is described only in the plan doc ("Built (#3337)"). Next action: a docs-only PR that adds this ruling to the decision record and cites the plan section. That PR closes this issue.

  14. schlessera commented on Nov 4, 2026

    @schlessera
    OwnerAuthor

    Closed by #3555 (squash facdca80d on main, candidate run 41788256427). docs/decisions/chat-history-deletion.md now records three things: the content-free creation-owner record, how it differs from the dialogue owner, and why legacy chats are not backfilled. Milestone 0.45.0.

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

Metadata

Metadata

Assignees

Labels

agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.area: ui-serverHono app factory: turn coordinator, auth, session catalog, routes, cron.priority: p2Wanted, not scheduled. Pulled in when a milestone has room.type: featA new capability or a change in user-visible behaviour.

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions