Honor configured proxy routes for auth refreshes (#34655)

## Why

ChatGPT token refresh requests need to follow the same configured routing policy as other authentication traffic, including environments that use the system proxy.

## What changed

- Require an `AuthRouteConfig` throughout login, logout, token refresh, personal access token, and agent identity flows.
- Build auth HTTP clients directly from that configuration instead of falling back to a default HTTP client when routing configuration is absent.

## Testing

- Add an integration test that refreshes a token through a cached system-proxy route and verifies the proxy receives the expected request.

GitOrigin-RevId: 7d54ab3219939a49921c51faf08cd4c2eabca51c
This commit is contained in:
Michael Bolin
2026-07-22 02:26:16 +00:00
committed by copyberry
parent 1823c13771
commit d4fcb2873b
24 changed files with 281 additions and 127 deletions
+2
View File
@@ -36,6 +36,8 @@ pub use crate::outbound_proxy::HttpClientFactory;
pub use crate::outbound_proxy::OutboundProxyPolicy;
pub use crate::outbound_proxy::OutboundProxyRoute;
pub use crate::outbound_proxy::RouteFailureClass;
#[doc(hidden)]
pub use crate::outbound_proxy::cache_system_proxy_route_for_test;
pub use crate::request::EncodedJsonBody;
pub use crate::request::PreparedRequestBody;
pub use crate::request::Request;
+8 -1
View File
@@ -544,7 +544,6 @@ fn cached_system_proxy_decision_from_cache(
None
}
#[cfg(test)]
fn cache_system_proxy_decision(request_url: &str, decision: SystemProxyDecision) {
let cache = SYSTEM_PROXY_CACHE.get_or_init(|| Mutex::new(HashMap::new()));
if let Ok(mut cache) = cache.lock() {
@@ -553,6 +552,14 @@ fn cache_system_proxy_decision(request_url: &str, decision: SystemProxyDecision)
}
}
/// Primes one proxy decision for cross-crate integration tests.
///
/// This is public only so tests in HTTP-client consumers can exercise system-proxy routing
/// deterministically on every supported platform.
pub fn cache_system_proxy_route_for_test(request_url: &str, proxy_url: String) {
cache_system_proxy_decision(request_url, SystemProxyDecision::Proxy { url: proxy_url });
}
fn insert_system_proxy_cache_entry(
cache: &mut HashMap<String, CachedSystemProxyDecision>,
cache_key: &str,