fix(llm): retry statusless mid-stream provider errors (quota/billing/transient)#790
Merged
Merged
Conversation
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Contributor
Greptile SummaryThis PR restores retries for statusless provider errors raised before streamed content is emitted. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (4): Last reviewed commit: "fix(llm): retry statusless mid-stream pr..." | Re-trigger Greptile |
Contributor
Author
Contributor
Author
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 so they are retried (before any content is streamed; user aborts are never retried), restoring the pre-SDK engine's resilience. If the provider is genuinely exhausted, the error still propagates and fails the scan after retries.
devin-ai-integration
Bot
force-pushed
the
devin/1784230794-isolate-subagent-model-errors
branch
from
July 17, 2026 23:35
c13b1dc to
87f24e2
Compare
Member
0xallam
approved these changes
Jul 17, 2026
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Provider errors that surface mid-stream as a bare
openai.APIErrorwith no HTTP status code (the SSEdata.errorpath inopenai/_streaming.py— the request already returned200 OK, then the error appears inside the stream) were getting zero retries and failing on the first attempt. Quota/billing exhaustion is the common case, but so is any transient mid-stream blip.The SDK retry policy only retried errors with a known status code:
The pre-SDK engine instead retried on
code is None or litellm._should_retry(code)— i.e. it did retry statusless errors. Restore that by adding a statusless retry policy:added to
DEFAULT_MODEL_RETRY.policy. Retry count (5) and backoff (2→90s, ~62s total) are unchanged. The runner still refuses to replay a stream once content has been emitted (emitted_retry_unsafe_event), so this only retries statusless failures that occur before any content streams — the common shape for quota/rate errors — and a user abort is never retried.If the provider is genuinely exhausted, the error still propagates and the scan fails after retries — intentionally not a graceful/resumable stop (non-interactive SaaS runs can't be resumed interactively). The pre-existing persistent-
RateLimitErrorhandling inrun_strix_scanis left untouched.Testing
tests/test_model_retry.py(new): drives the composedDEFAULT_MODEL_RETRYpolicy — statusless → retry, statusless abort → no retry, 400 → no retry, 429/5xx → retry.agents.run_internal.model_retry._evaluate_retry) withDEFAULT_MODEL_RETRY: statusless-before-content →retry=True(delay 2s), attempt 2 → 4s, attempt > max(5) →False, statusless-after-content →False(SDK replay guard), 400 →False. Before/after: with the old policy the statusless quota error returnsretry=False; with this PR it returnsretry=True.ruff,mypy, and the suite pass locally. (Two pre-existing failures intests/test_runner_root_prompt.pyare unrelated — they fail identically onmain, from a test fixture missingsettings.runtime.)Link to Devin session: https://app.devin.ai/sessions/dad023e379e942f287bcf6822463b7a4
Requested by: @0xallam