mirror of
https://github.com/openai/codex.git
synced 2026-11-13 21:30:47 +00:00
## What changed - Probe the configured Responses inference endpoint with Codex's route-aware HTTP client, including configured proxy and custom CA behavior. - Classify TLS, proxy authentication, proxy configuration, resolution, and timeout failures into actionable diagnostics. - Report privacy-safe macOS system proxy state and suggest enabling `respect_system_proxy` when a configured proxy is otherwise unused. - Preserve system-root fallback when a custom CA is invalid, and account for provider-specific API key configuration when selecting the probe route. ## Testing - Cover inference endpoint selection, invalid custom CA fallback, proxy authentication failures, TLS classification, and macOS proxy reporting. GitOrigin-RevId: c30a3ca5a332119e2b2f8c65341ef9b2251a28a2
38 lines
1.1 KiB
Rust
38 lines
1.1 KiB
Rust
use pretty_assertions::assert_eq;
|
|
use wiremock::Mock;
|
|
use wiremock::MockServer;
|
|
use wiremock::ResponseTemplate;
|
|
use wiremock::matchers::method;
|
|
|
|
use super::super::CheckStatus;
|
|
use super::super::ProviderAuthReachabilityMode;
|
|
use super::super::provider_reachability_check;
|
|
use super::super::provider_reachability_plan_from_parts;
|
|
|
|
#[tokio::test]
|
|
async fn provider_reachability_rejects_proxy_authentication_challenges() {
|
|
let proxy = MockServer::start().await;
|
|
Mock::given(method("HEAD"))
|
|
.respond_with(ResponseTemplate::new(407))
|
|
.mount(&proxy)
|
|
.await;
|
|
let plan = provider_reachability_plan_from_parts(
|
|
ProviderAuthReachabilityMode::Chatgpt,
|
|
"openai",
|
|
"OpenAI",
|
|
/*provider_base_url*/ None,
|
|
/*provider_query_params*/ None,
|
|
/*is_amazon_bedrock*/ false,
|
|
&format!("{}/backend-api/", proxy.uri()),
|
|
);
|
|
|
|
let check = provider_reachability_check(plan).await;
|
|
assert_eq!(check.status, CheckStatus::Fail);
|
|
assert!(
|
|
check
|
|
.details
|
|
.join(" ")
|
|
.contains("proxy authentication required (HTTP 407)")
|
|
);
|
|
}
|