mirror of
https://github.com/openai/codex.git
synced 2026-08-23 13:09:46 +00:00
## 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
38 lines
1.2 KiB
Rust
38 lines
1.2 KiB
Rust
//! Minimal exec-server fixture for Bazel-only integration tests.
|
|
//!
|
|
//! Linking only exec-server avoids depending on the full Codex CLI binary
|
|
//! when a test only needs a WebSocket executor endpoint. It handles the arg0
|
|
//! helper mode because sandboxed process requests re-exec this binary.
|
|
|
|
use codex_exec_server::ExecServerRuntimePaths;
|
|
use codex_http_client::HttpClientFactory;
|
|
use codex_http_client::OutboundProxyPolicy;
|
|
#[cfg(unix)]
|
|
use std::ffi::OsStr;
|
|
|
|
#[tokio::main]
|
|
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
|
#[cfg(unix)]
|
|
{
|
|
let mut args = std::env::args_os();
|
|
let _ = args.next();
|
|
if args.next().as_deref()
|
|
== Some(OsStr::new(
|
|
codex_exec_server::CODEX_ARG0_EXEC_HELPER_ARG1,
|
|
))
|
|
{
|
|
codex_exec_server::run_arg0_exec_helper_main();
|
|
}
|
|
}
|
|
|
|
let current_exe = std::env::current_exe()?;
|
|
let runtime_paths =
|
|
ExecServerRuntimePaths::new(current_exe, /*codex_linux_sandbox_exe*/ None)?;
|
|
codex_exec_server::run_main(
|
|
"ws://127.0.0.1:0",
|
|
runtime_paths,
|
|
HttpClientFactory::new(OutboundProxyPolicy::ReqwestDefault),
|
|
)
|
|
.await
|
|
}
|