Skip to content

fix(desktop): extend PATH for dashboard backend so codex is discoverable on macOS - #41389

Closed
liuhao1024 wants to merge 1 commit into
NousResearch:mainfrom
liuhao1024:fix/desktop-dashboard-path-extension
Closed

fix(desktop): extend PATH for dashboard backend so codex is discoverable on macOS#41389
liuhao1024 wants to merge 1 commit into
NousResearch:mainfrom
liuhao1024:fix/desktop-dashboard-path-extension

Conversation

@liuhao1024

Copy link
Copy Markdown
Contributor

Summary

macOS GUI apps launched via Launch Services (Finder/Dock) inherit a minimal PATH (/usr/bin:/bin:/usr/sbin:/sbin) that does not include ~/.hermes/node/bin. When the Electron desktop spawns the Python dashboard backend, this minimal PATH propagates to the child process, causing check_codex_binary() in agent/transports/codex_app_server.py to fail with:

Cannot enable codex_app_server runtime: codex CLI not found at 'codex'. Install with: npm i -g @openai/codex

Even though codex is already installed at ~/.hermes/node/bin/codex (Hermes's own bundled Node).

Fixes #41385

Root Cause

The self-update spawn path already extends PATH (line 1627 of main.cjs):

PATH: [path.join(HERMES_HOME, 'node', 'bin'), venvBin, process.env.PATH].filter(Boolean).join(path.delimiter)

But createPythonBackend() and createActiveBackend() — the two functions that build the dashboard backend descriptor — only set PYTHONPATH in their env object, leaving PATH at the inherited minimal value.

Fix

Add PATH extension to the env object in both createPythonBackend() and createActiveBackend(), prepending:

  • ~/.hermes/node/bin (for codex and other Hermes-managed Node binaries)
  • venv/bin (for the Python venv, when it exists)

This matches the existing pattern used by the self-update spawn and the per-profile backend spawn paths.

Test Plan

  • Added regression test tests/test_desktop_dashboard_path.py verifying both functions include node/bin in PATH
  • pytest tests/test_desktop_dashboard_path.py — 2/2 passed
  • Manual: open Hermes desktop on macOS, run /codex-runtime on — should succeed

…ble on macOS

macOS GUI apps launched via Launch Services (Finder/Dock) inherit a minimal
PATH (/usr/bin:/bin:/usr/sbin:/sbin) that does not include ~/.hermes/node/bin.
When the Electron desktop spawns the Python dashboard backend, this minimal
PATH propagates to the child process, causing check_codex_binary() to fail
with 'codex CLI not found' even though codex is installed at
~/.hermes/node/bin/codex.

Add PATH extension (HERMES_HOME/node/bin + venv/bin) to the env object in
both createPythonBackend() and createActiveBackend(), matching the existing
pattern used by the self-update spawn path (line 1627).

Fixes NousResearch#41385
@teknium1

Copy link
Copy Markdown
Contributor

Closing in favor of PR #44814, which just merged and supersedes this change — it includes the same ~/.hermes/node/bin + venv bin prepend for both createPythonBackend() and createActiveBackend() that you implemented here (you submitted that part first — thank you!), plus the POSIX sane-PATH completion for Homebrew bins and a tested shared helper (backend-env.cjs).

Your diagnosis of #41385 and the fix direction were correct and directly informed the final shape. Appreciate the contribution.

@teknium1 teknium1 closed this Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: /codex-runtime on fails on macOS desktop — dashboard inherits minimal PATH without ~/.hermes/node/bin

3 participants