Repository navigation
CONTRACT: fix(ui-server): let another owner login continue a chat's retained voice history (#3963) - #4139
Merged
Conversation
…etained voice history (#3963) Every owner sign-in is its own principal, and a chat's retained dialogue belonged to the exact login that started it, so a second device's login was refused with "Dialogue ownership mismatch". Under the maintainer's ruling (option A) the history now belongs to the account, as its safety history does since #3952/#3962. `dialogueOwner` decides history access with `sameAccount` over the owner row's stored account (089's `principal_account`), so owner/session/alias lookup, opening, binding and adoption, reads, writes and close accept another owner login, also after the starting login is pruned. A typed-first chat's first voice reuses the chat's safety owner from any login of its account; a safety owner of another account, or with unknown or contradictory evidence, is refused rather than forked. The retained-conversation list and live dialogue pages and storage errors reach every login of the account and nobody else. Live-epoch authority stays exact and separate from history ownership. Migration 090 records the opening login on each dialogue conversation (backfilled from its owner, which was always the opener before this change); only that login reopens or closes it. The catalog's active epochs carry their opening principal, and liveness checks compare the owner's attribution and account instead of the caller. Native voice recovery of any login of the account, or of a pruned login, keeps a chat legacy; another login's unclosed epoch still marks it partial. Attribution, records, aliases, generations and deletion's exact-principal rule are unchanged, and nothing enters provider history. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…k additive (#3963) The owner the host needs to reach every login of the account is now an optional third argument after the unchanged page and principalId, so an existing two-argument callback still fits. The api report and the package component record the three optional additions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
Independent reviewReviewed head f853cb5 against base be0bb07. Reviewer: agent. 1 finding: 0 fixed, 0 filed, 0 rejected, 1 without a disposition. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4139,
"head": "f853cb55beca1fa1720604b8448b515fa78cbb2e",
"base": "be0bb0708e693e5492d63a10af38b112bfc3a6c0",
"reviewer": "agent",
"outcome": "findings",
"findings": [
{
"summary": "packages/ui-server/src/ws/dialogue-storage.ts:303: appendDialogue checks a voice source's owner, epoch and provider but never its new conversation principal_id. With account-wide dialogueOwner access, login B can append voice, interruption or end evidence to login A's epoch by supplying its identifiers. This misses #3963's explicit refusal of submissions to another principal's pending epoch; the journal must also pass the opening login when enforcing this guard."
}
]
} |
…och (#3963) appendDialogue checked a voice-sourced record's owner, epoch and provider, but not the login that opened its conversation. With account-wide history access another owner login could append voice, interruption or end evidence to the first login's epoch by naming it. Storage now requires the appending principal to be the conversation's recorded opener, and the journal writes each epoch's evidence as its own scope's login instead of the history owner's attribution. Backend evidence is still written as the history owner. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
Independent reviewReviewed head f853cb5 against base be0bb07. Reviewer: agent. 1 finding: 1 fixed, 0 filed, 0 rejected, 0 without a disposition. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4139,
"head": "f853cb55beca1fa1720604b8448b515fa78cbb2e",
"base": "be0bb0708e693e5492d63a10af38b112bfc3a6c0",
"reviewer": "agent",
"outcome": "findings",
"findings": [
{
"summary": "packages/ui-server/src/ws/dialogue-storage.ts:303: appendDialogue checks a voice source's owner, epoch and provider but never its new conversation principal_id. With account-wide dialogueOwner access, login B can append voice, interruption or end evidence to login A's epoch by supplying its identifiers. This misses #3963's explicit refusal of submissions to another principal's pending epoch; the journal must also pass the opening login when enforcing this guard.",
"disposition": "fixed",
"commit": "2ba7d12fc90725f640dee2e6974544cf6148edd8"
}
]
} |
Owner
Author
Independent reviewReviewed head 2ba7d12 against base be0bb07. Reviewer: agent. 1 finding: 0 fixed, 0 filed, 0 rejected, 1 without a disposition. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4139,
"head": "2ba7d12fc90725f640dee2e6974544cf6148edd8",
"base": "be0bb0708e693e5492d63a10af38b112bfc3a6c0",
"reviewer": "agent",
"outcome": "findings",
"findings": [
{
"summary": "packages/ui-server/src/ws/session-catalog.ts:366: Cross-login adoption skips updating active owner references when login B binds login A's provisional conversation. If it merges into B's existing history, activeEpochFor rejects the stale attribution and falsely reports partial coverage; journal callbacks also retain the obsolete owner identity. Reproduced with real SQLite/catalog: a healthy open conversation becomes partial immediately after the cross-login bind."
}
]
} |
…provisional history (#3963) The catalog updated its live scopes' owner identity after a bind only when the binding login had opened the conversation. When login B's typed turn adopted login A's live provisional history into B's session history, A's scope kept the retired owner and its attribution, so activeEpochFor no longer recognised the healthy epoch and reads reported partial, and the journal kept publishing the obsolete owner id. Every live scope of the previous owner now takes the canonical identity in place, whoever bound it; epoch authority stays with each scope's own principal. The journal's adoption path also replaced a live conversation's owner object with a freshly read copy and deleted the mapping until the bind settled, dropping that epoch's voice in the meantime. A live conversation now keeps its own object through adoption. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
Independent reviewReviewed head 2ba7d12 against base be0bb07. Reviewer: agent. 1 finding: 1 fixed, 0 filed, 0 rejected, 0 without a disposition. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4139,
"head": "2ba7d12fc90725f640dee2e6974544cf6148edd8",
"base": "be0bb0708e693e5492d63a10af38b112bfc3a6c0",
"reviewer": "agent",
"outcome": "findings",
"findings": [
{
"summary": "packages/ui-server/src/ws/session-catalog.ts:366: Cross-login adoption skips updating active owner references when login B binds login A's provisional conversation. If it merges into B's existing history, activeEpochFor rejects the stale attribution and falsely reports partial coverage; journal callbacks also retain the obsolete owner identity. Reproduced with real SQLite/catalog: a healthy open conversation becomes partial immediately after the cross-login bind.",
"disposition": "fixed",
"commit": "d34c080dba56222ef8afdcb76039c6ea02bb08dc"
}
]
} |
3 of 5 tasks
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
Independent reviewReviewed head 2274f53 against base 1140799. Reviewer: agent. No findings. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4139,
"head": "2274f53bf89fa43e5f367f7265128f3c991780b5",
"base": "1140799f2f13a37b1fee8f1fa8fe46c171966789",
"reviewer": "agent",
"outcome": "no-findings",
"findings": []
} |
10 tasks done
schlessera
marked this pull request as ready for review
November 17, 2026 06:10
This was referenced Nov 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3963
What changed
A chat's retained voice history now belongs to its account, as its safety history does since #3952/#3962. Each owner sign-in is its own principal, so before this a second device's login was refused with
Dialogue ownership mismatchwhen it opened voice in an existing chat. Now another owner login can open voice on the chat's history bysessionIdorhistoryOwnerId. It can read the history, bind and adopt it, and it receives its live pages and dialogue storage errors. This still works after the login that started the chat has been pruned. A typed-first chat's first voice, from either login, reuses the chat's safety history owner instead of forking a second one. Live conversations and epochs stay with the exact login that opened them: another login of the account starts a new conversation on the shared history and cannot reopen or close someone else's. Agent, ambient, system and unknown principals still match only themselves. Exact-principal deletion is unchanged.dialogueOwner(packages/ui-server/src/ws/dialogue-storage.ts), which usessameAccountwith the owner row's storedprincipal_accountfrom 089. Every lookup, open, bind, read, write and close path goes through it.safety_sessionsby account. A safety owner from another account, or with unknown or contradictory evidence, is refused.090_dialogue_conversation_principal.sqladdsdialogue_conversations.principal_idand backfills it from each row's owner. Before this change the owner was always the login that opened the conversation.openDialoguerefuses to reopen a known conversation for a different login, andcloseDialoguerefuses to close another login's conversation. The catalog'sActiveDialogueEpochcarries its openingprincipalId. Liveness compares the owner's attribution and account, not the caller.hasUnretainedVoicecounts native voice recovery from any login of the account and from a login whose row is gone, so the chat stayslegacy. Another login's unclosed epoch still makes coveragepartial.GET /api/sessions?includeRetainedConversations=truelists the account's host-only histories, using SQL that mirrorssameAccountwithIScomparisons. Livedialogue_historypages and dialogue storage errors go to every connected login of the account (dialogueAudience) and to no other account.DialogueOwner.principal_account?,SessionCatalog.dialogueAudience?and an optional thirdownerargument on theDialogueJournalpublish callback are all optional, and the api report is regenerated.Why this shape
The maintainer chose option A on the issue (2026-11-11). This reuses #3962's ownership model (
principal_accountondialogue_ownersandsameAccount) and adds no second ownership store. The newdialogue_conversations.principal_idis per-conversation attribution and authority. It grants no history access. It is needed because a shared history otherwise leaves the storage layer nothing to stop one login from closing or reopening another login's epoch.conversation_epochswas rejected for that job: it is LRU-pruned to 64 rows and written only after the open.Proof
bun run check:pr --base origin/main # passed at 2274f53bf, receipt belowNew keyless test file
packages/ui-server/tests/dialogue-account-ownership.test.tshas 15 tests on real SQLite with real principals and the realprunePrincipalscleanup path. It covers the storage, catalog,GET /api/sessionsroute and a live start throughWsHostwith the offline fake live provider.Failing first, with
packages/ui-server/srcandmigrationschecked out fromorigin/main: 12 of 13 tests fail. The original same-owner mismatch iserror: Dialogue ownership mismatchatdialogue-account-ownership.test.ts:81, where the home login opens voice with the ship'shistoryOwnerId. The typed-first test fails onDIALOGUE_TYPED_FIRST_REUSES_THE_SAFETY_OWNER(a divergent owner was created), and the live start never opens for the second login.Mutations, each restored, with the named assertion that failed:
openDialoguestoresprincipal_accountNULL (removes durable ownership)Dialogue ownership mismatchat test line 129 (DIALOGUE_PRUNED_ORIGIN_READS), for both revoked and expired; alsoDIALOGUE_LIST_INCLUDES_PRUNED_LOGINS_HISTORYdialogueOwneradmits any caller to an owner-account historyDIALOGUE_FOREIGN_READ_REFUSED_AFTER_PRUNING: agent,DIALOGUE_FOREIGN_OPEN_REFUSED: agent sessionId,DIALOGUE_CONTRADICTED_EVIDENCE_REFUSED; in the live start the foreign login openedcloseDialoguedrops the opening-login checkDIALOGUE_OTHER_LOGIN_CANNOT_CLOSE_AN_EPOCH,DIALOGUE_CATALOG_REFUSES_FOREIGN_EPOCH_CLOSEdialogue_history(checkpoint forhome.of("dialogue_history"))appendDialoguedrops the conversation-opener check (review finding)DIALOGUE_OTHER_LOGIN_CANNOT_WRITE_AN_EPOCH: voice(receivedadmitted)Dialogue source scope mismatchon the second login's own speech (DIALOGUE_LIVE_SECOND_LOGIN_WRITES_ITS_EPOCH)DIALOGUE_CROSS_LOGIN_ADOPTION_STAYS_HEALTHY(expectedcomplete, receivedpartial)DIALOGUE_ADOPTION_KEEPS_LIVE_INGRESS(expectedtrue, receivedfalse)Existing tests: the 15 affected files (dialogue storage/queue/drain/deadline, conversation and live history, chat lifecycle, principals, #3962's safety-account partition) give 192 pass and 0 fail. A wider set of 132 ui-server files gave 1872 pass and 59 fail. All 59 are in 10 host-boundary/bwrap files, and those 10 files produce an identical failure set with
origin/main's source on this host (no unprivileged user namespaces).bun run buildandbun run typecheckare clean. The api-surface test passes after regeneratingapi-report/ui-server.txt.Provider history: no provider-facing path changed. The live test checks that the first session's seed is byte-identical after the second login continues, and that no ownership metadata reaches the provider options. Both keyless guards (
ui-backend-claudeandui-backend-piprovider-history.test.ts) could not run on this host. Both fail at worker launch withbwrap: No permissions to create a new namespace, also with sandbox escalation, so they are left to hosted CI.{"version":1,"kind":"brain-check-pr-receipt","head":"c4ade520e78976a6ced73a2a010b40a0620885a0","base":"origin/main","mode":"focused","startedAt":"2026-11-17T06:06:47.611Z","finishedAt":"2026-11-17T06:07:56.567Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":12650.619726},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":110.70801299999948},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":67.22769200000039},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":19.96509800000058},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":56090.941141}]}Review finding (record on this PR, reviewed head
f853cb55b):appendDialoguedid not check a voice-sourced record's conversation opener. It was reproduced failing first by the new test "another login of the account cannot write voice evidence into an epoch it did not open":DIALOGUE_OTHER_LOGIN_CANNOT_WRITE_AN_EPOCH: voiceexpectedDialogue source scope mismatchand receivedadmitted. It is fixed in2ba7d12fc: storage requires the opener, and the journal writes each epoch as its own login. Audit of the other write paths that take a conversation: reopen (openDialogue) and close (closeDialogue) already check the opener; voice, interruption and end appends now do.bindDialoguedeliberately stays history-level: adoption keys a provisional owner by the first conversation's id, binds the owner and changes no epoch state. Backendrequest/textevidence has no conversation.saveConversationEpoch/saveConversationTaskwere already exact-principal.Second review finding (reviewed head
2ba7d12fc): when login B adopted login A's live provisional history into B's session history, the catalog skipped updating A's live scope. It was reproduced failing first by the test "another login's adoption of a live provisional history keeps its live identity and healthy coverage", which uses real SQLite, the catalog andDialogueJournal:DIALOGUE_CROSS_LOGIN_ADOPTION_STAYS_HEALTHYexpectedcompleteand receivedpartial. It is fixed ind34c080db. Every live scope of the previous owner now takes the canonical identity in place, whoever bound it, and the bind returns the shared live object, so journal callbacks and published pages name the canonical owner. Grepping the adoption path turned up one more instance of the same class. The journal'sbackend()adoption replaced a live conversation's owner with a fresh copy and deleted the mapping until the bind settled, so the live epoch's voice was dropped meanwhile (voice()returned false; pre-existing, also for one login). That is fixed in the same commit. Pending opens resolve stale ids through the alias, and storage'sbindDialogueflattens alias chains, so neither keeps a stale reference.Proportionate containment (changed ownership guards)
DIALOGUE_UNRELATED_CHAT_USABLE).DIALOGUE_UNAVAILABLEor conversation start error. Stored evidence is not rewritten.Checklist
0.45.0on the PR and ui-server: an owner continuing a chat by voice from another device is refused as a dialogue ownership mismatch #3963..changeset/3963-dialogue-account-ownership.md.CONTRACT:commits.Anything left open
resolveChatsees two principals and neither login can delete it. Deletion keeps its exact-principal rule by this issue's scope; the follow-up asks for a ruling.loadConversation) remain exact-principal per conversation. A second login's live history includes the first login's dialogue records and native messages, but not that login's stored host facts.Collisions (
bun scripts/collisions.ts --json --pr) at head2274f53bf: closure #3056; closure #3059; closure #3069; closure #3581; textual #3622; closure #4002; closure #4036; closure #4102. The textual one (#3622) is documentation only (docs/http-api.md,docs/integration-contract/package-api.md), and there is no path collision inpackages/ui-server/src.🤖 Generated with Claude Code