Skip to content

fix(desktop): restore profile sessions in new windows - #59608

Open
SnowMat wants to merge 1 commit into
NousResearch:mainfrom
SnowMat:fix/desktop-session-window-profile-restore
Open

fix(desktop): restore profile sessions in new windows#59608
SnowMat wants to merge 1 commit into
NousResearch:mainfrom
SnowMat:fix/desktop-session-window-profile-restore

Conversation

@SnowMat

@SnowMat SnowMat commented Jul 6, 2026

Copy link
Copy Markdown

Summary

  • pass the owning profile through the Desktop openSessionWindow bridge into secondary-window URLs
  • read the pre-hash profile query hint during route resume and probe that backend before the default/active profile
  • graft the resolved profile onto cached session rows when the backend response omits it
  • add regression coverage for URL construction, bridge option forwarding, profile query parsing, and hinted profile resolution

Why

Secondary Desktop windows start with fresh renderer stores. If an existing session is opened with only #/SESSION_ID, the new renderer can try to resume before it knows the session's owning profile. In multi-profile installs this can hit the wrong/default backend and render an effectively blank session window with only the composer.

The fix keeps the existing hash route intact but adds routing metadata before the hash, e.g. ?win=secondary&profile=mission-control#/SESSION_ID, so HashRouter still receives the session id while the resume path can select the correct backend immediately. Stale/copied URLs without a profile hint keep the previous fallback probing behavior.

Verification

  • node --test apps/desktop/electron/session-windows.test.cjs
  • npm run --prefix apps/desktop test:ui -- src/store/windows.test.ts src/app/session/hooks/use-session-actions/utils.test.ts
  • npm run --prefix apps/desktop typecheck
  • npm run --prefix apps/desktop lint (passes with one pre-existing warning in src/app/settings/model-settings.tsx)
  • Local packaged Desktop build installed and manually verified: opening an existing profile-owned session in a new window restores the transcript instead of showing only the composer.

Secondary Desktop windows start with empty renderer stores, so route-only session ids can resume against the wrong/default profile before the owning session row is known. Pass a pre-hash profile hint through the open-window bridge and use it before fallback session probing.\n\nAdds regression coverage for secondary-window URL construction, bridge option forwarding, query parsing, and hinted profile resolution.
@alt-glitch alt-glitch added type/bug Something isn't working comp/desktop Electron desktop app (apps/desktop/*) P2 Medium — degraded but workaround exists sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state labels Jul 6, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for isolating a real multi-profile Desktop resume failure. Current main still builds secondary-window URLs without a profile hint (apps/desktop/electron/session-windows.ts:45-55) and the IPC bridge forwards only watch (apps/desktop/electron/main.ts:7359-7366).

Problems

  • The same profile-loss class remains for spectator windows: apps/desktop/src/app/chat/composer/status-stack/index.tsx:106-107 opens a child session with { watch: true }, while ComposerStatusItem has no profile field (apps/desktop/src/store/composer-status.ts:16-32).
  • The submitted CJS implementation is now conflicting and targets files that were migrated to TypeScript. Current equivalents are apps/desktop/electron/main.ts and apps/desktop/electron/session-windows.ts.

Suggested changes

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform area/sessions Session lifecycle, resume, persistence, history area/profiles Multi-profile isolation, HERMES_HOME scoping labels Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/profiles Multi-profile isolation, HERMES_HOME scoping area/sessions Session lifecycle, resume, persistence, history comp/desktop Electron desktop app (apps/desktop/*) P2 Medium — degraded but workaround exists sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform 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/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants