feat: sync pinned sessions across multiple GUI apps (#72948) - #72953
Closed
webtecnica wants to merge 1 commit into
Closed
feat: sync pinned sessions across multiple GUI apps (#72948)#72953webtecnica wants to merge 1 commit into
webtecnica wants to merge 1 commit into
Conversation
Collaborator
Related to #62716: both address server-backed cross-device pin membership. This PR adds a narrower pinned-ID read-back endpoint and Desktop pull path, while #62716 implements the broader server-owned migration and live-sync design; they are related rather than duplicates. |
1 task
Collaborator
|
Superseded by #74234, which makes pins server-owned so they survive paging and sync between apps. Your work is carried in it and you're credited as a co-author — thank you. |
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.
Synchronizes pinned sessions across multiple Desktop app instances (Mac + Windows) sharing the same remote gateway. App A's pinned sessions now automatically appear as pinned in App B's sidebar, and vice versa.
Problem
Each Desktop app stores pinned session IDs in
localStorage($pinnedSessionIds). The existingsession-pin-sync.tswrites local pins to the backend (PATCH /api/sessions/{id} {pinned: true/false}) → the backend DB stores the flag correctly. But there was no read-back mechanism: App B never learned about pins App A wrote, so the same session stayed unpinned on App B.Solution
Three changes across backend + desktop:
1. Backend: new endpoint
GET /api/profiles/sessions/pinned-ids?profile=), opens eachstate.dbread-only, and returns every session withpinned=1.{"pinned": [{"id": "...", "profile": "..."}, ...], "errors": [...]}2. Backend:
SessionDB.get_pinned_session_ids()SELECT id FROM sessions WHERE pinned = 1 ORDER BY started_at DESChermes_state.pyright afterset_session_pinned()3. Desktop: pull mechanism in
session-pin-sync.tspullRemotePins(): fetchesGET /api/profiles/sessions/pinned-ids, merges remote pin IDs that aren't already local into$pinnedSessionIds.refreshRemotePins(): exported hook for gateway reconnection.watchSessionPins()now callsschedulePull()on boot + on every$sessionschange → the debounced pull fires 2s after the session list settles.Closes #72948