Skip to content

The agent that grows with you

test(desktop): a relay lease still defers an edit on a kept gateway; doc the launch-time cost

Teknium9a56be3d8605
diff --git a/apps/desktop/src/store/gateway-kept-routes.test.ts b/apps/desktop/src/store/gateway-kept-routes.test.ts
index 8793a4e1928..e34d7cd8ff2 100644
--- a/apps/desktop/src/store/gateway-kept-routes.test.ts
+++ b/apps/desktop/src/store/gateway-kept-routes.test.ts
@@ -29,6 +29,7 @@ const {
disposeSecondariesForConnection,
openGatewayForAgent,
pruneSecondaryGateways,
+ retainGatewayForRelay,
setPrimaryGateway
} = await import('./gateway')
@@ -80,6 +81,20 @@ it('a kept gateway survives idle pruning, yet an edit to it redials onto the new
release()
})
+it('a relay lease still defers an edit on a kept gateway until it is released; the keep pin never does', async () => {
+ const releaseKeep = keepRoute('homelab', 'default')
+
+ await openGatewayForAgent('homelab', 'default')
+ const releaseRelay = retainGatewayForRelay('homelab', 'default')
+ endpoint = 'wss://homelab.invalid/api/ws?token=new'
+ disposeSecondariesForConnection('homelab', { redial: true })
+ expect(gatewayMocks.connect).not.toHaveBeenCalledWith(endpoint)
+
+ releaseRelay()
+ await vi.waitFor(() => expect(gatewayMocks.connect).toHaveBeenLastCalledWith(endpoint))
+ releaseKeep()
+})
+
it('an unkept route is still pruned when idle and announces nothing', async () => {
const opened = vi.fn()
const off = onKeptRouteOpened(opened)
diff --git a/apps/desktop/src/store/gateway-persistence.ts b/apps/desktop/src/store/gateway-persistence.ts
index 3bc67b4aaf0..679d8fa459d 100644
--- a/apps/desktop/src/store/gateway-persistence.ts
+++ b/apps/desktop/src/store/gateway-persistence.ts
@@ -45,8 +45,8 @@ async function dial(connectionId: string): Promise<void> {
return
}
- // Background priority: a gateway that is down or needs sign-in fails fast and
- // stays throttled; the next tick (or a focus/online nudge) tries again.
+ // A gateway that is down or needs sign-in fails this dial; the next tick
+ // (every REDIAL_INTERVAL_MS) tries again.
await openGatewayForAgent(connectionId, HOME_PROFILE)
}
diff --git a/website/docs/user-guide/multi-connection-desktop.md b/website/docs/user-guide/multi-connection-desktop.md
index 8b74189a888..36482854a3d 100644
--- a/website/docs/user-guide/multi-connection-desktop.md
+++ b/website/docs/user-guide/multi-connection-desktop.md
@@ -152,8 +152,8 @@ instance itself is not touched — you can add it again any time."*
:::info The remote backend is a running `hermes serve` process
Nothing here works unless the backend is actually up and reachable on the
other machine. The desktop app attaches to it; it does not start it for you
-(except for SSH connections, where the app starts the dashboard over the
-tunnel on demand). See
+(except for SSH connections, where the app opens the tunnel and starts the
+dashboard when Desktop launches, since every gateway stays connected). See
[Connecting to a remote backend](./desktop.md#connecting-to-a-remote-backend)
for backend-side setup — auth providers, binding to a non-loopback address,
and Tailscale guidance.
@@ -183,8 +183,11 @@ The union roster is what multi-gateway surfaces (and the built-in
bare name.
- Every registered gateway, SSH included, connects when Desktop starts and
stays connected: its default profile holds one open connection for the life
- of the window and is redialed if it drops. An unreachable gateway reports
- per-row instead of breaking the roster, and Desktop keeps retrying it.
+ of the window and is redialed every 30 seconds while it is down. An
+ unreachable gateway reports per-row instead of breaking the roster. With a
+ remote primary, **This device** is kept connected too when Hermes is
+ installed here, so its local gateway starts with Desktop. Terminals and
+ running work on a gateway keep going when you pick another one.
- Opening an agent dials **its own gateway** — chats, sessions, and memory
live on the machine that owns the profile, exactly as if you were using
that instance directly.