The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): preserve primary gateway identity across source switches
David Bartoš10746a53ba0b
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 9f6aebbea32..991124c4c4f 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@@ -652,6 +652,12 @@ describe('useGatewayBoot remote reconnect loop (real hook, fake socket)', () =>expect($gatewaySwitching.get()).toBe(false)// The switch committed: the registry remembers the new source as last-used.expect(setLastUsed).toHaveBeenCalledWith('coder-remote')++ // Publishing the secondary must not relabel the primary socket. Returning+ // to its source should reuse that socket, not dial the secondary endpoint.+ const socketsAfterSwitch = FakeWebSocket.instances.length+ await expect(requestGatewayForAgent('primary-vps', 'default', 'ping')).resolves.toEqual({ pong: true })+ expect(FakeWebSocket.instances).toHaveLength(socketsAfterSwitch)})it('a Settings switch superseded while reading its descriptor cannot publish over a newer Sessions switch', async () => {diff --git a/apps/desktop/src/app/gateway/hooks/use-gateway-boot.ts b/apps/desktop/src/app/gateway/hooks/use-gateway-boot.tsindex 9e546d5ac99..15ec2595973 100644--- a/apps/desktop/src/app/gateway/hooks/use-gateway-boot.ts+++ b/apps/desktop/src/app/gateway/hooks/use-gateway-boot.ts@@ -33,7 +33,6 @@ import {reportPrimaryGatewayState,setPrimaryGateway,setPrimaryGatewayConnection,- setPrimaryGatewayConnectionId,touchSecondaryGateways} from '@/store/gateway'import { registerGatewayReconnect } from '@/store/gateway-reconnect'@@ -191,7 +190,6 @@ export function useGatewayBoot({}: null)- setPrimaryGatewayConnectionId(next?.connectionId)}if (!desktop) {