Skip to content

fix(desktop): preserve profile for popped-out sessions - #59904

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

fix(desktop): preserve profile for popped-out sessions#59904
goempire72 wants to merge 1 commit into
NousResearch:mainfrom
goempire72:fix/desktop-session-window-profile

Conversation

@goempire72

Copy link
Copy Markdown

Summary

  • pass the owning session profile through Desktop pop-out window actions
  • encode the profile in secondary window URLs before the hash route
  • seed secondary-window gateway boot from the URL profile so route resume targets the right backend
  • add regression coverage for profile-aware secondary window URLs and renderer bridge forwarding

Test plan

  • node apps/desktop/electron/session-windows.test.cjs
  • npm --workspace apps/desktop exec -- vitest run --environment jsdom src/store/windows.test.ts src/store/profile.test.ts src/app/session/hooks/use-route-resume.test.tsx
  • npm --workspace apps/desktop run typecheck
  • npm --workspace apps/desktop run build

Notes

This fixes blank/loading secondary windows in multi-profile Desktop setups where opening a session by ID alone can connect the new renderer to the wrong profile/backend.

@alt-glitch alt-glitch added type/bug Something isn't working comp/desktop Electron desktop app (apps/desktop/*) sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state P2 Medium — degraded but workaround exists labels Jul 7, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related: this is part of the cross-profile Desktop session-resume cluster with #48473 (earliest open, registry-key mechanism), #49619 (route/profile-hint), and #59608 (?profile= URL hint). This PR combines the registry-key (${profile}:${sessionId}) and ?profile= URL-hint approaches. Not a duplicate of any single one — flagging the cluster so a maintainer can pick the canonical implementation.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for isolating a real multi-profile Desktop failure. Current main still omits profile ownership from the active secondary-window path: apps/desktop/electron/session-windows.ts:45-55 constructs URLs without a profile hint, apps/desktop/electron/main.ts:7359-7366 forwards only watch, and boot calls desktop.getConnection() before session refresh completes (apps/desktop/src/app/gateway/hooks/use-gateway-boot.ts:434-479).

Problems

  • The submitted Electron changes target main.cjs and session-windows.cjs, which are absent on current main after 39d09453f95e8aefc0c97e5d9b30ff341cae9ed8; the active implementation is TypeScript.
  • The spectator path remains unhinted: apps/desktop/src/app/chat/composer/status-stack/index.tsx:107 passes only { watch: true }, and ComposerStatusItem has no profile (apps/desktop/src/store/composer-status.ts:16-32).

Suggested changes

  • Port the profile URL/IPC/boot changes to the active TypeScript paths and preserve fallback resolution for stale URLs.
  • Cover every secondary-window opener, including spectator windows, through one ownership-resolution strategy.
  • Add a current regression proving the first secondary-window connection uses the URL profile hint before route resume.

This is an 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