Skip to content

The agent that grows with you

fix(desktop): preserve local registry model profile scope

Octavio Magaia1750cfb0660c
diff --git a/apps/desktop/electron/connection-config.test.ts b/apps/desktop/electron/connection-config.test.ts
index 98cc815e583..d2d7c26f300 100644
--- a/apps/desktop/electron/connection-config.test.ts
+++ b/apps/desktop/electron/connection-config.test.ts
@@ -615,6 +615,16 @@ test('pathForRegistryBackendRequest uses the resolved registry backend scope', (
)
})
+test('registry model reads and writes retain each profile on a shared local backend', () => {
+ for (const backend of [{ mode: 'local' }, { sharedPrimary: true }]) {
+ for (const profile of ['research', 'default', 'research']) {
+ for (const path of ['/api/model/info', '/api/model/options', '/api/model/set']) {
+ assert.equal(pathForRegistryBackendRequest(path, profile, backend), `${path}?profile=${profile}`)
+ }
+ }
+ }
+})
+
// --- pathWithGlobalRemoteProfile ---
test('pathWithGlobalRemoteProfile appends profile in global remote mode', () => {
diff --git a/apps/desktop/electron/connection-config.ts b/apps/desktop/electron/connection-config.ts
index 468b874d3a4..0b376bdaeb6 100644
--- a/apps/desktop/electron/connection-config.ts
+++ b/apps/desktop/electron/connection-config.ts
@@ -972,18 +972,21 @@ function pathWithProfileScope(path, profile) {
}
export interface RegistryBackendRequestScope {
+ mode?: string
remoteProfile?: null | string
+ sharedPrimary?: boolean
sharedRemote?: boolean
}
/**
- * Scope a REST path for a resolved registry backend. Shared remotes serve
- * multiple profiles from one process and need an explicit profile query;
+ * Scope a REST path for a resolved registry backend. Local host backends and
+ * shared remotes need an explicit profile query, including the primary profile
+ * when Desktop attaches to a process launched under a different home;
* isolated SSH backends already own one profile but may translate a Desktop
* alias in an existing self-profile filter.
*/
function pathForRegistryBackendRequest(path, profile, backend: RegistryBackendRequestScope) {
- return backend.sharedRemote
+ return backend.sharedRemote || backend.sharedPrimary || backend.mode === 'local'
? pathWithProfileScope(path, profile)
: translateSelfProfileQuery(path, profile, backend.remoteProfile)
}