Skip to content

The agent that grows with you

fix(desktop): probe /api/health on pooled SSH dispatch, not /api/status

bennybuoyee8257d6018b
diff --git a/apps/desktop/electron/remote-liveness.test.ts b/apps/desktop/electron/remote-liveness.test.ts
index 454274f9b6b..70e8d453966 100644
--- a/apps/desktop/electron/remote-liveness.test.ts
+++ b/apps/desktop/electron/remote-liveness.test.ts
@@ -284,7 +284,7 @@ describe('ensureHealthyPooledRemoteBackendForDispatch', () => {
})
).resolves.toBe(healthy)
- expect(probe).toHaveBeenCalledWith(healthy, '/api/status', {
+ expect(probe).toHaveBeenCalledWith(healthy, '/api/health', {
timeoutMs: POOLED_REMOTE_DISPATCH_PROBE_TIMEOUT_MS
})
expect(retire).not.toHaveBeenCalled()
@@ -323,7 +323,7 @@ describe('ensureHealthyPooledRemoteBackendForDispatch', () => {
})
).resolves.toBe(replacement)
- expect(probe).toHaveBeenCalledWith(stale, '/api/status', {
+ expect(probe).toHaveBeenCalledWith(stale, '/api/health', {
timeoutMs: POOLED_REMOTE_DISPATCH_PROBE_TIMEOUT_MS
})
expect(retire).toHaveBeenCalledOnce()
diff --git a/apps/desktop/electron/remote-liveness.ts b/apps/desktop/electron/remote-liveness.ts
index 4a65b184ba2..2160abce6b7 100644
--- a/apps/desktop/electron/remote-liveness.ts
+++ b/apps/desktop/electron/remote-liveness.ts
@@ -1,8 +1,10 @@
export const REMOTE_LIVENESS_TIMEOUT_MS = 10_000
// Dispatch is synchronous user intent: a cached descriptor must prove its
-// forwarded endpoint is alive before it can be returned. Reuse the background
-// liveness budget so a quiet-box cold-start (~6-8s) can finish instead of
-// failing the probe and kicking off a reconnect storm.
+// forwarded endpoint is alive before it can be returned. Probe cheap
+// /api/health — not /api/status, whose cold payload (gateway probe, topology,
+// state.db session count) on a fresh SSH forward routinely runs seconds — and
+// reuse the background liveness budget so a quiet-box cold-start (~6-8s) can
+// finish instead of failing the probe and kicking off a reconnect storm.
export const POOLED_REMOTE_DISPATCH_PROBE_TIMEOUT_MS = REMOTE_LIVENESS_TIMEOUT_MS
export const REMOTE_LIVENESS_FAILURE_LIMIT = 3
// Even at the capped retry path, consecutive liveness observations are at most
@@ -100,7 +102,7 @@ export async function ensureHealthyPooledRemoteBackendForDispatch<TConnection ex
return reconnect()
}
- await probe(connection, '/api/status', {
+ await probe(connection, '/api/health', {
timeoutMs: POOLED_REMOTE_DISPATCH_PROBE_TIMEOUT_MS
})
} catch (error) {