Keep track of every session
See which agents have finished, which are still working and which need an answer from you, across all your projects.
Clients can send about twice the limit if they time it around a window boundary. Find out why and fix it.
Thought process · ran 1 command · read 2 filesFound it. estimate() weights the previous window by Math.floor(1 - into), and that is 0 the moment a new window starts. One millisecond after the boundary the last window's requests stop counting, so a client that fills a window right before it ends can fill the next one right after.
Fixed in src/window.ts: the previous window now counts for the share of it that still overlaps, so the limit holds across a boundary.
test/window.test.ts fills a window in its last 10 ms, then checks that only one more request gets through after it rolls
This matches the October incident: a client at the limit got about twice its rate for as long as it kept landing on the boundary. Nothing is committed yet.
Ask anything, @ to mention… Full access studio api main Opus 5.5 High Changes Working tree main 2 files in 2 folders +12 −1 Filter files src 1 M window.ts +3 −1 @@ -20,7 +20,9 @@ export class SlidingWindow { 20 estimate(now = Date.now()): number { 21 this.roll(now); 22 const into = (now - this.start) / this.windowMs; 23 - return this.current + this.previous * Math.floor(1 - in 23 + // The previous window counts for the part of it that s 24 + // last `windowMs`. Rounding that share down dropped it 25 + return this.current + this.previous * (1 - into); 26 } 27 28 /** Counts one request, or refuses it when the window is test 1 M window.test.ts +9 −0 What changed, and why 0/50 Mara Okafor Fix burst at the rate limit boundary