Skip to content

The agent that grows with you

test(desktop): backoff tests also pin that the loop is alive (lower bound)

kshitijk4poor7cbdb5cf8bd1
diff --git a/apps/desktop/src/app/gateway/hooks/use-gateway-boot.test.tsx b/apps/desktop/src/app/gateway/hooks/use-gateway-boot.test.tsx
index fbb6eec67f7..eb13cc0ad8c 100644
--- a/apps/desktop/src/app/gateway/hooks/use-gateway-boot.test.tsx
+++ b/apps/desktop/src/app/gateway/hooks/use-gateway-boot.test.tsx
@@ -1404,6 +1404,7 @@ describe('useGatewayBoot remote reconnect loop (real hook, fake socket)', () =>
// Attempt 0 forever redials every 150ms (~80 sockets / 12s — the reporter's
// 55 opens / 12s). A climbing ladder reaches the 15s cap in ~7 dials.
+ expect(FakeWebSocket.instances.length).toBeGreaterThanOrEqual(5)
expect(FakeWebSocket.instances.length).toBeLessThanOrEqual(10)
})
diff --git a/apps/desktop/src/store/gateway.test.ts b/apps/desktop/src/store/gateway.test.ts
index bc31dc00a08..3352dc63b2c 100644
--- a/apps/desktop/src/store/gateway.test.ts
+++ b/apps/desktop/src/store/gateway.test.ts
@@ -435,6 +435,8 @@ describe('secondary reconnect backoff (#83134)', () => {
await vi.advanceTimersByTimeAsync(12_000)
// Ladder from attempt 0: ≤ ~8 dials in 12 s; a reset-per-failure loop makes ~40+.
+ // Deterministic ladder 150/300/…/4800 ms ⇒ 6–7 redials in 12 s: alive, but climbing.
+ expect(gatewayMocks.connect.mock.calls.length).toBeGreaterThanOrEqual(5)
expect(gatewayMocks.connect.mock.calls.length).toBeLessThanOrEqual(10)
})
@@ -455,6 +457,8 @@ describe('secondary reconnect backoff (#83134)', () => {
await vi.advanceTimersByTimeAsync(12_000)
+ // Deterministic ladder 150/300/…/4800 ms ⇒ 6–7 redials in 12 s: alive, but climbing.
+ expect(gatewayMocks.connect.mock.calls.length).toBeGreaterThanOrEqual(5)
expect(gatewayMocks.connect.mock.calls.length).toBeLessThanOrEqual(10)
})
})