The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): name a re-ensure without a gateway endpoint in localGatewayDial
unsupportedpastelsf57e2e63121f
diff --git a/apps/desktop/electron/local-gateway.test.ts b/apps/desktop/electron/local-gateway.test.tsindex b7e945e768d..f1387b00f9b 100644--- a/apps/desktop/electron/local-gateway.test.ts+++ b/apps/desktop/electron/local-gateway.test.ts@@ -230,6 +230,19 @@ test('a dial against a replaced local gateway forgets the cached endpoint once aexpect(ensures).toBe(2)})+test('a redial whose re-ensure comes back without a gateway endpoint names that, not a TypeError', async () => {+ const { localGatewayDial } = await import('./local-gateway')+ const endpoint = { profile_id: '/h', control_home: null, instance_id: 'dead', authority_epoch: 1, runtime_protocol: 1, api_origin: 'http://127.0.0.1:1234', capabilities: ['session-authority-v1'], supervisor: 'none' }+ const mint = vi.fn(async () => { throw new Error('Gateway ticket control socket missing') })+ const ensure = vi.fn()+ .mockResolvedValueOnce({ baseUrl: 'http://127.0.0.1:1234', gatewayEndpoint: endpoint })+ .mockResolvedValueOnce({ baseUrl: 'http://127.0.0.1:1234' })++ await expect(localGatewayDial({ ensure, forget: vi.fn(), launchHome: '/h', mint, prepare: () => 'unused', profile: '' }))+ .rejects.toThrow('Local gateway connection has no gateway endpoint')+ expect(mint).toHaveBeenCalledTimes(1)+})+test('a ready owner running other code than this Hermes is restarted once, then re-ensured', async () => {// After `hermes update` the live gateway still serves the old code and answers model calls// 503 "Restart required"; attaching to it on every dial pinned the user to it forever.diff --git a/apps/desktop/electron/local-gateway.ts b/apps/desktop/electron/local-gateway.tsindex c6a074aceb7..dc7796db6e1 100644--- a/apps/desktop/electron/local-gateway.ts+++ b/apps/desktop/electron/local-gateway.ts@@ -287,7 +287,12 @@ export function localGatewayDial<T extends { baseUrl: string; gatewayEndpoint?:forget: opts.forget,// A shared-primary descriptor answers for a sibling profile too: the ticket must name// THAT profile's home or its sessions are another owner's.- use: async current => opts.prepare(current.baseUrl, await mint(await routedTicketEndpoint(current.gatewayEndpoint!, opts.profile, opts.launchHome), purpose))+ use: async current => {+ // Callers check the first descriptor; a re-ensure may still answer without one.+ if (!current.gatewayEndpoint) {throw new Error('Local gateway connection has no gateway endpoint')}++ return opts.prepare(current.baseUrl, await mint(await routedTicketEndpoint(current.gatewayEndpoint, opts.profile, opts.launchHome), purpose))+ }})}