Skip to content

PATH env var not preserved when launching codex #5837

Closed

Description

@kcosr

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

Activity

  1. added
    agentIssues related to the core agent loop
    and removed
    CLIIssues related to the Codex CLI
    tool-callsIssues related to tool calling
    on Dec 23, 2025
  2. etraut-openai commented on Mar 29, 2026

    @etraut-openai
    Contributor

    This bug report hasn't received any upvotes or additional posts in four months. It's likely either fixed or no longer an issue for users. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agentIssues related to the core agent loopbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions