Skip to main content

Module net

Module net 

Source
Expand description

Error classification for the OpenAI-compat / Codex provider routes.

Historically every error escaping try_route was blanket-wrapped in RuntimeError::Config("openai provider: …") — so a transient network blip against chatgpt.com/backend-api/codex/responses surfaced to the user as “Config error”, implying their configuration was broken (real incident: session 20260714-025948-3dab). This module classifies provider-route errors into honest categories:

  • transport failures (reqwest::Error) → RuntimeError::ApiStatus with a host-aware humanized message that preserves the full cause chain
  • upstream HTTP status failures (codex request failed: 503: …) → RuntimeError::ApiStatus
  • cancellation → RuntimeError::Canceled
  • everything else (missing keys, malformed tokens, …) → genuine RuntimeError::Config, same prefix as before

Functions§

provider_error_to_runtime
Classify an error escaping the OpenAI/Codex provider route into the right RuntimeError variant. Also logs the full cause chain at WARN — provider-route failures were previously invisible in the logs.

Type Aliases§

BoxedProviderError
Boxed error type produced by the provider routes.