fix(providers): fall back to configured models when models endpoint fetch fails (#7530)

Signed-off-by: Pete Gonzalez <4673363+octogonz@users.noreply.github.com>
Signed-off-by: Douwe Osinga <douwe@squareup.com>
Co-authored-by: Pete Gonzalez <octogonz@users.noreply.github.com>
Co-authored-by: Douwe Osinga <douwe@squareup.com>
This commit is contained in:
Pete Gonzalez
2026-03-26 12:49:37 -07:00
committed by GitHub
parent 4a02379731
commit 27e197e467
4 changed files with 139 additions and 43 deletions
+8
View File
@@ -34,6 +34,9 @@ pub enum ProviderError {
#[error("Unsupported operation: {0}")]
NotImplemented(String),
#[error("Endpoint not found (404): {0}")]
EndpointNotFound(String),
#[error("Credits exhausted: {details}")]
CreditsExhausted {
details: String,
@@ -53,9 +56,14 @@ impl ProviderError {
ProviderError::ExecutionError(_) => "execution",
ProviderError::UsageError(_) => "usage",
ProviderError::NotImplemented(_) => "not_implemented",
ProviderError::EndpointNotFound(_) => "endpoint_not_found",
ProviderError::CreditsExhausted { .. } => "credits_exhausted",
}
}
pub fn is_endpoint_not_found(&self) -> bool {
matches!(self, ProviderError::EndpointNotFound(_))
}
}
fn is_network_error(err: &reqwest::Error) -> bool {