Managed network proxy injects unsupported YARN_NO_PROXY and breaks Yarn Berry
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
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 ...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in codex-rs/network-proxy/src/proxy.rs at the NO_PROXY_ENV_KEYS definition around lines 652-658, then trace the child-environment injection around lines 710-758. Reproduce with Yarn Berry using yarn config get httpProxy under the managed proxy. Done means Yarn no longer rejects the injected setting while HTTP and HTTPS proxying remains enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, networking
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 84/100