What issue are you seeing?
Codex local command execution can silently use different environment sources for visually similar TUI launches.
A plain codex session may reuse an implicit local app-server daemon. Adding any -c override prevents that reuse and starts a different execution topology. This means command env can differ even when cwd and the visible UI look equivalent.
This is surprising and operationally risky because the UI presents both sessions as local command execution in the same directory, but env-sensitive commands may behave differently.
What steps can reproduce the bug?
First, make sure an implicit local app-server daemon already exists. In my case, this was a long-lived daemon started earlier by normal Codex use. The important precondition is that plain codex can reuse an existing local app-server daemon.
Then, in a shell:
mkdir -p /tmp/codex-env-repro
cd /tmp/codex-env-repro
export CODEX_ENV_REPRO=present
printenv CODEX_ENV_REPRO
Control output:
Start Codex normally:
Inside Codex:
pwd
printenv CODEX_ENV_REPRO
Observed:
/private/tmp/codex-env-repro
# no output
Now exit and start Codex with a config override:
codex -c shell_environment_policy.inherit=all
Inside Codex:
pwd
printenv CODEX_ENV_REPRO
Observed:
/tmp/codex-env-repro
present
What is the expected behavior?
Either:
- both local TUI launches use the same command-env provenance, or
- Codex clearly exposes when command env comes from a reused app-server daemon instead of the launching terminal process.
The important part is not this specific variable. The issue is that adding a -c override changes process topology and therefore command env, while the UI still presents both as local execution in the selected cwd.
Additional information
shell_environment_policy.inherit = "all" appears to be valid and already defaults to all, so the override value itself is probably not the fix. The relevant behavior appears to be that non-empty CLI overrides prevent implicit local app-server daemon reuse.
What issue are you seeing?
Codex local command execution can silently use different environment sources for visually similar TUI launches.
A plain
codexsession may reuse an implicit local app-server daemon. Adding any-coverride prevents that reuse and starts a different execution topology. This means command env can differ even whencwdand the visible UI look equivalent.This is surprising and operationally risky because the UI presents both sessions as local command execution in the same directory, but env-sensitive commands may behave differently.
What steps can reproduce the bug?
First, make sure an implicit local app-server daemon already exists. In my case, this was a long-lived daemon started earlier by normal Codex use. The important precondition is that plain
codexcan reuse an existing local app-server daemon.Then, in a shell:
Control output:
Start Codex normally:
Inside Codex:
pwd printenv CODEX_ENV_REPROObserved:
Now exit and start Codex with a config override:
Inside Codex:
pwd printenv CODEX_ENV_REPROObserved:
What is the expected behavior?
Either:
The important part is not this specific variable. The issue is that adding a
-coverride changes process topology and therefore command env, while the UI still presents both as local execution in the selectedcwd.Additional information
shell_environment_policy.inherit = "all"appears to be valid and already defaults toall, so the override value itself is probably not the fix. The relevant behavior appears to be that non-empty CLI overrides prevent implicit local app-server daemon reuse.