mirror of
https://github.com/openai/codex.git
synced 2026-12-04 00:51:02 +00:00
## Why HTTP retries used local backoff even when the server supplied `Retry-After`. Relative retry delays also failed to account for time spent propagating errors or reporting retries. ## What changed - Parse `Retry-After` delay seconds and HTTP dates into a monotonic deadline captured when response headers arrive. - Honor that deadline for HTTP retries, falling back to local backoff when valid advice is absent. - Preserve deadlines through API and Bedrock error mapping, stream retries, and exhausted retry state. Expired advice remains a zero delay instead of triggering local backoff. ## Testing Add coverage for header parsing, deadline countdown and expiry, error mapping after exhausted HTTP retries, and delayed stream retry notifications. Update Responses and remote compaction tests to verify that HTTP retries honor `Retry-After`. GitOrigin-RevId: a2eff02946e5524f29e06f7ba1431e3d339261a4
79 lines
3.0 KiB
Rust
79 lines
3.0 KiB
Rust
mod chatgpt_cloudflare_cookies;
|
|
mod chatgpt_hosts;
|
|
mod client;
|
|
mod client_builder;
|
|
mod client_tls;
|
|
mod custom_ca;
|
|
mod error;
|
|
mod network_policy;
|
|
mod outbound_proxy;
|
|
mod request;
|
|
mod request_builder;
|
|
mod request_draft;
|
|
mod response;
|
|
mod retry_after;
|
|
mod route_aware_client_pool;
|
|
mod route_aware_redirect;
|
|
mod tls_backend_fallback;
|
|
mod transport;
|
|
|
|
pub use crate::chatgpt_cloudflare_cookies::with_chatgpt_cloudflare_cookie_store;
|
|
pub use crate::chatgpt_hosts::is_allowed_chatgpt_host;
|
|
pub use crate::client::HttpClient;
|
|
pub use crate::client::HttpError;
|
|
pub use crate::client_builder::HttpClientBuilder;
|
|
pub use crate::client_tls::HttpClientTlsConfig;
|
|
pub use crate::custom_ca::BuildCustomCaTransportError;
|
|
/// Test-only subprocess hook for custom CA coverage.
|
|
///
|
|
/// This stays public only so the `custom_ca_probe` binary target can reuse the shared helper. It
|
|
/// is hidden from normal docs because ordinary callers should use
|
|
/// [`build_reqwest_client_with_custom_ca`] instead.
|
|
#[doc(hidden)]
|
|
pub use crate::custom_ca::build_reqwest_client_for_subprocess_tests;
|
|
pub use crate::custom_ca::build_reqwest_client_with_custom_ca;
|
|
pub use crate::custom_ca::build_rustls_client_config_with_custom_ca;
|
|
pub use crate::custom_ca::maybe_build_rustls_client_config_with_custom_ca;
|
|
pub use crate::error::StreamError;
|
|
pub use crate::error::TransportError;
|
|
pub use crate::network_policy::DestinationPolicy;
|
|
pub use crate::network_policy::NetworkPermit;
|
|
pub use crate::network_policy::NetworkPolicy;
|
|
pub use crate::network_policy::NetworkPolicyController;
|
|
pub use crate::network_policy::NetworkPolicyDenied;
|
|
pub use crate::network_policy::NetworkPolicyRevision;
|
|
pub use crate::outbound_proxy::BuildRouteAwareHttpClientError;
|
|
pub use crate::outbound_proxy::ClientRouteClass;
|
|
pub use crate::outbound_proxy::HttpClientFactory;
|
|
#[cfg(target_os = "macos")]
|
|
pub use crate::outbound_proxy::MacosSystemProxyConfiguration;
|
|
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;
|
|
#[cfg(target_os = "macos")]
|
|
pub use crate::outbound_proxy::macos_system_proxy_configuration;
|
|
pub use crate::request::EncodedJsonBody;
|
|
pub use crate::request::PreparedRequestBody;
|
|
pub use crate::request::Request;
|
|
pub use crate::request::RequestBody;
|
|
pub use crate::request::RequestCompression;
|
|
pub use crate::request::Response;
|
|
pub use crate::request_builder::RequestBuilder;
|
|
pub use crate::response::HttpResponse;
|
|
pub use crate::retry_after::RetryAfter;
|
|
pub use crate::route_aware_client_pool::RouteAwareClientPool;
|
|
pub use crate::route_aware_client_pool::RouteAwareClientPoolError;
|
|
pub use crate::route_aware_client_pool::RouteAwareRequestError;
|
|
pub use crate::transport::ByteStream;
|
|
pub use crate::transport::HttpTransport;
|
|
pub use crate::transport::ReqwestTransport;
|
|
pub use crate::transport::StreamResponse;
|
|
|
|
#[cfg(windows)]
|
|
mod windows_tls;
|
|
|
|
#[cfg(windows)]
|
|
pub use crate::windows_tls::build_windows_platform_tls_config;
|