Skip to content

Find opencode, gh and language servers that only the login shell's PATH has - #124

Merged
m4rocks merged 2 commits into
mainfrom
find-programs-on-login-path
Nov 17, 2026
Merged

m4rocks merged 2 commits into
mainfrom
find-programs-on-login-path

Conversation

@m4rocks

@m4rocks m4rocks commented Nov 17, 2026

Copy link
Copy Markdown
Owner

On Linux, a desktop-launched Claudiu has a minimal PATH, so opencode in ~/.opencode/bin was never found, even after installing it. The OpenCode and Codex lookup used which::which on that PATH alone and never re-read the shell's PATH.

The ACP lookup now uses find_executable and reads the login shell's PATH again on a miss. Claudiu reads that PATH once at startup in the background. find_executable waits for that read on a miss, so a lookup that runs early gets an answer. Codex, OpenCode, language servers and gh start with that PATH, so npx and tsc find node from nvm. Windows is unchanged.

Proof:

  • cargo clippy --locked --all-targets -- -D warnings is clean.
  • cargo test --locked passes (497 passed, 7 ignored).
  • New tests: a program only in the login shell's PATH is found by the ACP lookup, and a command starts with that PATH once it is known.
  • Not run: the real AppImage on a desktop launch.

Risk: the first lookup that misses waits up to 5 seconds for the shell, off the UI thread. To undo, revert the merge commit.

…TH has

A desktop launch gives Claudiu a minimal PATH. OpenCode's lookup used
which::which on that PATH alone, so `opencode` in ~/.opencode/bin was never
found, and the lookup never re-read the shell's PATH after an install.

The ACP lookup now uses find_executable and reads the login shell's PATH
again on a miss. Claudiu also reads that PATH once at startup, and starts
Codex, OpenCode, language servers and gh with it, so `npx` and `tsc` can
find `node` from nvm.
Language server and gh lookups that ran before the startup read finished
missed for good, and a program found on the minimal PATH started without
the login shell's PATH. find_executable and with_login_path now wait for
the one read.
@vercel

vercel Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
claudiu Ready Ready Preview Nov 17, 2026 8:17pm UTC

@m4rocks
m4rocks merged commit 93df0b0 into main Nov 17, 2026
7 of 8 checks passed
@m4rocks
m4rocks deleted the find-programs-on-login-path branch November 17, 2026 20:39
m4rocks added a commit that referenced this pull request Nov 18, 2026
* Keep Claude Code alive when a Codex subagent starts

The Codex helper reads the login shell's PATH with `$SHELL -l -i`, and it
runs inside Claude Code's terminal. An interactive zsh with a controlling
terminal takes over the terminal's foreground while it runs, about half
a second on every Codex turn. Claude Code was a background job on its
own terminal for that time, and when it touched the terminal then, it
died, taking the helper with it. Since #124 this happened on any turn.

The login shell now starts in a session of its own (setsid), without a
controlling terminal, so it can't take the terminal from anyone. This
also covers the --mcp-title server, which runs in the same terminal.

* Build without_terminal on Windows only where path_from_shell is

This branch was successfully deployed

1 active deployment
Preview — caf303ca Deployed Nov 17, 2026 by vercel[bot]
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