Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation: Predictable Network Access for Codex in Proxy Environments
Many enterprise and academic environments route outbound traffic through HTTP proxies (e.g., Zscaler, PAC/explicit proxies, on-prem egress). Previously, Codex lacked native proxy support, which caused:
HTTP_PROXY
export or wrapper scripts) that increased complexity.The goal of this PR is to make proxy usage an explicit and supported configuration so that Codex behaves consistently across local, CI, and sandboxed environments.
Summary of Changes
http_proxy
field toConfig
andConfigToml
.http_proxy
field inConfigProfile
.http_proxy
is set, Codex now forwards its value to theHTTP_PROXY
environment variable before the HTTP client initializes.http_proxy_from_config_sets_environment
to verify that configuration and process environment are correctly updated.## http_proxy
section indocs/config.md
with usage examples and sandbox behavior notes.Key files:
codex-rs/core/src/config.rs
— added the field, environment propagation, and test.codex-rs/core/src/config_profile.rs
— profile wiring.docs/config.md
— documentation and TOML examples.Design Rationale
Single Source of Truth
By defining
http_proxy
declaratively inconfig.toml
or the active profile, and then forwarding it toHTTP_PROXY
, we unify behavior across:export HTTP_PROXY
.Compatibility with the Rust ecosystem
Most HTTP stacks (
reqwest
/hyper
) already respect theHTTP_PROXY
environment variable. Leveraging this standard minimizes custom code and risk.Priority Resolution
http_proxy
follows the existing configuration merge order: Profile → Base Config → Defaults. This keeps behavior predictable and easy to debug.Security & Operational Notes
Backward Compatibility
http_proxy
is fully optional — if unset, Codex behaves exactly as before.Alternatives Considered
Testing
http_proxy_from_config_sets_environment
.http_proxy = None
, behavior matches the previous default.Developer Experience
Documentation now includes: