The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(webapp): resolve a dial's URL on the cached served set alone
unsupportedpastels99b756503053
diff --git a/apps/desktop/src/lib/browser-connection.ts b/apps/desktop/src/lib/browser-connection.tsindex e41c6befd83..10e6d0f9839 100644--- a/apps/desktop/src/lib/browser-connection.ts+++ b/apps/desktop/src/lib/browser-connection.ts@@ -120,14 +120,6 @@ export function createBrowserConnectionBridge({ api, bootstrap }: BrowserConnect}const getGatewayWsUrl = async (profile?: null | string) => {- // A profile created since the last inventory read is missing from the cached set, though the- // multiplexer adopted it before its create returned: read the inventory once before refusing.- // An unchanged list within the set's TTL re-reads only `/api/profiles`; a failed read refuses on- // the set already cached, as before.- if (!reachesSocket(profile)) {- await installedProfiles().catch(() => undefined)- }-// Its ticket would mint, then the gateway would close the dial (4403) without a reason to show.if (!reachesSocket(profile)) {throw new UnservedProfileError((profile ?? '').trim())diff --git a/apps/desktop/src/lib/browser-desktop-bridge-served-profiles.test.ts b/apps/desktop/src/lib/browser-desktop-bridge-served-profiles.test.tsindex 22653d88ad9..5388f2573e4 100644--- a/apps/desktop/src/lib/browser-desktop-bridge-served-profiles.test.ts+++ b/apps/desktop/src/lib/browser-desktop-bridge-served-profiles.test.ts@@ -141,26 +141,19 @@ describe('profiles the serving gateway does not serve', () => {expect(callsTo(fetchMock, '/api/webapp/socket-ticket')).toBe(2)})- it('opens a profile created since the last inventory read, and still refuses one that stays unserved', async () => {+ it('refuses a dial on the cached set alone, without an inventory read of its own', async () => {const gateway: Gateway = { profiles: ['default', 'solo'], status: reports(['default']) }const fetchMock = stubGateway(gateway)const desktop = installServedBridge()- const statusReads = () => callsTo(fetchMock, '/api/status')await desktop.getProfileRoutes?.(['solo'])- expect(statusReads()).toBe(1)+ const reads = fetchMock.mock.calls.length- // A picker creates the profile and selects it before any inventory read: the multiplexer- // already serves it, but the cached set predates it.+ // Served now, but the cached set predates that: the URL answers from the cache and fetches nothing.gateway.profiles = [...gateway.profiles, 'fresh']gateway.status = reports(['default', 'fresh'])- await expect(desktop.getGatewayWsUrl('fresh')).resolves.toMatchObject({ ok: true })- expect(statusReads()).toBe(2)-- // The installed list is unchanged since that read, so a refusal costs no further status read.- await expect(desktop.getGatewayWsUrl('solo')).rejects.toThrow('does not serve profile "solo"')+ await expect(desktop.getGatewayWsUrl('fresh')).rejects.toThrow('does not serve profile "fresh"')await expect(desktop.getGatewayWsUrl('solo')).rejects.toThrow('does not serve profile "solo"')- expect(statusReads()).toBe(2)- expect(callsTo(fetchMock, '/api/webapp/socket-ticket')).toBe(1)+ expect(fetchMock).toHaveBeenCalledTimes(reads)})})