Route exec-server HTTP through configured proxy policy (#35023)

## Why

Delegated HTTP requests need to honor the same outbound proxy policy as the
Codex process that starts the exec server.

## What changed

- Pass the configured `HttpClientFactory` through local and remote exec-server
  startup and use route-aware client pools for delegated HTTP and local MCP
  requests.
- Preserve per-request timeouts and follow-or-stop redirect behavior while
  keeping request URLs and sensitive response headers out of diagnostics.

## Testing

- Cover configured system-proxy routing across the exec-server transport.
- Cover both redirect policies and verify that success and failure logs do not
  expose request or response secrets.

GitOrigin-RevId: 4af6aec1d265c4db62dfcb6e1fb076fb31736137
This commit is contained in:
Celia Chen
2026-07-23 22:39:28 +00:00
committed by copyberry
parent fe0d472c4c
commit 1ee8f49175
25 changed files with 569 additions and 85 deletions
+7 -1
View File
@@ -295,6 +295,12 @@ impl McpRuntimeContext {
self.local_stdio_fallback_cwd.clone()
}
pub(crate) fn local_http_client(&self) -> Arc<dyn HttpClient> {
Arc::new(ReqwestHttpClient::new(
self.environment_manager.http_client_factory().clone(),
))
}
pub(crate) fn resolve_server_environment(
&self,
server_name: &str,
@@ -334,7 +340,7 @@ impl McpRuntimeContext {
Ok(self
.resolve_server_environment(server_name, config)?
.map_or_else(
|| Arc::new(ReqwestHttpClient) as Arc<dyn HttpClient>,
|| self.local_http_client(),
|environment| environment.get_http_client(),
))
}