Execute a function with rate limiting and exponential backoff.
The retry loop fires when:
canMakeRequest() returns false) — fn
was never called.RateLimitError (typically a server 429) AND
retryServer429 is enabled. Retrying server 429s on non-idempotent
requests (POST startRun, POST startRun) can produce duplicate
resources — set retryServer429: false to disable.The function to execute under rate limiting.
The function's resolved value.
Snapshot of the current rate-limiter state.
requestsInWindow, remainingRequests, canMakeRequest,
resetTime (epoch ms when the oldest tracked request leaves the
window — null when no requests are tracked).
Discard all tracked request timestamps. Useful in tests or after a clock jump. Not normally called in production.
Token-bucket-ish rate limiter with exponential backoff.
Used internally by
BugBugApiClient. Integrators rarely instantiate this directly; instead pass RateLimitConfig viaBugBugConfig.rateLimit.