Repository navigation
Description
What's wrong
The rate-limit wait depends on the displayed status, not on the rate-limit state itself:
BuildProvider.GetRateLimitWaitTime()(BuildMonitor/BuildProvider.cs~L336) only honoursRateLimitResetTimewhenStatus == ProviderStatus.RateLimited.SetStatus()(~L489) overwritesStatuswith anything, and leavesRateLimitResetTimealone.ClearStatus()(~L501) resetsRateLimitSleeponly ifStatusis stillRateLimitedwhen the next success arrives.IsRateLimitedWithPendingReset()(~L402) has the sameStatus ==gate. It is unused today, but the fix proposed in While GitHub is rate-limited, Azure DevOps (and everything else) stops updating for up to an hour: the shared update loop sleeps out GitHub's reset inside each request #384 relies on it, so that fix would inherit this bug.
Several paths replace RateLimited with a different status while a rate limit is still in force:
Providers/GitHub.cs:798: a 403 that is not a rate limit becomesError.Providers/GitHub.cs:815: anHttpRequestExceptionbecomesError.Providers/GitHub.cs:839: an authentication failure becomesAuthFailed.Providers/AzureDevOps.cs: project-not-found and VSS/HTTP errors becomeError.
How it fails
GitHub, secondary rate limit
- The token is a fine-grained PAT without Actions read on a few repos. Those calls return 403 "Resource not accessible", which
IsRateLimitResponsecorrectly treats as not a rate limit, soSetStatus(Error)runs on every poll of them. - GitHub then imposes a secondary rate limit: 403 with
Retry-After: 60.OnRateLimitExceededsetsRateLimitedwith a reset 60 s away. - The next concurrent poll of one of the step-1 repos sets
Status = Error. GetRateLimitWaitTime()(called before each request atGitHub.cs:749) now skips the reset and falls back toCalculateAdaptivePacing(). That uses the budget from the last successful response, which is still large during a secondary limit, so the delay comes out at well under a second.- Requests go straight back out during the secondary limit, the status flips between Rate limited and Error, and GitHub's docs warn that continuing to send requests in this state can get the integration banned.
A single network blip during the window has the same effect. During a primary limit, if the last success left any budget, the wait drops to the 30 s pacing clamp instead of lasting until the reset.
Azure DevOps. A 429 calls OnRateLimitExceeded() with no reset time, which raises RateLimitSleep. If an owner names a missing project, Error is set again on every discovery pass. The next success's ClearStatus() then sees Error, not RateLimited, and never resets RateLimitSleep. The extra backoff stays on every later ADO request for the rest of the session.
Suggested fix
- Keep the rate-limit state separate from the displayed status. In
GetRateLimitWaitTime()andIsRateLimitedWithPendingReset(), gate onRateLimitResetTime > UtcNowalone. - Clear
RateLimitResetTimeonly once it has passed or on a successful response.SetStatus(Error/AuthFailed, …)should not end the wait. - In
ClearStatus(), resetRateLimitSleeptoBaseRequestDelayon every success, whatever the previous status was.
Acceptance criteria
- A test that rate-limits a provider with a future reset, calls
SetStatus(ProviderStatus.Error, …), and asserts thatGetRateLimitWaitTime()still waits until the reset. - A test that raises
RateLimitSleepwith a reset-less rate limit, setsError, callsClearStatus(), and asserts thatRateLimitSleep == BaseRequestDelay.
Related, but a different root cause: #384 (the shared loop sleeps out the reset), #385 (Retry-After), #333 (budget never re-read).
Activity
matt-edmondson commentedon Oct 31, 2026
Triage
Error/AuthFailedstatus cuts the wait short. Requests then resume almost immediately, and GitHub warns that this can get an integration banned. On Azure DevOps,RateLimitSleepcan stay raised for the rest of the session.BuildProvider(GetRateLimitWaitTime,SetStatus,ClearStatus,IsRateLimitedWithPendingReset). The fix is to gate the wait onRateLimitResetTimealone, separately from the displayed status.IsRateLimitedWithPendingReset(), so land this one first or together with it.Generated by Claude Code