Repository navigation
fix: adopt the login shell's PATH so a Finder launch finds the agent CLIs - #84
Merged
Merged
Conversation
…CLIs A macOS app launched from Finder/Dock inherits launchd's minimal PATH, so the AI panel reported claude/codex as not installed even though a terminal launch found them fine. Ask the user's login shell for its PATH once at startup (marker-fenced, sh-wrapped for fish, 5s timeout) and adopt it before availability is probed or the SDKs spawn anything. Co-Authored-By: Claude Fable 5 <[email protected]>
IAmJSD
added a commit
that referenced
this pull request
Aug 30, 2026
Asking the login shell for its PATH is a whole shell startup — 0.75s on a real dotfile setup — and every Finder launch since #84 has waited out that shell before the window was created, because the answer was published with `set_var` and that is only sound before other threads exist. The probe moves to its own thread and stops touching the process environment. Its answer is published through a mutex/condvar and handed to each spawn explicitly: `path::current()` never waits and is what `Backend::available` and the picker read, `path::resolved()` waits (five seconds for the shell, six for a caller) and is only ever called from a worker thread about to spawn a CLI. Both SDKs are given an absolute `cli_path`/`command` plus a PATH override for the children they spawn in turn, so nothing depends on the app's own environment any more — which also spares the Claude SDK its discovery pass, a `claude --version` spawn on every connect. Availability computed while the probe is still out can say a CLI is missing when it is merely off launchd's PATH, so the workspace watches for the answer and redoes it, refreshing the model catalogs if the panel is open. Claude-Session: https://claude.ai/code/session_012FgdQwG9FfmLWtpRvC7VWP Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In the signed macOS build, the AI panel reports
The Claude Code CLI ("claude") is not on PATHeven when it plainly is — launching the same build from a terminal works.A Finder/Dock launch inherits launchd's minimal
PATH(/usr/bin:/bin:/usr/sbin:/sbin); the user's shell additions (~/.local/bin,/opt/homebrew/bin, npm prefixes…) never reach the GUI process.Backend::available()and the agent SDKs' own spawns both resolve through the processPATH, so both miss the CLIs.Fix
ai::adopt_login_shell_path(), called early inmain(unix-only), the same approach Zed and VS Code take:TERMis set — a terminal launch already carries the rightPATH.$SHELL -l -i -cprinting$PATHbetween marker strings, and adopts the fenced value. Login + interactive so both profile and rc files contribute (installers append to either); the markers strip whatever banners those files print.shinside the shell, because fish expands its own"$PATH"space-joined while its exported environment is colon-joined.Testing
cargo checkclean. Probe verified end-to-end on Linux with a fake$HOMEwhose profile prints a banner and prepends a dir: the value between the markers comes back with the rc's edit and without the noise. Needs a Finder-launched macOS build for final confirmation.🤖 Generated with Claude Code