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
When switching between devices (desktop → mobile or vice versa), the user starts with an empty conversation rather than being able to continue from where they left off.
Currently:
Each browser has its own tabId (UUID stored in localStorage) and its own express-session cookie
Chat state is stored per userId + tabId, so desktop and mobile have entirely separate histories
There is no concept of a "current conversation" that spans devices
Proposed Solution
Add a primary session concept per GitHub user that allows any device to load and resume the most recently active conversation.
Phase 3a — Shared Conversation History (read)
Primary session metadata file per user: {CHAT_STATE_PATH}/{userId}/primary-session.json
Problem
When switching between devices (desktop → mobile or vice versa), the user starts with an empty conversation rather than being able to continue from where they left off.
Currently:
tabId(UUID stored inlocalStorage) and its own express-session cookieuserId + tabId, so desktop and mobile have entirely separate historiesProposed Solution
Add a primary session concept per GitHub user that allows any device to load and resume the most recently active conversation.
Phase 3a — Shared Conversation History (read)
Primary session metadata file per user:
{CHAT_STATE_PATH}/{userId}/primary-session.json{ tabId, sdkSessionId, model, mode, updatedAt }On WS connect, if the connecting device has no local chat history for its tabId:
primary_session_availablemessage with the historyUI change: new
ContinueSessionbanner component or modalPhase 3b — Active SDK Session Resume
SDK session resume across devices:
sessionIdin the primary session metadataclient.resumeSession(sdkSessionId)to reconnect to the same backend sessionConflict resolution:
:— each device has its own WS pool entryisProcessing)session_takenserver message when another device is actively processing, with a short UI indicatorPhase 3c — Real-time Sync (optional enhancement)
poolSend)Files to Create/Modify
src/lib/server/chat-state-store.tssetPrimarySession()/getPrimarySession()src/lib/server/ws/handler.tsprimary_session_availablesrc/lib/server/ws/session-events.tsturn_endsrc/lib/types/index.tsprimary_session_available,session_takenmessage typessrc/lib/stores/chat.svelte.tsprimary_session_availablemessagesrc/lib/components/ContinueSessionBanner.sveltecomponentNotes
tabIdinlocalStorageis per-browser-profile (not per-tab). Desktop and mobile generate independent UUIDs — no conflict.