PATH env var not preserved when launching codex
Resolved 💬 1 comment Opened Oct 28, 2025 by kcosr Closed Mar 29, 2026
What version of Codex is running?
codex-cli 0.50.0
What subscription do you have?
Pro
Which model were you using?
gpt-5-codex
What platform is your computer?
Linux 9f821af090ae 6.6.87.2-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC Thu Jun 5 18:30:46 UTC 2025 x86_64 GNU/Linux (container)
What issue are you seeing?
PATH is not preserved and cannot be set manually. This prevents me from adding scripts to /workspace/.bootstrap/bin and instructing the agent to invoke them without the full path.
devtoolsd@b1a3d60c79ee:~/terminals$ echo $PATH && codex --config shell_environment_policy.inherit=all --dangerously-bypass-approvals-and-sandbox exec 'run echo $PATH'
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/workspace/.bootstrap/bin
OpenAI Codex v0.50.0 (research preview)
--------
workdir: /workspace/terminals
model: gpt-5-codex
provider: openai
approval: never
sandbox: read-only
reasoning effort: none
reasoning summaries: auto
session id: 019a2829-236a-7700-bcbf-0754780163c1
--------
user
run echo $PATH
thinking
**Preparing to run shell command**
exec
bash -lc 'echo $PATH' in /workspace/terminals succeeded in 3ms:
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
codex
`PATH` is `/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games`.
tokens used
3,469
`PATH` is `/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games`.
devtoolsd@e7318f7da8a1:~/devtools/terminals$ echo $PATH && codex --config shell_environment_policy.inherit=all --config shell_environment_policy.set.PATH=$PATH:/workspace/.bootstrap/bin --dangerously-bypass-approvals-and-sandbox exec 'run echo $PATH'
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/workspace/.bootstrap/bin
OpenAI Codex v0.49.0 (research preview)
--------
workdir: /workspace/devtools/terminals
model: gpt-5-codex
provider: openai
approval: never
sandbox: read-only
reasoning effort: none
reasoning summaries: auto
session id: 019a2831-82a9-7bd3-9a2f-5d00ff9a2229
--------
user
run echo $PATH
thinking
**Preparing shell command execution**
exec
bash -lc 'echo $PATH' in /workspace/devtools/terminals succeeded in 3ms:
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
codex
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
tokens used
3,542
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
What steps can reproduce the bug?
Instruct the model to run echo $PATH and compare to the environment PATH.
What is the expected behavior?
PATH will be inherited.
Additional information
_No response_
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗