Migrate login HTTP construction to HttpClient (#34643)

## Why

`codex-http-client` is the intended owner of direct `reqwest` usage.

## What changed

- Build Codex's default and route-aware clients with `HttpClientBuilder`, and return `HttpClient` directly to API, model discovery, auth, remote control, skills, and extension callers.
- Preserve custom CA, proxy, Cloudflare cookie, sandbox, and request-logging policies while removing `codex-login`'s direct `reqwest` dependency.
- Use shared HTTP types for auth headers, status codes, transport errors, and login-server tests.

## Testing

- Add a Linux integration test verifying that a regular Responses API turn traverses the configured system proxy.

GitOrigin-RevId: 714695fb80762d2083e2f7a6414183e2b3b63854
This commit is contained in:
Michael Bolin authored and copyberry committed 2026-07-22 00:50:28 +00:00
1 parent c5eb33aed1
commit 539c0e1100
21 files changed
+210 -131

No files matched your search

@@ -12,7 +12,7 @@ use codex_app_server_protocol::RemoteControlClientsListResponse;
use codex_app_server_protocol::RemoteControlClientsRevokeParams;
use codex_app_server_protocol::RemoteControlClientsRevokeResponse;
use codex_login::AuthManager;
use codex_login::default_client::build_reqwest_client;
use codex_login::default_client::create_client_without_request_logging;
use serde::Deserialize;
use std::io;
use std::io::ErrorKind;
@@ -186,7 +186,7 @@ async fn send_client_management_request_once(
request: &ClientManagementRequest<'_>,
action: &str,
) -> io::Result<ClientManagementResponse> {
let client = build_reqwest_client();
let client = create_client_without_request_logging();
let auth_headers = auth.request_headers()?;
let request = match request {
ClientManagementRequest::List { url, params } => {
@@ -7,7 +7,7 @@ use super::protocol::StartRemoteControlPairingResponse;
use axum::http::HeaderMap;
use codex_app_server_protocol::RemoteControlPairingStartResponse;
use codex_app_server_protocol::RemoteControlPairingStatusResponse;
use codex_login::default_client::build_reqwest_client;
use codex_login::default_client::create_client_without_request_logging;
use codex_state::RemoteControlEnrollmentRecord;
use codex_state::StateRuntime;
use std::io;
@@ -59,7 +59,7 @@ impl RemoteControlEnrollment {
.as_deref()
.ok_or_else(pairing_unavailable_error)?;
let response = build_reqwest_client()
let response = create_client_without_request_logging()
.post(&self.remote_control_target.pair_url)
.timeout(REMOTE_CONTROL_PAIRING_TIMEOUT)
.bearer_auth(remote_control_token)
@@ -154,7 +154,7 @@ impl RemoteControlEnrollment {
.as_deref()
.ok_or_else(pairing_unavailable_error)?;
let response = build_reqwest_client()
let response = create_client_without_request_logging()
.post(&self.remote_control_target.pair_status_url)
.timeout(REMOTE_CONTROL_PAIRING_TIMEOUT)
.bearer_auth(remote_control_token)
@@ -9,7 +9,7 @@ use super::protocol::RefreshRemoteServerRequest;
use super::protocol::RemoteControlTarget;
use axum::http::HeaderMap;
use axum::http::StatusCode;
use codex_login::default_client::build_reqwest_client;
use codex_login::default_client::create_client_without_request_logging;
use rand::Rng;
use serde::Serialize;
use serde::de::DeserializeOwned;
@@ -223,7 +223,7 @@ where
Request: Serialize,
Response: DeserializeOwned,
{
let client = build_reqwest_client();
let client = create_client_without_request_logging();
let auth_headers = auth.request_headers()?;
let response = client
.post(url)