Skip to content

A Quota wait recorded after the quota reset stops the whole fleet for an hour with a full quota #2128

Closed

Description

@JacobStephens2

This was generated by AI during triage.

What happened

On 2026-11-12, every host in the fleet (all on v0.30.0) stopped work for about an hour while GitHub had almost all of its quota left.

dev's ~/.thirdshift/github-quota.json held one wait: {resource: graphql, remaining: 4995, reset_at: 2026-11-12T16:46:42Z}. Live gh api rate_limit at the same time showed graphql 4973 remaining.

Cause (as of origin/main 5e573fe)

GitHub::record_quota_failure (src/github/quota.rs) runs after a request fails on a rate limit. It probes rate_limit, builds a Quota from whatever the probe returns, and calls Store::exhausted, which records it with waiting = true unconditionally (src/github/quota/store.rs). If the window has reset between the failed request and the probe, the probe returns a full quota and the next reset time. thirdshift then records "exhausted until the next reset" with 4995 left, and returns that reset to the caller.

Two places then trust it:

  • Pass admission: GitHub::pass_quota_wait returns a known wait from the store without probing, so nothing clears the wrong wait until its reset_at passes. Store::observe would clear it, since Quota::low is false at 4995, but admission never reaches the probe while a wait is stored.
  • Running Commands: the reset returned by record_quota_failure goes to quota::command::wait, which sleeps until it, so a Command waits a full window with a full quota.

Agent Brief

Category: bug
Summary: A Quota wait is recorded only when the quota really is low; a probe showing the reserve available never starts or extends a wait.

Current behavior:
After a rate-limited request, thirdshift records a Quota wait until the probed reset time even when the probe shows the quota already reset. Every Pass on the machine skips, and the failing Command sleeps, for up to an hour with a full quota.

Desired behavior:

  • After a rate-limited request, thirdshift records a Quota wait only if the probed quota is low (below the reserve, with its reset in the future), or if the probe failed and it must assume exhaustion (today's 15-minute fallback stays).
  • If the probe shows the reserve available, any stored wait for that account and resource is cleared, as an ordinary observation would. The failed request is retried promptly instead of sleeping to the next reset.
  • A stored wait whose recorded remaining is at or above the reserve is not treated as a wait by Pass admission or the Inbox.
  • The Inbox warning and Console text keep reporting real waits as today.

Key interfaces:

  • GitHub::record_quota_failure and GitHub::pass_quota_wait (src/github/quota.rs)
  • Store::exhausted / Store::observe / Store::waiting (src/github/quota/store.rs)
  • quota::command::wait (src/github/quota/command.rs)
  • GLOSSARY.md: Quota wait

Acceptance criteria:

  • A rate-limited request whose probe reports remaining ≥ 500 records no wait, and the Command retries without sleeping to the reset.
  • A rate-limited request whose probe reports remaining < 500 with a future reset records a wait and the Command sleeps until it (unchanged).
  • A failed probe still records the fallback wait (unchanged).
  • A store holding a wait with remaining ≥ 500 does not make Pass admission skip.
  • Existing quota tests pass.

Out of scope:

Related: #1994, #1996, #1997 (the Quota wait Spec and its Tickets).

Activity

  1. added
    bug
    ready-for-agent
    in-progress
    and removed
    ready-for-agent
    on Nov 12, 2026
  2. removed
    in-progress
    on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions