Skip to content

The agent that grows with you

fix(webapp): give the browser connection its id

emozillaa7429fb9719a
diff --git a/apps/desktop/src/lib/browser-connection.ts b/apps/desktop/src/lib/browser-connection.ts
index d499ccf6a5c..a16fe8a6436 100644
--- a/apps/desktop/src/lib/browser-connection.ts
+++ b/apps/desktop/src/lib/browser-connection.ts
@@ -142,7 +142,10 @@ export function createBrowserConnectionBridge({ api, bootstrap }: BrowserConnect
},
// Reconnect belongs to the window, not whichever secondary profile is active.
// Explicit null still selects the default backend.
- getConnection: async (profile: null | string = windowProfile) => connectionFor(bootstrap, profile),
+ getConnection: async (profile: null | string = windowProfile) => ({
+ ...connectionFor(bootstrap, profile),
+ connectionId: LOCAL_CONNECTION_ID
+ }),
getConnectionConfig: async (profile?: null | string) => browserConnectionConfig(bootstrap, profile),
getConnectionFor: async (payload: { connectionId?: null | string; profile?: null | string }) => {
requireBrowserConnection(payload.connectionId)
diff --git a/apps/desktop/src/lib/browser-desktop-bridge.test.ts b/apps/desktop/src/lib/browser-desktop-bridge.test.ts
index 268a624ddec..963985d560b 100644
--- a/apps/desktop/src/lib/browser-desktop-bridge.test.ts
+++ b/apps/desktop/src/lib/browser-desktop-bridge.test.ts
@@ -105,6 +105,8 @@ describe('browser-hosted Desktop bridge', () => {
expect(new Headers(init.headers).has('X-Hermes-Session-Token')).toBe(false)
const connection = await win.hermesDesktop!.getConnection()
+ // The gateway store routes this connection's requests onto the window's socket by its id.
+ expect(connection.connectionId).toBe('local')
expect(connection.authMode).toBe('oauth')
expect(connection.mode).toBe('remote')
expect(connection.token).toBe('')