Skip to content

PAC 2 - Add shared auth system proxy contract#26707

Merged
canvrno-oai merged 26 commits into
mainfrom
canvnro/codex-pac-pr2-contract
Jun 22, 2026
Merged

PAC 2 - Add shared auth system proxy contract#26707
canvrno-oai merged 26 commits into
mainfrom
canvnro/codex-pac-pr2-contract

Conversation

@canvrno-oai

@canvrno-oai canvrno-oai commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Stacked on #26706.

Adds the shared auth/system-proxy contract that later platform resolver PRs plug into. This PR moves Codex-owned auth and startup HTTP clients through a common route-aware boundary, but does not yet add Windows or macOS system proxy resolution.

The default path remains unchanged when respect_system_proxy is absent or disabled.

Implementation

  • Adds codex-client/src/outbound_proxy.rs with the shared route-selection model:
    • OutboundProxyConfig;
    • ClientRouteClass;
    • RouteFailureClass;
    • build_reqwest_client_for_route.
  • Preserves the existing reqwest/default-client behavior when no route config is supplied.
  • Uses the fixed MVP routing policy when route config is supplied: platform system/PAC/WPAD discovery, then explicit env proxy variables, then direct connection.
  • Keeps platform-specific system discovery behind the shared client boundary. This PR provides the contract and fallback behavior; later resolver PRs plug in Windows and macOS discovery.
  • Adds login::AuthRouteConfig so auth call sites depend on a small policy type instead of platform resolver details.
  • Maps the resolved Config.respect_system_proxy boolean into AuthRouteConfig for auth-owned clients.
  • Wires the route config through browser login, device-code login, access-token login, login status, logout/revoke, token refresh, API-key exchange, app-server account login, TUI/app startup, cloud-config bootstrap, cloud tasks, plugin auth, and exec startup config loading.

End-user behavior

  • No behavior changes by default.
  • When respect_system_proxy = true, auth-owned clients opt into the shared route-aware client path.
  • On platforms without a resolver implementation in this PR, system discovery is unavailable and the route-aware path falls back to explicit env proxy handling, then direct connection.
  • Custom CA handling remains separate from proxy route selection and still runs through the shared client builder.
  • No proxy URLs, PAC contents, or resolved platform details are exposed through the public config surface introduced here.

Tests

Adds or updates coverage for:

  • preserving default auth-client fallback behavior when no route config is provided;
  • injected environment-proxy fallback without mutating process environment;
  • existing login-server E2E flows using explicit auth_route_config: None to guard unchanged default behavior;
  • updated auth manager, login, logout, cloud-config, startup, and plugin-auth call sites passing route config explicitly.

@canvrno-oai canvrno-oai changed the title [codex] Add shared auth system proxy contract PAC - Add shared auth system proxy contract Jun 6, 2026
@canvrno-oai canvrno-oai force-pushed the canvnro/codex-pac-pr2-contract branch from 6fcd2bd to c1f900e Compare June 8, 2026 17:44
@canvrno-oai canvrno-oai force-pushed the canvnro/codex-pac-pr1-conf branch from 02c4962 to 9175bbb Compare June 8, 2026 17:52
@canvrno-oai canvrno-oai force-pushed the canvnro/codex-pac-pr2-contract branch 2 times, most recently from 4ffc2f4 to 968f40d Compare June 8, 2026 20:39
@canvrno-oai canvrno-oai changed the title PAC - Add shared auth system proxy contract PAC 2 - Add shared auth system proxy contract Jun 9, 2026
@canvrno-oai canvrno-oai force-pushed the canvnro/codex-pac-pr1-conf branch from 9b202fb to ffb3961 Compare June 10, 2026 18:18
@canvrno-oai canvrno-oai force-pushed the canvnro/codex-pac-pr2-contract branch 3 times, most recently from bc1a433 to 691b9fa Compare June 11, 2026 19:47
Comment thread codex-rs/login/src/server.rs Outdated
Comment thread codex-rs/login/src/auth/default_client.rs Outdated
Comment thread codex-rs/login/src/auth/default_client.rs
Comment thread codex-rs/login/src/auth/default_client.rs Outdated
Comment thread codex-rs/login/src/auth/default_client_tests.rs Outdated
Comment thread codex-rs/login/src/auth/revoke.rs Outdated
Comment thread codex-rs/login/src/auth/default_client.rs
Comment thread codex-rs/cli/src/login.rs Outdated
Comment thread codex-rs/cli/src/login.rs Outdated
Comment thread codex-rs/cli/src/login.rs Outdated
Comment thread codex-rs/login/src/auth/agent_identity.rs Outdated
Comment thread codex-rs/login/src/auth/personal_access_token.rs
Comment thread codex-rs/login/src/device_code_auth.rs Outdated
Comment thread codex-rs/login/src/device_code_auth.rs Outdated
Comment thread codex-rs/cloud-tasks/src/util.rs Outdated
@celia-oai celia-oai requested a review from anp-oai June 15, 2026 20:55
@canvrno-oai canvrno-oai force-pushed the canvnro/codex-pac-pr2-contract branch 2 times, most recently from 008144e to fa620b3 Compare June 16, 2026 16:37
Base automatically changed from canvnro/codex-pac-pr1-conf to main June 16, 2026 23:54
@canvrno-oai canvrno-oai force-pushed the canvnro/codex-pac-pr2-contract branch from e74fc31 to a2f4da6 Compare June 17, 2026 00:01
@canvrno-oai canvrno-oai force-pushed the canvnro/codex-pac-pr2-contract branch from a2f4da6 to 860d6e5 Compare June 17, 2026 18:51
Comment thread codex-rs/codex-client/src/outbound_proxy.rs
@canvrno-oai canvrno-oai requested a review from cooper-oai June 17, 2026 21:20

@celia-oai celia-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved for auth with comment. will let @anp-oai review codex client / proxy changes

Comment thread codex-rs/login/src/auth/manager.rs Outdated
Comment thread codex-rs/login/src/device_code_auth.rs
Comment thread codex-rs/codex-client/src/outbound_proxy.rs Outdated
Comment thread codex-rs/codex-client/src/outbound_proxy.rs
Comment thread codex-rs/codex-client/src/outbound_proxy.rs
Comment thread codex-rs/login/src/auth/default_client.rs
Comment thread codex-rs/login/src/auth/personal_access_token.rs
Comment thread codex-rs/login/src/auth/personal_access_token_tests.rs
Comment thread codex-rs/login/src/outbound_proxy.rs Outdated
Comment thread codex-rs/login/src/server.rs Outdated
Comment thread codex-rs/codex-client/src/outbound_proxy_tests.rs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4d2e9883c1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/codex-client/src/outbound_proxy.rs
Comment thread codex-rs/codex-client/src/outbound_proxy.rs
Comment thread codex-rs/codex-client/src/outbound_proxy.rs Outdated
Comment thread codex-rs/codex-client/src/outbound_proxy.rs Outdated
@canvrno-oai canvrno-oai merged commit 1659c4a into main Jun 22, 2026
46 of 47 checks passed
@canvrno-oai canvrno-oai deleted the canvnro/codex-pac-pr2-contract branch June 22, 2026 20:03
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants