Repository navigation
fix(desktop): capture login-shell PATH on direct Unix GUI launches - #6912
Merged
Merged
Conversation
Opening Maka.app or maka-desktop-shell from Finder, the Dock, Spotlight or a Linux desktop launcher gives the process a minimal system PATH (such as /usr/bin:/bin:/usr/sbin:/sbin), hiding user-installed CLIs like agy, codex and claude in ~/.local/bin or Homebrew from the Host. Resolve PATH from the user's interactive login shell inside maka-desktop-shell's direct-open bootstrap before spawning maka desktop, when neither TERM nor COLORTERM is set and MAKA_SKIP_SHELL_ENV is not 1. Keep CLI invocations and isolated test sandboxes untouched, import only PATH so startup scripts cannot inject control variables, execute /bin/sh inside the login shell so non-POSIX shells export a colon-delimited PATH, bound output and runtime, and kill the dedicated probe process group on completion or failure. Generated-by: Antigravity
Pass a leading-hyphen argv[0] when probing csh/tcsh so ~/.login is sourced alongside ~/.cshrc, and return as soon as the paired UUID markers arrive instead of polling child exit for up to 100ms. Generated-by: Antigravity
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.
Summary
When
Maka.appormaka-desktop-shellis opened directly from Finder, the Dock, Spotlight or a Linux desktop launcher, it inherits only the desktop session's minimalPATH(for example/usr/bin:/bin:/usr/sbin:/sbinunder macOS LaunchServices). The Host spawned bymaka desktopinherits that strippedPATH, so external agent CLIs (agy,codex,claude) and MCP servers installed in~/.local/binor Homebrew report as not installed.Before
maka-desktop-shell's direct-launch bootstrap spawnsmaka desktopon Unix, capturePATHfrom the user's interactive login shell when neitherTERMnorCOLORTERMis set (andMAKA_SKIP_SHELL_ENVis not1), then pass thatPATHtomaka desktopso both the Host and subsequent Host reconnections inherit it:maka-desktop-shell's direct-open bootstrap leaves CLI invocations andenv_clear()integration test sandboxes untouched.PATHprevents shell startup files from injecting application-control environment variables, and shellstderris sent to/dev/nullso startup secrets are never retained or logged./bin/shinside the login shell ensures shells where$PATHis a list (fish,nu,csh/tcsh) export a standard colon-delimitedPATHbefore printing it between per-run UUID markers.setsid()session/process group prevents interactive TTY stop signals and ensures startup-file background descendants are terminated on completion, failure, output overflow (64 KiB) or timeout (5s), falling back to the inheritedPATHon error.Verification
cargo nextest run -p maka-desktop-shell --locked(unit tests andopen_directlyintegration tests covering login-shellPATHimport, non-leakage of other shell variables, background descendant cleanup,TERM/COLORTERM/MAKA_SKIP_SHELL_ENV=1skip paths, non-zero exit fallback and output-flood bounding; verified new tests fail before the change and pass with it).cargo clippy -p maka-desktop-shell --all-targets --no-deps -- -D warnings,just fmt-check,just licenses,node scripts/rust/dependencies.mjs generateandnode scripts/rust/notices.mjs generate.Maka.app/Contents/MacOS/maka-desktop-shellunder a stripped LaunchServices-equivalent environment (PATH=/usr/bin:/bin:/usr/sbin:/sbin, noTERM/COLORTERM, real/bin/zshwith noisy.zshrcbanner) and confirmed the spawnedmakalauncher resolved/Users/yuhan/.local/bin/agy,/Users/yuhan/.local/bin/codexand/opt/homebrew/bin/claude.AI use
Select exactly one:
Tool(s) and scope: Antigravity diagnosed the LaunchServices
PATHroot cause, implementedproducts/maka/desktop-shell/src/login_path.rs, updatedmain.rs, tests and desktop-shell READMEs, and ran local verification.Checklist
Does this PR entail a change in behavior?