fix(rate_limiter): retry transient non-529 5xx responses - #145
Merged
Conversation
is_retryable_error matched only the enumerated 529 (overloaded), so other transient upstream 5xx — 520/522/523/524 (Cloudflare edge errors that the Anthropic API surfaces under load) — were treated as terminal. A unit hit by a transient 520 that outlasts the SDK's own retries was finalized as ERROR instead of being retried. Treat the transient 5xx range as retryable (520/522/523/524 alongside 529) without making deterministic client 4xx errors retryable. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
gadievron
marked this pull request as ready for review
July 10, 2026 18:17
gadievron
requested review from
dgeyshis,
shahar-davidson and
sounil
as code owners
July 10, 2026 18:17
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.
is_retryable_error matched only the enumerated 529 (overloaded), so other
transient upstream 5xx — 520/522/523/524 (Cloudflare edge errors that the
Anthropic API surfaces under load) — were treated as terminal. A unit hit by a
transient 520 that outlasts the SDK's own retries was finalized as ERROR
instead of being retried.
Treat the transient 5xx range as retryable (520/522/523/524 alongside 529)
without making deterministic client 4xx errors retryable.
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Found by a deep reachability/call-graph validation of the parser corpus: the 2026 release fixed this bug class at some parser sites but left this sibling. Ships with a RED->GREEN regression test driving the real parser/detector pipeline (not a mock). One of a 9-PR series of independent, region-disjoint fixes; verified together (full suite green, no collisions).
🤖 Generated with Claude Code