Repository navigation
Description
This was generated by AI during triage.
Idea
Let a GitHub event start a Pass, so that scheduled Passes no longer have to ask GitHub every few minutes whether there is work. Today a Ready issue is found by a cron line that runs thirdshift pickup and reads GitHub each time, whether or not anything changed. The same holds for Review, Fix and Triage Passes. With several machines signed in as one account, those idle reads use up the shared 5,000 requests an hour (#739, #1992).
The idea comes from sf-kit, another factory built on Matt Pocock's workflow. Its factory host takes GitHub webhooks for label and comment events and starts a run from each. It keeps schedules only for periodic work (rebase, lint ratchet, architecture review).
Why this needs a person
Webhooks were rejected twice, and both decisions would have to be revisited:
- ADR 0009: "a webhook needs a server GitHub can reach", and thirdshift has no daemon.
- ADR 0023: each repository would need a webhook with a shared secret, the Console would need a route open to anyone, and deliveries missed during a restart would still need a poll.
Two things have changed since those were written:
- The fleet has a GitHub App (Authenticate the fleet as a GitHub App to raise its API quota #1993, created with webhooks off). An App has one webhook URL for every repository it is installed on, which removes the per-repository setup that ADR 0023 counted against the idea.
- The Console is now a long-running server on each host, so a receiver would not be the first one.
The other objections still hold. A receiver is a route open to the internet, which is a trust boundary. Not every host can be reached from GitHub. Missed deliveries still need a slower poll behind them.
Options to weigh
- App webhook wakes Passes. One receiver verifies the signature and starts the matching Pass for that repository (
issues.labeledwithready-for-agent→ Pickup,pull_requestevents → Review or Fix,check_suite.completed→ the CI watch). Cron stays as a slow fallback, for example hourly. - Conditional requests, with no receiver. GitHub's REST documentation says a request with
If-None-Matchthat returns304 Not Modifieddoes not count against the primary rate limit. A Pass could keep the ETag of its first listing and exit on a 304 before making any other read. This keeps ADR 0009 intact and needs no public route, but each host still makes one request per Pass start. Verify the 304 behaviour for the endpoints and token kind in use before relying on it. - Both. Option 2 makes the fallback poll nearly free, and option 1 removes the wait for the next cron tick.
Questions to settle
- How many requests does an idle Pass of each kind make? Measure and cut the GitHub reads idle Passes make #1992 asks for this measurement and it decides how much either option saves.
- Does the saving matter once the fleet is on the App's own quota (Authenticate the fleet as a GitHub App to raise its API quota #1993)?
- Where would a receiver run, and how does an event reach a host that GitHub cannot reach? Which host acts when several run Passes for the same repository?
- What does the receiver accept? An event carries text written by anyone who can open an issue, so it should only say "look at this repository now" and leave every decision to the Pass's own reads and Trusted-account checks.
- Does thirdshift ship the receiver, or does it only document how to call
thirdshift pickupfrom one?
Related
- Measure and cut the GitHub reads idle Passes make #1992: measure and cut the GitHub reads idle Passes make. This issue is one candidate reduction for it.
- Authenticate the fleet as a GitHub App to raise its API quota #1993: authenticate the fleet as a GitHub App.
- Defer scheduled passes during GitHub quota exhaustion and reduce idle polling #739 and Spec Spec: wait out GitHub quota exhaustion instead of failing (Quota wait) #1994: the Quota wait.
- A Command waiting on GitHub asks every 10 seconds and reads the PR twice per CI poll #2138: the CI watch's polling interval.
Activity