The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): retain manual recovery scope through retries
Tekniuma275adefe29f
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.tsxindex a8685af6876..4f6d214ca1b 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@@ -1356,6 +1356,7 @@ describe('useGatewayBoot remote reconnect loop (real hook, fake socket)', () =>const revalidated = deferred<{ ok: boolean; rebuilt: boolean }>()desktop.revalidateConnection.mockReturnValue(revalidated.promise)+ FakeWebSocket.mode = 'fail'await act(async () => {const reconnect = reconnectGateway()@@ -1369,16 +1370,18 @@ describe('useGatewayBoot remote reconnect loop (real hook, fake socket)', () =>await reconnect})- expect(desktop.revalidateConnection).toHaveBeenCalledOnce()+ FakeWebSocket.mode = 'open'+ await advanceBackoff()+ expect(desktop.revalidateConnection).toHaveBeenCalledTimes(2)// The manual reconnect dials the WINDOW-owned primary backend (no profile// arg) — same contract as the sleep/wake reconnect: passing the active// profile would retarget the primary socket after a live profile swap.const lastCall = desktop.getConnection.mock.calls.at(-1) ?? []expect(lastCall.length === 0 || lastCall[0] == null || lastCall[0] === '').toBe(true)- expect(desktop.getGatewayWsUrl).toHaveBeenCalledTimes(2)+ expect(desktop.getGatewayWsUrl).toHaveBeenCalledTimes(3)expect(oldPrimary.readyState).toBe(FakeWebSocket.CLOSED)expect(backgroundSocket.readyState).toBe(FakeWebSocket.OPEN)- expect(FakeWebSocket.instances).toHaveLength(3)+ expect(FakeWebSocket.instances).toHaveLength(4)expect($sessionTiles.get()[0]).not.toHaveProperty('runtimeId')expect($sessionTiles.get()[1].runtimeId).toBe('runtime-writer')expect($busy.get()).toBe(true)diff --git a/apps/desktop/src/app/gateway/hooks/use-gateway-boot.ts b/apps/desktop/src/app/gateway/hooks/use-gateway-boot.tsindex edc957284c3..5f3096316d3 100644--- a/apps/desktop/src/app/gateway/hooks/use-gateway-boot.ts+++ b/apps/desktop/src/app/gateway/hooks/use-gateway-boot.ts@@ -428,12 +428,12 @@ export function useGatewayBoot({})}- scheduleReconnect()+ scheduleReconnect(manual)}}}- function scheduleReconnect() {+ function scheduleReconnect(manual?: { profile: string; activationEpoch: number }) {if (cancelled || reconnecting || reconnectTimer !== null || gatewayOpen() || $gatewaySwitching.get()) {return}@@ -446,7 +446,7 @@ export function useGatewayBoot({reconnectAttempt += 1reconnectTimer = setTimeout(() => {reconnectTimer = null- void attemptReconnect()+ void attemptReconnect(manual)}, delay)}