From cff2cfd41d9716344d29bb0ffd7b1062f7c69f9e Mon Sep 17 00:00:00 2001 From: ethernet Date: Thu, 24 Sep 2026 12:48:04 -0400 Subject: [PATCH] fix(desktop): put the checkout on the source backend's PYTHONPATH A developer/E2E interpreter override need not have the checkout installed, and the backend runs in the user's workspace cwd, so `-m hermes_cli.main` only resolved from an editable .venv. The Desktop core E2E on the PM test environment died with "No module named hermes_cli" on every local boot. Name this checkout explicitly; the scrub of an inherited value stays. --- apps/desktop/electron/source-backend.test.ts | 5 +++-- apps/desktop/electron/source-backend.ts | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/desktop/electron/source-backend.test.ts b/apps/desktop/electron/source-backend.test.ts index 5809c7039f..5c2fb0fad1 100644 --- a/apps/desktop/electron/source-backend.test.ts +++ b/apps/desktop/electron/source-backend.test.ts @@ -183,8 +183,9 @@ test.skipIf(process.platform === 'win32')( assert.ok(source) assert.equal(source.command, fixture.python) assert.match( + // The real spawn runs in the user's workspace, never the checkout. execFileSync(source.command, source.args, { - cwd: source.root, + cwd: temp, env: { ...env, ...source.env }, encoding: 'utf8', timeout: 15_000 @@ -224,7 +225,7 @@ test('Windows console selection uses only the selected interpreter directory', ( fs.writeFileSync(consolePython, '') const backend: SourceBackend | null = createSourcePythonBackend(root, selected, ['serve'], { isWindows: true }) assert.equal(backend?.command, consolePython) - assert.equal(backend?.env.PYTHONPATH, '') + assert.equal(backend?.env.PYTHONPATH, root) assert.equal(backend?.env.PYTHONHOME, '') assert.equal(createSourcePythonBackend(root, selected, [], { isWindows: false })?.command, selected) assert.equal(createSourcePythonBackend(root, null, []), null) diff --git a/apps/desktop/electron/source-backend.ts b/apps/desktop/electron/source-backend.ts index 40bf2c1991..954fec0ad7 100644 --- a/apps/desktop/electron/source-backend.ts +++ b/apps/desktop/electron/source-backend.ts @@ -96,7 +96,10 @@ export function createSourcePythonBackend( label: `Hermes source at ${root}`, command, args: ['-m', 'hermes_cli.main', ...args], - env: buildDesktopBackendEnv({ currentEnv: options.env ?? process.env }), + // The backend runs in the user's workspace cwd, and the selected + // interpreter need not have this checkout installed: name it explicitly. + // (The scrubbed inherited value could point at another checkout.) + env: { ...buildDesktopBackendEnv({ currentEnv: options.env ?? process.env }), PYTHONPATH: root }, root, bootstrap: false, shell: false,