Skip to content

[codex] Fix Codex CLI detection for mise-managed Node installs - #2822

Merged
farion1231 merged 1 commit into
farion1231:mainfrom
iambinlin:fix/codex-mise-detection
May 18, 2026
Merged

farion1231 merged 1 commit into
farion1231:mainfrom
iambinlin:fix/codex-mise-detection

Conversation

@iambinlin

@iambinlin iambinlin commented May 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fix false-negative local Codex CLI detection in CC Switch when Codex is installed through a mise-managed Node runtime.

In this setup, codex --version works in the user's terminal, but CC Switch may show not installed or not executable in Settings -> About -> Local Environment Check.

image

Problem

Tauri GUI apps often start with a reduced PATH compared with an interactive terminal session. When direct execution of codex --version fails, CC Switch falls back to scanning common CLI install locations.

Before this change, the fallback scan covered locations such as:

  • ~/.local/bin
  • ~/.npm-global/bin
  • ~/n/bin
  • Volta
  • fnm
  • nvm

However, it did not cover mise-managed Node installs, such as:

  • ~/.local/share/mise/shims
  • ~/.local/share/mise/installs/node/<version>/bin

As a result, Codex could be installed and usable from the terminal while still being reported as unavailable by CC Switch.

Changes

  • Add mise Node search path support to the local CLI fallback scanner:
    • ~/.local/share/mise/shims
    • ~/.local/share/mise/installs/node/*/bin
  • Reuse the existing path de-duplication helper.
  • Add a unit test covering mise shims and installed Node bin directories.

Validation

Ran:

cargo fmt
cargo test commands::misc::tests

Result:

  • 14 passed
  • 0 failed

Manual verification:

  • Codex is installed under a mise-managed Node directory.
  • After the fix, CC Switch detects the local Codex version correctly in the About page environment check.

Risk

Low.

This change only extends fallback CLI search paths. It does not change:

  • version parsing
  • remote latest-version checks
  • frontend rendering
  • provider switching
  • config read/write behavior
  • WSL detection behavior

Scope

Affects local tool version detection fallback logic on non-Windows platforms.

Expected impact:

  • Codex installed via mise is now detected correctly.
  • Existing Claude, Gemini, OpenCode, nvm, fnm, Volta, and standard PATH detection behavior remains unchanged.

@iambinlin
iambinlin force-pushed the fix/codex-mise-detection branch from c331743 to 3e84e16 Compare May 16, 2026 04:56
@farion1231

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@farion1231 farion1231 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution!

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.

2 participants