Reuse route-aware clients for OpenAI file uploads (#35717)

## What changed

- Store a request-logging-disabled `RouteAwareClientPool` in session services and use it for file creation, blob upload, and finalization requests.
- Preserve the existing system-root fallback for transport-default proxy routes, and emit a warning event when that fallback is used.
- Remove the direct `reqwest` dependency from `codex-api` now that uploads use the shared HTTP abstraction.

## Testing

- Add coverage for completing multiple uploads through a shared client pool.

GitOrigin-RevId: 01842415cad2d349a6bd3869abb3332e8110ebce
This commit is contained in:
Celia Chen authored and copyberry committed 2026-07-28 04:54:32 +00:00
1 parent 2494d939cf
commit 899539c03a
11 files changed
+228 -104

No files matched your search

@@ -212,6 +212,12 @@ impl HttpClientBuilder {
match build_with_custom_ca(self.clone().reqwest_builder(proxy_routing)) {
Ok(inner) => HttpClient::from_parts(inner, request_logging),
Err(error) => {
tracing::event!(
target: "codex_otel.log_only",
tracing::Level::WARN,
event.name = "codex.http_client.custom_ca_fallback",
"HTTP client fell back to system root certificates"
);
tracing::warn!(error = %error, "failed to build HTTP client with custom CA");
self.reqwest_builder(proxy_routing)
.build()