Repository navigation
fix(provider): honour Retry-After above the backoff cap and retry 529 (RR5) - #118
Merged
Merged
Conversation
… (RR5) Two gaps in the pre-stream retry policy ended real runs that a short wait would have saved. Anthropic answers overloaded_error with HTTP 529, which is not one of http's named statuses and so was never in is_retryable_status: five audited runs "gave up after 8 attempts" on it. And a Retry-After above max_delay was clamped to 8 s, so the retry went out before the server said it would accept one and earned the same rejection again. 529 is retryable. Retry-After is a floor: parsed in delta-seconds and HTTP-date form (httpdate, already in the lock through hyper), never jittered down, and slept in full above the exponential cap up to 60 s. The ledger charges a server-directed wait at the exponential rate, so honouring the server cannot by itself exhaust the 30 s budget that bounds QQ's own guessing. Compatible with #114, which stopped charging attempt wall time. Tests: HTTP-date past and future, 529, the 60 s cap, ledger charging; the Retry-After exchange test no longer relies on max_delay clamping. Both provider profiles green.
This was referenced Sep 22, 2026
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.
RR5 of
docs/plans/run-reliability.md; audit finding R01 (provider half). Based onmain.Behaviour
Two gaps in the pre-stream retry policy ended real runs that a short wait would have saved:
overloaded_errorwith HTTP 529, which is not one ofhttp's named statuses and was never inis_retryable_status: five audited runs "gave up after 8 attempts" on it.Retry-Afterabovemax_delaywas clamped to 8 s, so the retry went out before the server said it would accept one and earned the same rejection again.Now:
Retry-Afteris a floor: parsed in delta-seconds and HTTP-date form (httpdate, already inCargo.lockvia hyper — zero transitive additions), never jittered down, slept in full above the exponential cap up to 60 s (RETRY_AFTER_CAP).Verification
retry_after_parses_delta_seconds_and_http_dates(future → 90 s, past → 0),overloaded_529_is_retryable,delay_before_retry_honors_retry_after_above_max_delay_up_to_the_cap,ledger_charges_a_server_directed_wait_at_the_exponential_rate; theexchange_honors_retry_after_before_successfixture no longer relies onmax_delayclamping.cargo test -p qq-provider(215) and the minimal profile--no-default-features --features test-support(168 + 17) green; workspace clippy-D warningsand fmt clean;qq-core688 green.Docs
providers.md§ retry owner updated; ledger entry; RR1–RR3 marked shipped.