You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: Codex and Gemini CLI not recognized in NVM/custom PATH environments on macOS #8
Termpolis fails to recognize installed AI agents like Codex and Gemini CLI in environments where binaries are managed by version managers (like NVM) or located in custom directories not covered by the current hardcoded fallbacks.
Problem Analysis
In src/main/index.ts, the findAgentInstalled function checks for binaries using:
which [agent]
Hardcoded paths: ~/.local/bin, /usr/local/bin, /opt/homebrew/bin (on macOS/Linux).
However, on macOS, GUI applications often do not inherit the full shell PATH (e.g., configurations from .zshrc or .bash_profile). This causes which to fail if the binary is in a path managed by NVM (e.g., ~/.nvm/versions/node/v24.15.0/bin).
Environment Context
In my specific environment:
Gemini CLI is installed via npm/nvm: /Users/mac/.nvm/versions/node/v24.15.0/bin/gemini
Codex is also present but not detected.
The current fallback paths do not include NVM-managed directories or generic global npm prefix paths.
Suggested Solutions
Inherit Shell PATH: Use a library like fix-path or shell-path in the main process to ensure the Electron environment has the same PATH as the user's interactive shell.
Expand Fallback Paths: Include common global npm/pnpm bin directories.
Manual Configuration: Allow users to specify custom binary paths in the application settings.
@chan-yuu — fixed in 5b8b3f3 (will ship in the next release). Two-pronged attack:
1. Static directory list expanded — getAgentExtraPaths() on macOS/Linux now includes Volta (~/.volta/bin), asdf (~/.asdf/shims), n (~/n/bin), yarn (~/.yarn/bin), ~/.npm-global/bin, bun (~/.bun/bin), plus dynamic enumeration of every ~/.nvm/versions/node/*/bin and $FNM_DIR/node-versions/*/installation/bin.
2. Interactive-shell PATH discovery — new getInteractiveShellPath() forks $SHELL -ilc once at startup and captures the PATH your terminal actually sees (sources .zshrc/.bashrc, so NVM's nvm.sh, asdf's init, custom prefix overrides all get picked up). Result is cached for the process.
Both feed into findAgentInstalled, which now passes the combined PATH as env.PATH to which/where — so even if launchd's minimal PATH is missing your NVM dir, detection still resolves it.
Could you pull main and confirm Gemini + Codex show as installed on your machine? If anything's still missing I can iterate — easiest way to debug would be to run this in a Termpolis-launched terminal and share the output:
```
echo "PATH=$PATH"
which gemini codex
ls -la ~/.nvm/versions/node/*/bin/gemini 2>/dev/null
```
Thanks for the well-scoped report — the file-path detail made the fix straightforward.
Another annoying issue is that if I forget to start Termpolits, I won't be able to connect to the MCP server, and then I won't be able to use the Gemini CLI:
and I haven't figured out how to make them compatible.
@chan-yuu — fixed in 10985ed (degrade-gracefully patch). The adapter used to process.exit(1) the moment the token file was missing, which is exactly the state when Termpolis isn't running — Gemini saw that as a hard MCP-server-crash and blocked all CLI use.
New behavior when Termpolis is offline:
initialize still returns a real handshake (host treats the server as healthy)
any tool call returns a friendly JSON-RPC error: "Termpolis is not running. Start Termpolis to enable its MCP tools. Other agent features should work normally."
if the connection drops mid-session (e.g., you close Termpolis while Gemini is up), the adapter flips into degraded mode instead of letting every subsequent call hang on a network timeout
So from Gemini's perspective the Termpolis MCP server simply has zero tools to offer — and the rest of the CLI works as expected. No more "compatible" requirement: you can launch Gemini standalone whenever you want, and start Termpolis only when you actually want its tools.
Will ship in the next release. Thanks again for surfacing both of these.
Hey @chan-yuu — thanks again for the careful report. Both pieces of your bug have shipped in v1.11.58:
Codex/Gemini detection on macOS — PATH discovery now walks NVM/asdf/volta install dirs plus your interactive shell PATH, so Termpolis finds the agents wherever your shell finds them.
"MCP server crashed" in Gemini CLI — the stdio adapter no longer exits when Termpolis isn't running. It now reports zero MCP tools and returns a friendly JSON-RPC error on tool calls, so the rest of Gemini CLI keeps working normally.
If you hit anything else — anywhere in Termpolis — please open a new issue and I'll get on it right away. Really appreciate you taking the time to report this in the first place.
Activity
chan-yuu commentedon May 21, 2026
Related situation:
codedev-david commentedon May 21, 2026
@chan-yuu — fixed in 5b8b3f3 (will ship in the next release). Two-pronged attack:
1. Static directory list expanded —
getAgentExtraPaths()on macOS/Linux now includes Volta (~/.volta/bin), asdf (~/.asdf/shims), n (~/n/bin), yarn (~/.yarn/bin),~/.npm-global/bin, bun (~/.bun/bin), plus dynamic enumeration of every~/.nvm/versions/node/*/binand$FNM_DIR/node-versions/*/installation/bin.2. Interactive-shell PATH discovery — new
getInteractiveShellPath()forks$SHELL -ilconce at startup and captures the PATH your terminal actually sees (sources.zshrc/.bashrc, so NVM'snvm.sh, asdf's init, custom prefix overrides all get picked up). Result is cached for the process.Both feed into
findAgentInstalled, which now passes the combined PATH asenv.PATHtowhich/where— so even if launchd's minimal PATH is missing your NVM dir, detection still resolves it.Could you pull main and confirm Gemini + Codex show as installed on your machine? If anything's still missing I can iterate — easiest way to debug would be to run this in a Termpolis-launched terminal and share the output:
```
echo "PATH=$PATH"
which gemini codex
ls -la ~/.nvm/versions/node/*/bin/gemini 2>/dev/null
```
Thanks for the well-scoped report — the file-path detail made the fix straightforward.
chan-yuu commentedon May 21, 2026
Another annoying issue is that if I forget to start Termpolits, I won't be able to connect to the MCP server, and then I won't be able to use the Gemini CLI:
and I haven't figured out how to make them compatible.
test(agents): drop NVM enumeration test (was CI-fragile)
refactor(agents): extract PATH discovery to agentPaths module + resto…
fix(mcp-adapter): degrade gracefully when Termpolis isn't running (is…
codedev-david commentedon May 21, 2026
@chan-yuu — fixed in 10985ed (degrade-gracefully patch). The adapter used to
process.exit(1)the moment the token file was missing, which is exactly the state when Termpolis isn't running — Gemini saw that as a hard MCP-server-crash and blocked all CLI use.New behavior when Termpolis is offline:
initializestill returns a real handshake (host treats the server as healthy)tools/list/resources/list/prompts/listreturn empty arraysSo from Gemini's perspective the Termpolis MCP server simply has zero tools to offer — and the rest of the CLI works as expected. No more "compatible" requirement: you can launch Gemini standalone whenever you want, and start Termpolis only when you actually want its tools.
Will ship in the next release. Thanks again for surfacing both of these.
chore(release): v1.11.58 — issue #8 fixes (NVM PATH + MCP adapter deg…
codedev-david commentedon May 21, 2026
Hey @chan-yuu — thanks again for the careful report. Both pieces of your bug have shipped in v1.11.58:
If you hit anything else — anywhere in Termpolis — please open a new issue and I'll get on it right away. Really appreciate you taking the time to report this in the first place.