Conversation
Both root causes are plausibly the real story for "connected once, then silently fell back to This device": anonymous liveness probes against an authenticated gateway accumulate failures until the tracker condemns a healthy connection, and a reachable backend without registry promotion leaves Save-and-reconnect in limbo. The fix direction — Two notes:
|
|
Superseded by #93408. Both root causes here were right, and both are in the consolidated PR: Two changes on top. The The residual gap this PR didn't cover is the one that keeps users stuck: reconciling on apply stops new drift, but an already-drifted registry never heals, so affected users still had to hand-edit Thanks — the diagnosis did the hard part. |
Problem
Hermes Desktop could initially connect to an authenticated remote gateway and load its sessions, then later drop the connection and fall back to
This device.A separate issue affected
Save and reconnect: the remote backend could become reachable without the corresponding registered gateway becomingCurrentorPrimary.Root cause
Two independent issues contributed to the behavior.
1. Remote liveness probes dropped authentication
Primary and pooled remote liveness checks queried the status endpoint through an anonymous fetch path.
For authenticated self-hosted gateways, this could return an authorization failure even though the active OAuth session, native bearer token, or static token was valid.
Those failures accumulated in the liveness tracker until the cached remote connection was treated as stale and replaced.
2.
Save and reconnectupdated only the legacy connection configThe apply path wrote
connection.json, while the Connections UI and active connection identity are resolved through the v2connections.jsonregistry.Migration only runs when the registry does not yet exist. If the registry already contained only the local connection, applying a remote gateway left the two stores divergent.
The backend could therefore connect successfully without having a matching registry
connectionId, preventing the remote connection from becomingCurrentorPrimary.Solution
Primaryand last-used/current.Tests
Added regression coverage for:
Focused tests, ESLint, and TypeScript typechecking pass.
The full Desktop suite was also run on Windows. Remaining failures were unrelated existing platform/environment issues involving POSIX permission and SSH assumptions, locale-dependent formatting, jsdom canvas support, and UI timing.
Manual verification
A Windows x64 unpacked build was tested end-to-end against a real self-hosted Hermes Agent v0.20.5 exposed over public HTTPS with OAuth authentication.
Verified behavior:
Save and reconnectregisters the remote gateway;CurrentandPrimary;This device.No server-side changes are required, and no changes are required to Tailscale, Funnel, DNS, reverse proxy configuration, or other network infrastructure.