feat: honor Retry-After header on any retryable HTTP response#313
Open
didiergarcia wants to merge 3 commits into
Open
feat: honor Retry-After header on any retryable HTTP response#313didiergarcia wants to merge 3 commits into
didiergarcia wants to merge 3 commits into
Conversation
Route any retryable status code with a Retry-After header into the existing rate-limit pipeline-pause path, identical to 429 behavior. Codes without Retry-After continue to use exponential backoff.
…dDeleteBatch Add before/after pipeline state comparison in EventPipeline to log when a Retry-After header causes a new pipeline pause. Log fires for all codes including 429. Fix shouldDeleteBatch() to return false when rateLimitConfig is enabled, preventing batch file deletion when the rate-limit path handles the retry.
| @@ -189,8 +197,11 @@ class RetryStateMachine( | |||
| // 429 with rate limit handling disabled: delete | |||
| if (statusCode == 429) return !config.rateLimitConfig.enabled | |||
Contributor
There was a problem hiding this comment.
Maybe redundant with the new code below? 429 probably just not a unique case anywhere now.
MichaelGHSeg
approved these changes
Jun 23, 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.
Summary
Retry-Afterheader now triggers a pipeline-level pause, identical to 429 behaviorRetry-Aftercontinue to use existing exponential backoff unchangedRetry-Aftertriggers a new pipeline pause (any code including 429)shouldDeleteBatch()bug: retryable batches were incorrectly deleted whenrateLimitConfig.enabled=true, backoffConfig.enabled=falseMotivation
Per RFC 9110,
Retry-Afteris a general-purpose header. Previously the SDK only respected it for 429; a 529 (or 503) withRetry-Afterwould be silently ignored and the SDK would compute its own (potentially shorter) backoff, increasing load on an already-overloaded server.Test plan
RetryAfterGenericTest— all 13 new tests passRetry-After: 5, observe pipeline pause in logs