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::ApiStatuswith 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
RuntimeErrorvariant. Also logs the full cause chain at WARN — provider-route failures were previously invisible in the logs. - provider_
error_ to_ runtime_ for - Like
provider_error_to_runtime, butqualified_model(e.g.kimi-code/k3) lets a vetted broker status label such asprovider request failed: 403 Forbidden [access_terminated_error]be rendered as an actionable, provider-aware message. The label is one of OUR static constants (selected broker-side, never provider bytes) and the humanizer only ever returns our own text; the raw prefix message is kept for the log line.
Type Aliases§
- Boxed
Provider Error - Boxed error type produced by the provider routes.