openai / openai/codex

Managed network proxy injects unsupported YARN_NO_PROXY and breaks Yarn Berry

Open Beginner friendly
#40,956 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug CLI connectivity sandbox
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?
  1. Run Codex with the managed sandbox network proxy active. The spawned environment has CODEX_NETWORK_PROXY_ACTIVE=1.
  2. Open a repository using Yarn Berry. This reproduction uses Yarn 4.17.1.
  3. Run yarn config get httpProxy or yarn install --immutable inside the Codex sandbox.
  4. Observe that Yarn exits because the injected YARN_NO_PROXY becomes the unsupported noProxy configuration key.
  5. Run the same command through env -u YARN_NO_PROXY; it proceeds normally and continues to use YARN_HTTP_PROXY and YARN_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:

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.