Skip to content

The agent that grows with you

fix(desktop): isolate primary and pooled backend spawns from launch-profile secrets

brooklyn!94dcb170fe51
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts
index d8f5c1b35e0..2820a547ca6 100644
--- a/apps/desktop/electron/main.ts
+++ b/apps/desktop/electron/main.ts
@@ -64,7 +64,12 @@ import {
import { dashboardFallbackArgs } from './backend-command'
import { createBackendConnectionState } from './backend-connection-state'
import { BackendDialClaims } from './backend-dial-claim'
-import { buildDesktopBackendEnv, hermesManagedNodePathEntries, normalizeHermesHomeRoot } from './backend-env'
+import {
+ buildDesktopBackendEnv,
+ hermesManagedNodePathEntries,
+ normalizeHermesHomeRoot,
+ profileBackendParentEnv
+} from './backend-env'
import { createBackendExitRecoveryLatch } from './backend-exit-recovery'
import { isReauthRequiredError, waitForHermesReady } from './backend-health'
import { backendCommandMatches, createBackendOwnership, createBackendShutdownCoordinator } from './backend-ownership'
@@ -12726,7 +12731,8 @@ async function runPoolBackendStart(
cwd: hermesCwd,
env: desktopBackendSpawnEnv(
{
- ...process.env,
+ // Never another profile's dotenv credentials from the Desktop env (#68367).
+ ...profileBackendParentEnv({ hermesHome: HERMES_HOME, profile }),
HERMES_HOME,
...backend.env,
// Pin the gateway's tool/terminal cwd to the same directory we chose for
@@ -13510,7 +13516,8 @@ async function runHermesStart({ supervisorRecovery = false }: { supervisorRecove
cwd: hermesCwd,
env: desktopBackendSpawnEnv(
{
- ...process.env,
+ // Never another profile's dotenv credentials from the Desktop env (#68367).
+ ...profileBackendParentEnv({ hermesHome: HERMES_HOME, profile: activeProfile }),
// Explicitly pin HERMES_HOME for the child so Python's get_hermes_home()
// resolves to the SAME location our resolveHermesHome() picked. Without
// this pin, Python falls back to ~/.hermes on every platform — fine on