Skip to content

fix(desktop): complete backend PATH for Homebrew Codex - #44814

Merged
teknium1 merged 1 commit into
NousResearch:mainfrom
y0shua1ee:yoshua/desktop-codex-path-homebrew
Jun 12, 2026
Merged

fix(desktop): complete backend PATH for Homebrew Codex#44814
teknium1 merged 1 commit into
NousResearch:mainfrom
y0shua1ee:yoshua/desktop-codex-path-homebrew

Conversation

@y0shua1ee

@y0shua1ee y0shua1ee commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Fixes #44813

Summary

/codex-runtime on in the macOS Desktop app can still fail when codex is installed via Homebrew at /opt/homebrew/bin/codex. The Desktop dashboard backend PATH may include Hermes-managed bins and the default Apple paths, while still missing Apple Silicon Homebrew.

This follows the two existing fixes in the same bug family:

What changed

  • Added apps/desktop/electron/backend-env.cjs:
    • prepends ~/.hermes/node/bin and the backend venv bin;
    • appends missing POSIX sane PATH entries (/opt/homebrew/bin, /opt/homebrew/sbin, /usr/local/sbin, etc.);
    • preserves caller PATH precedence and drops duplicates/empty entries;
    • preserves Windows PATH key casing and ; delimiters.
  • Wired both Desktop backend descriptors through that helper:
    • createPythonBackend() for explicit/dev source checkouts;
    • createActiveBackend() for the installed active checkout.
  • Added apps/desktop/electron/backend-env.test.cjs and included it in test:desktop:platforms.

Behavior change

A GUI-launched Desktop backend with a minimal macOS PATH can now discover both:

  • Hermes-managed binaries such as ~/.hermes/node/bin/codex;
  • Homebrew binaries such as /opt/homebrew/bin/codex.

That lets /codex-runtime on enable codex_app_server when Codex is installed through Homebrew.

Tests

zsh -lic 'node --check electron/backend-env.cjs && node --check electron/backend-env.test.cjs && node --check electron/main.cjs'
# passed

zsh -lic 'node --test electron/backend-env.test.cjs electron/backend-probes.test.cjs'
# tests 12, pass 12, fail 0

zsh -lic 'npm run test:desktop:platforms'
# tests 171, pass 170, fail 0, skipped 1

Risk / scope

This only affects the Electron Desktop backend subprocess environment. It does not change the model tool schema or terminal tool execution path. Windows behavior is covered by a regression test for PATH casing and delimiter preservation.

Infographic

Desktop backend PATH completion infographic

macOS Desktop backend processes can still miss Apple Silicon Homebrew paths even after adding Hermes-managed Node and venv bins. That leaves `/codex-runtime on` unable to find a Homebrew-installed `codex` binary at `/opt/homebrew/bin/codex`.

Add a small testable backend env helper that builds the dashboard subprocess environment in one place. It prepends Hermes-managed Node and venv bins, appends missing POSIX sane PATH entries individually, preserves caller precedence without duplicates, and keeps Windows PATH casing/delimiters intact.

Wire both source-checkout and active-install backend descriptors through the helper, and add Node regression coverage to the desktop platform test suite.
@y0shua1ee
y0shua1ee requested a review from a team June 12, 2026 09:40
@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard area/config Config system, migrations, profiles P2 Medium — degraded but workaround exists labels Jun 12, 2026
@teknium1
teknium1 merged commit 9c50521 into NousResearch:main Jun 12, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/cli CLI entry point, hermes_cli/, setup wizard 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]: Desktop backend PATH still misses Homebrew bins for /codex-runtime

3 participants