Managed network proxy injects unsupported YARN_NO_PROXY and breaks Yarn Berry
What version of Codex CLI is running?
codex-cli 0.149.1 (npm-managed)
What platform is your computer?
Linux x86_64
What issue are you seeing?
When the managed network proxy is active, Codex injects YARN_NO_PROXY into every spawned command environment. Yarn Berry interprets every YARN_* variable as a Yarn configuration setting, maps this variable to noProxy, and rejects it because Yarn Berry has no such setting.
This prevents Yarn commands that load the full configuration from running.
$ yarn --version
4.17.1
$ env | grep "^YARN_.*_PROXY="
YARN_HTTPS_PROXY=http://127.0.0.1:<port>
YARN_HTTP_PROXY=http://127.0.0.1:<port>
YARN_NO_PROXY=localhost,127.0.0.1,::1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
$ yarn config get httpProxy
Usage Error: Unrecognized or legacy configuration settings found: noProxy - run "yarn config" to see the list of settings supported in Yarn (in <environment>)
$ echo $?
1
Removing only the unsupported variable fixes the failure while retaining the managed HTTP proxy:
$ env -u YARN_NO_PROXY yarn config get httpProxy
http://127.0.0.1:<port>
$ echo $?
0
What steps can reproduce the bug?
- Run Codex with the managed sandbox network proxy active. The spawned environment has
CODEX_NETWORK_PROXY_ACTIVE=1. - Open a repository using Yarn Berry. This reproduction uses Yarn 4.17.1.
- Run
yarn config get httpProxyoryarn install --immutableinside the Codex sandbox. - Observe that Yarn exits because the injected
YARN_NO_PROXYbecomes the unsupportednoProxyconfiguration key. - Run the same command through
env -u YARN_NO_PROXY; it proceeds normally and continues to useYARN_HTTP_PROXYandYARN_HTTPS_PROXY.
What is the expected behavior?
Codex should not inject package-manager-specific environment variables that the package manager rejects. Yarn Berry commands should run normally while managed proxying remains enabled.
A likely fix is to remove YARN_NO_PROXY from NO_PROXY_ENV_KEYS. Alternatively, environment exclusions would need to run after managed proxy injection so users could exclude this one key without disabling the network proxy.
Additional information
The current network-proxy implementation explicitly includes YARN_NO_PROXY in NO_PROXY_ENV_KEYS and writes every key in that list into child environments:
- https://github.com/openai/codex/blob/7276d67081dd4149a15c72972e639b0d707915a4/codex-rs/network-proxy/src/proxy.rs#L652-L658
- https://github.com/openai/codex/blob/7276d67081dd4149a15c72972e639b0d707915a4/codex-rs/network-proxy/src/proxy.rs#L710-L758
The documented shell_environment_policy.filters feature looks relevant, but managed proxy values are applied later in the spawn path. Related report: #40896.
Current workaround for every Yarn invocation:
env -u YARN_NO_PROXY yarn ...