The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(desktop): keep the override root memo in updater-process
Teknium37243a7fb1ed
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.tsindex b5657008574..7a289dbca93 100644--- a/apps/desktop/electron/main.ts+++ b/apps/desktop/electron/main.ts@@ -609,7 +609,7 @@ import {type UpdaterStrategy} from './updater'import {- launcherInstallDirectory,+ launcherInstallRoot,observeUpdaterHandoff,repairMacUpdaterHelper,resolveInstallationLauncher,@@ -5006,19 +5006,6 @@ function writeDefaultProjectDir(dir) {const installedRuntimeGate = createInstalledRuntimeGate(process.env, rememberLog)-// resolveHermesBackend runs once per surface (startup, TUI resume, config-// refresh, pool backends), and a launcher's install directory cannot move-// while this process lives, so probe each launcher path at most once.-const launcherInstallRoots = new Map<string, string | undefined>()--function launcherInstallRoot(launcher: string): string | undefined {- if (!launcherInstallRoots.has(launcher)) {- launcherInstallRoots.set(launcher, launcherInstallDirectory(launcher) ?? undefined)- }-- return launcherInstallRoots.get(launcher)-}-async function resolveHermesBackend(backendArgs: string[]): Promise<ResolvedHermesBackend> {const payload = bundledPayload(process.resourcesPath)@@ -5073,10 +5060,9 @@ async function resolveHermesBackend(backendArgs: string[]): Promise<ResolvedHerm}}- // 3. HERMES_DESKTOP_HERMES — an explicit deployment override (used by the- // Nix wrapper), not a discovered PATH candidate. The pinned backend is- // the only valid runtime there. Resolve it before any mutable install,- // which may belong to an older release or a different Python environment.+ // 3. HERMES_DESKTOP_HERMES — an explicit deployment override (the Nix wrapper), not a PATH+ // candidate; the pinned backend is the only valid runtime there. Resolve it before any+ // mutable install (older release, other Python env). It carries the root its launcher reports.const hermesOverride: string | undefined = process.env.HERMES_DESKTOP_HERMESlet hermesCommand: string | null = null@@ -5117,12 +5103,7 @@ async function resolveHermesBackend(backendArgs: string[]): Promise<ResolvedHermenv: {},kind: 'command',shell: shellForProbe,- local: 'installed',- // ticketRuntimeFor() mints gateway tickets only from a python- // backend or a command backend that names its installation root- // (launcher probe cwd + PYTHONPATH), so pin the root the launcher- // itself reports (#138774).- root: launcherInstallRoot(hermesCommand)+ local: 'installed', root: launcherInstallRoot(hermesCommand) // ticket minting needs it (#138774)}}diff --git a/apps/desktop/electron/updater-process.ts b/apps/desktop/electron/updater-process.tsindex 7a6e11d5352..83257f93bcd 100644--- a/apps/desktop/electron/updater-process.ts+++ b/apps/desktop/electron/updater-process.ts@@ -112,6 +112,21 @@ export function launcherTargetsInstallation(launcher: string, root: string): boo}}+// A launcher's install directory cannot move while this process lives, and the+// backend resolver runs once per surface (startup, TUI resume, pool backends),+// so the HERMES_DESKTOP_HERMES rung probes each launcher path at most once.+const launcherInstallRoots = new Map<string, string | undefined>()++/** The root a launcher reports, memoized: ticketRuntimeFor() mints gateway+ * tickets from a command backend only when it names its installation root. */+export function launcherInstallRoot(launcher: string): string | undefined {+ if (!launcherInstallRoots.has(launcher)) {+ launcherInstallRoots.set(launcher, launcherInstallDirectory(launcher) ?? undefined)+ }++ return launcherInstallRoots.get(launcher)+}+/** The real install directory a launcher's `--version` reports, or null. */export function launcherInstallDirectory(launcher: string, root?: string): string | null {try {