Repository navigation
Conversation
…a AppImage/GUI on Linux When the app is launched from a GUI (AppImage, Dock, file manager) rather than a terminal, process.env.PATH is a minimal system PATH that omits paths added by shell init scripts like ~/.bashrc or ~/.zprofile, including paths set up by Node version managers such as fnm and nvm. This caused two problems: 1. `codex` could not be found at all, showing "not installed or not on PATH" 2. Even with an absolute custom path, the npm wrapper script failed because its `#!/usr/bin/env node` shebang couldn't locate `node` either Fix: add shellEnv.ts that resolves PATH by spawning the user's login shell once ($SHELL -l -c "echo $PATH"), caches the result, and falls back to process.env.PATH on any failure. Use getSpawnEnv() in all three places that spawn codex processes. Co-authored-by: benakdev <[email protected]>
Copilot
AI
changed the title
[WIP] Investigate codex CLI not available on PATH
fix: resolve login shell PATH so codex is found when launched via AppImage/GUI on Linux
Mar 14, 2026
Copilot stopped work on behalf of
benakdev due to an error
March 14, 2026 17:23
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.
When launched from a GUI (AppImage, Dock, file manager) rather than a terminal,
process.env.PATHis a minimal system PATH that excludes paths added by shell init scripts. Node version managers likefnm/nvminject their bin dirs via.bashrc/.zprofile, socodex— andnodeitself — are invisible to the process. This breaks even the custom binary path workaround: the codex npm wrapper is a#!/usr/bin/env nodescript, soenvfails to locatenodeat spawn time.What Changed
apps/server/src/shellEnv.ts(new) —getSpawnEnv()/resolveLoginShellPath()utilities:$SHELL -l -c "echo $PATH"once to capture the full login-shell PATHprocess.env.PATHon any failureprocess.env.PATHunchangedcodexAppServerManager.ts— replaces inline{ ...process.env }spreads withgetSpawnEnv()in both thespawnSyncversion check and thespawnapp-server launchProviderHealth.tsandCodexTextGeneration.ts— passenv: getSpawnEnv()toChildProcess.makefor the health probe and text-generation invocationsshellEnv.test.ts(new) — unit tests covering success, multiline stdout, failure fallback, throw fallback, and caching behaviourWhy
The standard fix used by VS Code and similar desktop tools: query the login shell for its PATH once at startup. This ensures version-manager-managed binaries (and their
noderuntime) are discoverable regardless of how the process was launched.Checklist
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.