You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cross-device concurrent resume: two writers mint the same session pages and clobber each other's cloud copy #113
While verifying #107, the phone cross-device-resumed a session the desktop was STILL actively writing (d02a0fb7…). Both devices then appended independently:
Phone local tier: pages p25-p29 written 07:12-07:32Z (decrypted: the phone-side conversation, Seeker device stamp)
Desktop: kept appending its own p25-p29+ for the same session through the afternoon
Cloud now holds the desktop's content for those page keys (last flush wins); the phone's branch survives only in the phone's local tier
Why it happens
SessionStore.lastPageIndex() picks the next page from what the opener can SEE at resume time; two live writers each think they own page N. Page keys are {sessionId}__p{N} with no writer fencing, so cloud uploads for the same key race and the loser's branch silently disappears from the cloud (still present in that device's local tier — nothing is unrecoverable today, but the cloud copy is a coin flip per page).
Impact
Silent divergence: each device sees a different history for the same session id; the cloud arbitrates per-page by upload order
I would take option 2. A lease (option 1) adds a coordination blob plus heartbeat expiry semantics, and a stale lease on a dead device blocks resume, which is the wrong failure mode for local-first. Option 3 changes the page key scheme and needs merge-on-read everywhere pages are decoded.
Option 2 is now mostly reuse: SessionStore.fork() landed in packages/core/src/account/store.ts (line 216) and already does the hard part, re-encoding every page under a fresh sessionId with correct per-page meta, with upTo to branch at the resume point. What is left is detection and wiring:
at resume, remember the page index and message count the opener saw
before append, if the current page already holds records this writer did not observe, call fork(srcId, newId, title, upTo) at the observed count and continue on the new id
surface the fork in listMine so the user sees both branches instead of a silent split
No new storage shapes, no fencing, both branches keep a cloud copy. Happy to build this if you want it. Say the word and I will put up a PR.
Updating the old status here: #245 merged on September 17 and addresses the concurrent-writer overwrite with per-device append-only logs merged into one session. It supersedes my earlier fork-on-conflict suggestion.
The PR includes Mac + Seeker and live Drive evidence, plus the pagination regression follow-up. Existing legacy pages remain readable; this does not recover already-overwritten data, and old clients cannot read the new-format messages. Thanks for guiding the implementation!
Activity
RemilioNubilio commentedon Aug 22, 2026
I would take option 2. A lease (option 1) adds a coordination blob plus heartbeat expiry semantics, and a stale lease on a dead device blocks resume, which is the wrong failure mode for local-first. Option 3 changes the page key scheme and needs merge-on-read everywhere pages are decoded.
Option 2 is now mostly reuse:
SessionStore.fork()landed inpackages/core/src/account/store.ts(line 216) and already does the hard part, re-encoding every page under a fresh sessionId with correct per-page meta, withupToto branch at the resume point. What is left is detection and wiring:fork(srcId, newId, title, upTo)at the observed count and continue on the new idNo new storage shapes, no fencing, both branches keep a cloud copy. Happy to build this if you want it. Say the word and I will put up a PR.
NubsCarson commentedon Sep 19, 2026
Updating the old status here: #245 merged on September 17 and addresses the concurrent-writer overwrite with per-device append-only logs merged into one session. It supersedes my earlier fork-on-conflict suggestion.
The PR includes Mac + Seeker and live Drive evidence, plus the pagination regression follow-up. Existing legacy pages remain readable; this does not recover already-overwritten data, and old clients cannot read the new-format messages. Thanks for guiding the implementation!