The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): keep profile scope when reusing primary remote backend
dyreckt2f261f99fff9
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.tsindex 55669cb3550..0dfb816567a 100644--- a/apps/desktop/electron/main.ts+++ b/apps/desktop/electron/main.ts@@ -11151,7 +11151,8 @@ async function ensureRegistryBackend(connectionId, profile, managedUpdateCorrelareturn {...primaryDescriptor,profile: profileKey,- connectionId: id+ connectionId: id,+ sharedRemote: true}}}diff --git a/apps/desktop/electron/registry-primary-profile-scope.test.ts b/apps/desktop/electron/registry-primary-profile-scope.test.tsnew file mode 100644index 00000000000..739c4dabb09--- /dev/null+++ b/apps/desktop/electron/registry-primary-profile-scope.test.ts@@ -0,0 +1,37 @@+import fs from 'node:fs'+import path from 'node:path'+import { fileURLToPath } from 'node:url'++import { describe, expect, it } from 'vitest'++import { pathForRegistryBackendRequest } from './connection-config'++const here = path.dirname(fileURLToPath(import.meta.url))+const mainSource = fs.readFileSync(path.join(here, 'main.ts'), 'utf8').replace(/\r\n/g, '\n')++describe('primary-remote descriptor reuse keeps profile scope', () => {+ it('scopes a shared-remote request with ?profile=<profile>', () => {+ expect(pathForRegistryBackendRequest('/api/skills', 'acme', { sharedRemote: true })).toBe(+ '/api/skills?profile=acme'+ )+ })++ it('does not add a profile query when the backend is not shared-remote', () => {+ // An isolated backend owns one profile; the router must not invent a scope.+ expect(pathForRegistryBackendRequest('/api/skills', 'acme', { sharedRemote: false, remoteProfile: null })).toBe(+ '/api/skills'+ )+ })++ it('marks the reused primary-remote descriptor sharedRemote so the router scopes it', () => {+ const branchStart = mainSource.indexOf('if (id === registry.primary && source.kind !== \'local\'')+ expect(branchStart).toBeGreaterThan(-1)+ const branch = mainSource.slice(branchStart, branchStart + 800)++ // The reuse branch must decorate the ambient primary descriptor with+ // sharedRemote: true, matching the explicit shared-remote connection path.+ expect(branch).toContain('const primaryDescriptor = await ensureBackend(profile)')+ expect(branch).toContain('registrySourceOwnsPrimaryBackend(registry, id, primaryDescriptor)')+ expect(branch).toContain('sharedRemote: true')+ })+})