From 9aa151c68749b13f5e30f71fa4c760d0f5d4bf6a Mon Sep 17 00:00:00 2001 From: Ahmed Allam Date: Fri, 17 Jul 2026 23:43:34 +0000 Subject: [PATCH] fix(llm): retry statusless mid-stream provider errors (quota/billing) The SDK's http_status retry policy only retries errors carrying a known HTTP status code, but quota/billing (and other provider-side) failures often surface inside a streamed response as a bare error with no status code, so they were failing on the first attempt. Add a statusless retry policy to DEFAULT_MODEL_RETRY (retry count and backoff unchanged) so they are retried before a genuine exhaustion fails the run; user aborts are never retried. --- strix/config/models.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/strix/config/models.py b/strix/config/models.py index db9fcb7b..931d15b1 100644 --- a/strix/config/models.py +++ b/strix/config/models.py @@ -22,17 +22,7 @@ if TYPE_CHECKING: def _retry_statusless_provider_errors(context: RetryPolicyContext) -> bool: - """Retry provider errors that arrive without an HTTP status code. - - Quota, billing, and other provider-side failures frequently surface *inside* - a streamed response as a bare error with no ``status_code`` (the transport - already returned ``200`` before the failure). The built-in ``http_status`` - policy skips these because it requires a known code, so they would otherwise - fail on the first attempt. Retrying a statusless error (the runner still - refuses to replay a stream once content has been emitted, and never retries a - user abort) mirrors the pre-SDK engine, which retried any error lacking a - definitive client status code. - """ + """Retry statusless provider errors (e.g. mid-stream quota/billing), but not aborts.""" normalized = context.normalized if normalized.is_abort: return False