mirror of
https://github.com/openai/codex.git
synced 2026-11-08 20:40:33 +00:00
Honor system proxy settings for standalone web search (#47142)
## Why Standalone web search used a default HTTP client, bypassing the configured system proxy route when `respect_system_proxy` was enabled. ## What changed Pass the configured `HttpClientFactory` to the web search tool and create its client asynchronously for the provider's search URL using the API route policy. Export and reuse `SEARCH_ENDPOINT` so route selection and search requests use the same endpoint. ## Testing Add an isolated regression test with environment proxies removed and a mock system proxy. Verify that standalone web search reaches the proxy and returns its result in the follow-up model request. GitOrigin-RevId: 3b64803a777b9d1eb0ccf694e06658b0fd562129
This commit is contained in:
@@ -11,6 +11,9 @@ use http::Method;
|
||||
use serde_json::to_value;
|
||||
use std::sync::Arc;
|
||||
|
||||
/// The provider-relative endpoint for standalone web search.
|
||||
pub const SEARCH_ENDPOINT: &str = "alpha/search";
|
||||
|
||||
pub struct SearchClient<T: HttpTransport> {
|
||||
session: EndpointSession<T>,
|
||||
}
|
||||
@@ -28,10 +31,6 @@ impl<T: HttpTransport> SearchClient<T> {
|
||||
}
|
||||
}
|
||||
|
||||
fn path() -> &'static str {
|
||||
"alpha/search"
|
||||
}
|
||||
|
||||
pub async fn search(
|
||||
&self,
|
||||
request: &SearchRequest,
|
||||
@@ -41,7 +40,7 @@ impl<T: HttpTransport> SearchClient<T> {
|
||||
.map_err(|e| ApiError::Stream(format!("failed to encode search request: {e}")))?;
|
||||
let resp = self
|
||||
.session
|
||||
.execute(Method::POST, Self::path(), extra_headers, Some(body))
|
||||
.execute(Method::POST, SEARCH_ENDPOINT, extra_headers, Some(body))
|
||||
.await?;
|
||||
serde_json::from_slice(&resp.body)
|
||||
.map_err(|e| ApiError::Stream(format!("failed to decode search response: {e}")))
|
||||
|
||||
Reference in New Issue
Block a user