Skip to content

Record a Quota wait per machine, GitHub user and resource, shared with the Inbox #1995

Closed

Description

@JacobStephens2

Parent

#1994

What to build

The per-machine Quota wait record and the module every GitHub caller uses to read it, with the Inbox moved onto it. After this Ticket, nothing about Passes or running Commands changes yet, but the machine has one view of GitHub's quota.

  • One record per machine, keyed by GitHub host, authenticated user login and resource (REST core, GraphQL), holding the reset time and last observed remaining count. No token or secret stored. Atomic writes; entries whose reset has passed are ignored.
  • Ways to learn a Quota wait: from a thirdshift GitHub call failing with primary-quota diagnostics (then reading gh api rate_limit for the reset time, or assuming 15 minutes ahead when none can be read), and from a quota check that finds a resource below the fixed reserve of 500.
  • The wait calculation the later Tickets use: reset + 1 minute + a random 0–60 seconds, and a per-Command running total checked against a 2-hour cap. The clock and random source can be injected for tests.
  • The Inbox's existing quota pause reads and writes this record instead of its own, with no visible change in Inbox behaviour.
  • GLOSSARY.md gains Quota wait: the time until GitHub's quota for a GitHub user resets, during which Passes are skipped and running Commands wait instead of failing. Define it without implementation detail.

Acceptance criteria

  • A primary-quota failure from thirdshift's GitHub adapter records a Quota wait for the right host, user and resource, with the reset time from gh api rate_limit.
  • With no readable reset time, the Quota wait ends 15 minutes ahead.
  • Different GitHub users, GitHub hosts and resources never share a Quota wait.
  • An entry whose reset has passed does not count as a Quota wait.
  • Concurrent writers on one machine cannot corrupt the record.
  • The wait calculation returns reset + 1 minute + 0–60 seconds, and reports when a Command's total would pass 2 hours; unit tests use an injected clock and random source.
  • The Inbox's existing quota tests pass on the shared record, and the Inbox behaves as before.
  • GLOSSARY.md defines Quota wait.
  • scripts/affected-tests main passes.
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

    enhancementNew feature or requestready-for-agentFully specified, ready for an AFK agent

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions