Skip to content

The agent that grows with you

fix(desktop): the setup profile is never the profile Desktop launches into

alt-glitch70f1ba1637ea
diff --git a/apps/desktop/electron/profile-migration.ts b/apps/desktop/electron/profile-migration.ts
index f49fa758703..1d31dac498e 100644
--- a/apps/desktop/electron/profile-migration.ts
+++ b/apps/desktop/electron/profile-migration.ts
@@ -209,10 +209,14 @@ export function decideMigration(
return { profile: best, _migrated: true }
}
+// hermes_cli/profiles.py::SETUP_PROFILE_MARKER: the backend-made first-run setup profile. Its state.db is the
+// freshest on the machine right after setup, so the recency heuristic would boot every later launch into it.
+const SETUP_PROFILE_MARKER = '.setup-profile.json'
+
/**
- * List named profile directory names under `profilesRoot`. A directory named
- * `default` is accepted if present (unusual) but production default is not a
- * child of this folder — see `withDefaultCandidate`.
+ * List named profile directory names under `profilesRoot`, minus the setup profile, which is never a startup
+ * profile. A directory named `default` is accepted if present (unusual) but production default is not a child
+ * of this folder — see `withDefaultCandidate`.
*/
export function listProfileDirs(deps: MigrationDeps): string[] {
let entries: Dirent[]
@@ -225,6 +229,7 @@ export function listProfileDirs(deps: MigrationDeps): string[] {
return entries
.filter(e => e.isDirectory() && (e.name === 'default' || deps.isValidProfileName(e.name)))
+ .filter(e => !deps.existsSync(`${deps.profilesRoot}/${e.name}/${SETUP_PROFILE_MARKER}`))
.map(e => e.name)
}