Skip to content

feat: sync pinned sessions across multiple GUI apps (#72948) - #72953

Closed
webtecnica wants to merge 1 commit into
NousResearch:mainfrom
webtecnica:feat/sync-pinned-sessions-across-apps
Closed

feat: sync pinned sessions across multiple GUI apps (#72948)#72953
webtecnica wants to merge 1 commit into
NousResearch:mainfrom
webtecnica:feat/sync-pinned-sessions-across-apps

Conversation

@webtecnica

Copy link
Copy Markdown
Contributor

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 existing session-pin-sync.ts writes 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

  • Iterates all profiles (or a single ?profile=), opens each state.db read-only, and returns every session with pinned=1.
  • Returns {"pinned": [{"id": "...", "profile": "..."}, ...], "errors": [...]}

2. Backend: SessionDB.get_pinned_session_ids()

  • Lightweight SQL query: SELECT id FROM sessions WHERE pinned = 1 ORDER BY started_at DESC
  • Added to hermes_state.py right after set_session_pinned()

3. Desktop: pull mechanism in session-pin-sync.ts

  • Added pullRemotePins(): fetches GET /api/profiles/sessions/pinned-ids, merges remote pin IDs that aren't already local into $pinnedSessionIds.
  • Added refreshRemotePins(): exported hook for gateway reconnection.
  • watchSessionPins() now calls schedulePull() on boot + on every $sessions change → the debounced pull fires 2s after the session list settles.

Closes #72948

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/desktop Electron desktop app (apps/desktop/*) comp/cli CLI entry point, hermes_cli/, setup wizard area/sessions Session lifecycle, resume, persistence, history sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Jul 27, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

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.

@OutThisLife

Copy link
Copy Markdown
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.

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

Labels

area/sessions Session lifecycle, resume, persistence, history comp/cli CLI entry point, hermes_cli/, setup wizard comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Sync Pinned Sessions Amid Multiple GUI Apps (Mac/Windows)

3 participants