fix: use relative delay for Retry-After header on 429#421
Open
apoorvdarshan wants to merge 1 commit intoopenclaw:mainfrom
Open
fix: use relative delay for Retry-After header on 429#421apoorvdarshan wants to merge 1 commit intoopenclaw:mainfrom
apoorvdarshan wants to merge 1 commit intoopenclaw:mainfrom
Conversation
Retry-After was set to an absolute Unix epoch timestamp (e.g. 1771404540), which violates RFC 9110 §10.2.3. Clients treating it as delay-seconds would wait ~56 years. Now emits the actual seconds until reset. Closes openclaw#407
Contributor
|
@apoorvdarshan is attempting to deploy a commit to the Amantus Machina Team on Vercel. A member of the Team first needs to authorize it. |
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 on 429 responses to emit a relative delay in seconds (per RFC 9110 §10.2.3) instead of an absolute Unix epoch timestampRetry-Afterwas set to e.g.1771404540(epoch seconds), causing clients that treat it as delay-seconds to wait ~56 yearsX-RateLimit-Resetremains as epoch seconds (standard convention for that header)Retry-Afteris a small relative valueCloses #407
Test plan
vitest run convex/httpApiV1.handlers.test.ts— 40/40)"429 Retry-After is a relative delay, not an absolute epoch"verifies the header value is between 1–120 secondsGreptile Summary
Fixes the
Retry-Afterheader on 429 responses to emit a relative delay in seconds (per RFC 9110 §10.2.3) instead of the rawresetAtepoch timestamp. Previously, clients treating the value as delay-seconds would wait ~56 years. The fix computes the delta between the rate-limit reset time and the current time, with aMath.max(1, ...)floor.X-RateLimit-Resetcorrectly continues to use epoch seconds. A regression test verifies the header value falls within 1–120 seconds.Confidence Score: 5/5
resetAtis an epoch-ms value from the rate limiter, divided by 1000 to get epoch-seconds, then subtracted from the current epoch-seconds. TheMath.max(1, ...)guard handles edge cases where the reset window has already passed. The regression test appropriately validates the fix using the existing mock infrastructure.Last reviewed commit: 6c87964
(2/5) Greptile learns from your feedback when you react with thumbs up/down!
Context used:
dashboard- AGENTS.md (source)