The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): retarget deleted startup profiles
Gille2b1eba478be9
diff --git a/apps/desktop/electron/desktop-profile.test.ts b/apps/desktop/electron/desktop-profile.test.tsindex 61c790b9ad0..fc701234ae3 100644--- a/apps/desktop/electron/desktop-profile.test.ts+++ b/apps/desktop/electron/desktop-profile.test.ts@@ -146,3 +146,30 @@ test('an explicit default survives last-used profile writes and app restarts, isfs.rmSync(root, { recursive: true, force: true })}})++test('successful local profile changes retarget the saved startup profile', () => {+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'desktop-profile-change-'))+ const target = path.join(root, 'active-profile.json')+ const preferences = createDesktopProfilePreferences(target)++ try {+ preferences.remember('local-old')+ preferences.afterProfileRequest(null, { method: 'DELETE', path: '/api/profiles/local-old' }, { ok: false })+ assert.equal(preferences.readActive(), 'local-old')++ preferences.afterProfileRequest('remote-work', { method: 'DELETE', path: '/api/profiles/local-old' }, { ok: true })+ assert.equal(preferences.readActive(), 'local-old')++ preferences.afterProfileRequest(+ null,+ { method: 'PATCH', path: '/api/profiles/local-old', body: { new_name: 'local-new' } },+ { ok: true }+ )+ assert.equal(preferences.readActive(), 'local-new')++ preferences.afterProfileRequest(null, { method: 'DELETE', path: '/api/profiles/local-new' }, { ok: true })+ assert.equal(preferences.readActive(), 'default')+ } finally {+ fs.rmSync(root, { recursive: true, force: true })+ }+})diff --git a/apps/desktop/electron/desktop-profile.ts b/apps/desktop/electron/desktop-profile.tsindex 2dbcd96d6bd..a799fc21bbe 100644--- a/apps/desktop/electron/desktop-profile.ts+++ b/apps/desktop/electron/desktop-profile.ts@@ -140,6 +140,10 @@ export function createDesktopProfilePreferences(}function profileChanged(connectionId: null | string, oldName: string, newName: null | string) {+ if (connectionId === null && readActive() === oldName) {+ remember(newName || 'default')+ }+const route = getDefault()if (route?.connectionId !== connectionId || route?.profile !== oldName) {