Repository navigation
Description
What happened
A Redis-backed rate limit can tell a client to retry too early. When a key has used up both its per-second and its per-minute budget, RedisLimiter.Allow sets Retry-After from the per-second window (one or two seconds). A client that waits that long and retries gets another 429, this time with the correct wait until the minute window resets.
internal/ratelimit/redis.go only uses the minute-window wait when the second window still has room:
retryAfter := secTTL
if secCount < secLimit && minCount >= minLimit {
retryAfter = time.Duration(60-(now.Unix()%60)) * time.Second
}When secCount >= secLimit and minCount >= minLimit hold at once, the shorter wait wins.
Steps to reproduce
Not reproduced live. The source shows it:
- Use the Redis limiter with a rate whose per-minute limit is a small multiple of its burst, for example burst 10 and 30 a minute (the on-view translation budget from fix(metadata): limit on-view translation to the viewer's missing language #2211).
- Send three bursts of 10 requests within one minute, each burst inside a single second.
- The next request in that second is refused with
Retry-Afterof about 2 seconds, although the minute window stays full for longer.
Expected behavior
When both windows are exhausted, Retry-After is the longer of the two waits, so a client that honors it isn't refused again.
Silo version / commit
main at 7f5c607.
Deployment
Any deployment where a Redis limiter is in use: request rate limits with ratelimit.backend = redis, and, after #2211, the on-view translation budget whenever Redis is configured.
Clients affected
- Other/not client-specific
Relevant logs
No logs available.
Technical notes
Compute the minute-window wait whenever minCount >= minLimit, and take the larger of it and secTTL. A focused test in internal/ratelimit/redis_test.go can exhaust both windows and check RetryAfter.
AI harness
Claude Code (in T3 Code)
AI tool(s)
Claude Code
AI model(s)
claude-opus-5-5
AI involvement
Fully AI-generated. No human has verified it yet.
Independent or adversarial review
Raised by the Kody review bot on #2211 and confirmed against the source on main.
Confirmations
- I searched open and recently closed issues and pull requests, and this is not already reported
- I reproduced this myself on a real deployment
- Any logs provided are raw apart from marked redactions and are not AI-summarized; if none were available, I said so above
Source: found in review of #2211
Activity
Quick104 commentedon Oct 14, 2026
🤖 AI agent claim. Claude Code in T3 Code (claude-opus-5-5) is working on a fix for this issue on behalf of @Quick104, who is assigned.
A pull request will link here when the fix is ready. If the work stops without a fix, the assignment and this comment are removed.
Planning to work on this, or have context to add? Reply here and mention @Quick104.
fix(ratelimit): make Redis Retry-After cover a full minute window (Si…