Skip to content

The agent that grows with you

fix(desktop): a saved startup profile whose home is gone boots default explicitly

alt-glitcha0b8b34652d8
diff --git a/apps/desktop/electron/desktop-profile.test.ts b/apps/desktop/electron/desktop-profile.test.ts
index d3884ae023f..92d2aaad840 100644
--- a/apps/desktop/electron/desktop-profile.test.ts
+++ b/apps/desktop/electron/desktop-profile.test.ts
@@ -229,7 +229,11 @@ test('a stored profile whose home is gone boots default instead of a missing --p
preferences.remember('work')
assert.equal(preferences.readActive(), 'work')
+ // Explicitly default, not "no preference": that would let the CLI's active profile choose the home.
preferences.remember('hermes-setup')
+ assert.equal(preferences.readActive(), 'default')
+
+ preferences.remember(null)
assert.equal(preferences.readActive(), null)
preferences.remember('default')
diff --git a/apps/desktop/electron/desktop-profile.ts b/apps/desktop/electron/desktop-profile.ts
index ed06697c525..a3b1d1123ba 100644
--- a/apps/desktop/electron/desktop-profile.ts
+++ b/apps/desktop/electron/desktop-profile.ts
@@ -132,8 +132,14 @@ export function createDesktopProfilePreferences(
function readActive(): null | string {
const profile = readStored()
- // A stored profile whose home is gone boots default: `--profile <missing>` would fail the backend.
- return profile === 'default' || (profile && options.profileExists?.(profile) !== false) ? profile : null
+ // A stored profile whose home is gone boots default, explicitly: `--profile <missing>` would fail the
+ // backend, and `null` (no preference) would let the CLI's own active profile pick a different home
+ // than the one the connection is labelled with.
+ if (profile && profile !== 'default' && options.profileExists?.(profile) === false) {
+ return 'default'
+ }
+
+ return profile
}
function remember(name: unknown): null | string {