fix(desktop): restore shell PATH before spawning workers - #906
Open
yxlyx wants to merge 1 commit into
Open
Conversation
Desktop launches can inherit a restricted PATH, hiding installed CLI tools. Recover PATH once from a bounded login-shell probe before starting child processes, preserving inherited precedence and adding standard macOS fallback directories. Import no other shell environment variables and leave other platforms unchanged.
yxlyx
marked this pull request as ready for review
September 14, 2026 09:21
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.
What changed
Restore the macOS desktop PATH before starting child processes. Merge the inherited path with the login shell path, deduplicate entries, and retain standard Homebrew and system directories as fallbacks. Add regression tests, including executable lookup through a real child shell.
Why
Desktop launches can inherit a restricted PATH, making installed CLI tools appear unavailable. Fixing the parent environment makes command lookup work across desktop workers and their tools rather than special-casing gh or starting a login shell for every tool call.
The shell probe is bounded and imports only PATH. Existing path precedence is preserved; shell startup failure does not prevent the app from opening. Linux and Windows are unchanged. This does not install tools, change authentication, or repair already-running workers.
Validation
Closes #897.
Related: #902 and #903. This removes the desktop PATH trigger, but does not claim to fix general agent recovery after a command lookup failure.