Add Retry-After header support for rate-limited responses#423
Open
PopoviciMarian wants to merge 2 commits into
Open
Add Retry-After header support for rate-limited responses#423PopoviciMarian wants to merge 2 commits into
PopoviciMarian wants to merge 2 commits into
Conversation
hansott
reviewed
May 14, 2026
| 1. Sets up rate limiting config to 3 requests / 5 minutes for route '/'. | ||
| 2. Sends 3 requests to '/'. Checks that those requests are not blocked. | ||
| 3. Sends a rate-limited request and captures the Retry-After value. | ||
| 4. Sleeps 60 seconds, sends another rate-limited request, and asserts |
hansott
reviewed
May 19, 2026
| if sw.Total >= dropped { // safety check to avoid negative total | ||
| sw.Total -= dropped | ||
| } | ||
| sw.CreatedAt = sw.CreatedAt.Add(time.Minute) |
hansott
reviewed
May 19, 2026
| } | ||
| elapsed := int32(time.Since(sw.CreatedAt).Seconds()) | ||
| retryAfter := windowSizeInSeconds - elapsed | ||
| if retryAfter < 1 { |
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.
Add Retry-After header support for rate-limited responses
Expose
retryAfterSecondsthrough the full stack (proto → agent → request processor → PHP extension) so rate-limited responses can include a Retry-After header that counts down toward window expiry.retry_after_secondsfield toRateLimitingStatusproto messageSlidingWindow.CreatedAtin the agentretryAfterSecondsthrough the action JSON to the PHP extensionretry_after_secondsonAikidoBlockRequestStatusPHP classSummary by Aikido
🚀 New Features
⚡ Enhancements
🐛 Bugfixes
More info