fix(apps): stop Desktop sleep/wake from wiring primary chat to the wrong profile backend - #74552
Conversation
|
Thanks for the focused regression fix. Current main confirms the premise: The PR's no-argument primary lookup matches existing boot and soft-switch behavior at Automated hermes-sweeper review. |
SummaryOne PR addresses #74551. #74552 changes the primary reconnect path to resolve the window-owned backend instead of the active secondary profile, preserves the active secondary descriptor, and adds regression coverage for a primary socket drop while a secondary profile is selected. Related pull requests
Suggested consolidationKeep #74552 open with a salvage path: retain the focused reconnect correction, the active-primary publication guard, and the accompanying secondary-active/primary-drop regression test. It is the only PR in this complex, so there are no competing PRs to close as duplicates. Complex graphflowchart LR
classDef open fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
classDef merged fill:#dcfce7,stroke:#15803d,color:#14532d
classDef closed fill:#e5e7eb,stroke:#6b7280,color:#1f2937
classDef unverified fill:#f3f4f6,stroke:#9ca3af,color:#374151
classDef best stroke-width:3px,stroke:#b45309
classDef target stroke-width:3px,stroke:#4338ca
I74551(["issue #74551 (open)"])
P74552["PR #74552 (open)"]
P74552 -->|best fix| I74551
class I74551 open
class P74552 open
class P74552 best
class P74552 target
click I74551 "https://github.com/NousResearch/hermes-agent/issues/74551"
click P74552 "https://github.com/NousResearch/hermes-agent/pull/74552"
Graph: solid arrow = fixes / best fix, dashed arrow = partial or unverified (see edge label); boxed group = PRs duplicating each other; amber border = best fix; indigo border = target; gray node = closed (state tag in the node label). Cross-PR triage: Reviewed 1 pull request and 1 issue in this complex. Each diff was read against this issue; Assessment working set: 6 kB of PR diffs, 7 kB of issue/PR text, 2 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch. |
|
Merged via #87872 with your commit cherry-picked onto current main — authorship preserved in git history. The fix landed essentially as you wrote it (no-arg getConnection + isActivePrimary publish guard); we added one regression test on top and audited the sibling wake paths (reconnectNow already funnels all wake signals through the fixed seam). Thank you! |
What does this PR do?
Fixes Desktop sleep/wake (and other primary WebSocket drop) reconnect so the window-owned primary gateway always redials the primary backend, not whichever profile is currently active in the sidebar. After concurrent primary+secondary sockets landed, the old single-socket reconnect still passed
$activeGatewayProfileintogetConnection(), which could wire the primary socket (and$connection) to a secondary backend.Bug Cause
attemptReconnectinuse-gateway-boot.tscalleddesktop.getConnection($activeGatewayProfile.get())and thenconnect/publishon the effect-local primaryHermesGateway. That was correct under the old single swapping socket model, but wrong after multi-profile concurrent sockets: primary reconnect must match boot/softSwitch (no-arggetConnection()), while secondaries reconnect viareconnectSecondaryGateways().Reproduction Steps
default).coder) with its own backend so a secondary socket is active.coder.defaultcan keep talking to the wrong backend.Expected: primary reconnect dials only the window backend; secondaries reconnect on their own sockets;
$connection/ active socket /primaryProfileagree.Before fix: primary socket and
publish()can target the secondary backend.Fix
attemptReconnectuses no-arggetConnection()(same as boot/softSwitch).publish()only whenisActivePrimary(), so a background-profile view does not inherit the primary descriptor ([Bug] Desktop (a376ca0): image upload fails on remote profile — "image not found: <local_path>" #46651).Related Issue
Fixes #74551
Type of Change
Changes Made
apps/desktop/src/app/gateway/hooks/use-gateway-boot.ts- primary sleep/wake reconnect dials the window backend; gatepublishonisActivePrimary()apps/desktop/src/app/gateway/hooks/use-gateway-boot.test.tsx- assert primary reconnect ignores the active secondary profile and preserves$connectionHow to Test
npm run test --workspace apps/desktop -- src/app/gateway/hooks/use-gateway-boot.test.tsxChecklist
Code
fix(scope):,feat(scope):, etc.)Documentation & Housekeeping
docs/, docstrings) - N/Acli-config.yaml.exampleif I added/changed config keys - N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows - N/AScreenshots / Logs
N/A