mirror of
https://github.com/openai/codex.git
synced 2026-09-07 15:40:00 +00:00
## What changed - Classify HTTP connection failures separately from other network errors without exposing request URLs. - For sampling requests, retry connection failures with exponential delays from 5 to 60 seconds and show a `Reconnecting... waiting for network` stream error. - Preserve the normal stream retry budget while waiting for the provider to become reachable. Keep the existing bounded retry behavior for other retryable errors. ## Testing - Verify connection errors are classified without leaking URL contents. - Verify a turn recovers after its provider becomes reachable and still applies the configured retry limit to a subsequent incomplete stream. GitOrigin-RevId: 646553290c865a1332abd30c4a64ed9266bbfc6f
36 lines
809 B
Rust
36 lines
809 B
Rust
//! Errors returned by the shared Codex HTTP transport.
|
|
|
|
use crate::client::HttpError;
|
|
use http::HeaderMap;
|
|
use http::StatusCode;
|
|
use thiserror::Error;
|
|
|
|
#[derive(Debug, Error)]
|
|
pub enum TransportError {
|
|
#[error("http {status}: {body:?}")]
|
|
Http {
|
|
status: StatusCode,
|
|
url: Option<String>,
|
|
headers: Option<HeaderMap>,
|
|
body: Option<String>,
|
|
},
|
|
#[error("retry limit reached")]
|
|
RetryLimit,
|
|
#[error("timeout")]
|
|
Timeout,
|
|
#[error("connection failed: {0}")]
|
|
Connection(#[source] HttpError),
|
|
#[error("network error: {0}")]
|
|
Network(String),
|
|
#[error("request build error: {0}")]
|
|
Build(String),
|
|
}
|
|
|
|
#[derive(Debug, Error)]
|
|
pub enum StreamError {
|
|
#[error("stream failed: {0}")]
|
|
Stream(String),
|
|
#[error("timeout")]
|
|
Timeout,
|
|
}
|