Skip to content

fix(codex): skip broken CLI installations#2871

Open
janburzinski wants to merge 2 commits into
mainfrom
jan/eng-1866-failed-to-load-chat-due-to-missing-codex-dependency
Open

fix(codex): skip broken CLI installations#2871
janburzinski wants to merge 2 commits into
mainfrom
jan/eng-1866-failed-to-load-chat-due-to-missing-codex-dependency

Conversation

@janburzinski

Copy link
Copy Markdown
Collaborator

Description

Codex chat could fail even when a working Homebrew installation was selected because the ACP runtime independently resolved the first codex entry on PATH. A broken workspace-local npm installation could therefore shadow the working Homebrew binary.

This change makes conversation spawn resolution probe discovered CLI installations in PATH order and use the first working candidate. Codex now treats a non-zero version probe as an invalid installation, so a broken local npm package is skipped in favor of a healthy installation such as Homebrew.

Related issues

ENG-1866

Testing

  • pnpm --filter @emdash/core exec vitest run src/agents/plugins/plugin-host.test.ts
  • pnpm --filter @emdash/plugins exec vitest run src/agents/impl/codex/acp.test.ts
  • pnpm --filter @emdash/core run typecheck
  • pnpm --filter @emdash/core run lint
  • pnpm --filter @emdash/plugins run lint
  • Focused oxfmt --check
  • git diff --check
  • Manually confirmed the workspace-local Codex exits with code 1 while /opt/homebrew/bin/codex succeeds, and launched the Electron development app with the updated runtime.

Screenshot/Recording (if applicable)

Not applicable; this changes CLI resolution behavior without changing the UI.

Checklist
  • I kept this PR small and focused
  • I ran a self-review before opening this PR
  • I ran the relevant local checks or explained why not
  • I updated docs when behavior or setup changed, or no documentation change was needed
  • I added or updated tests when behavior changed, or explained why not
  • I only added comments where the logic is not obvious
  • I used Conventional Commits for commit messages and, when possible, the PR title

@janburzinski

Copy link
Copy Markdown
Collaborator Author

@greptileai

@greptile-apps

greptile-apps Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR makes Codex ACP startup skip broken CLI installations. The main changes are:

  • Probe Codex installations in PATH order.
  • Select the first installation with a successful version check.
  • Reject Codex probes that exit with a non-zero status.
  • Add tests for broken PATH entries and probe results.

Confidence Score: 5/5

The latest changes look safe to merge.

  • No additional blocking issue was found in the updated code.

Important Files Changed

Filename Overview
packages/core/src/host-dependencies/runtime/host-dependency-manager.ts Adds PATH-ordered probing that returns the first working CLI installation.
packages/core/src/agents/plugins/plugin-host.ts Uses working-installation resolution for ACP spawn commands and reports when none are available.
packages/plugins/src/agents/impl/codex/index.ts Marks Codex installations as available only when their version probe succeeds.
packages/core/src/agents/plugins/plugin-host.test.ts Tests that ACP spawning skips a broken PATH entry.
packages/plugins/src/agents/impl/codex/acp.test.ts Tests successful and failed Codex version-probe classification.

Reviews (2): Last reviewed commit: "fix(codex): skip broken CLI installation..." | Re-trigger Greptile

Comment thread packages/core/src/host-dependencies/runtime/host-dependency-manager.ts Outdated
@janburzinski janburzinski marked this pull request as ready for review July 14, 2026 18:58
@arnestrickmann arnestrickmann requested a review from Davidknp July 14, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant