Skip to content

Start Passes from GitHub events instead of polling on every cron tick #2263

Open

Description

@JacobStephens2

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

  1. App webhook wakes Passes. One receiver verifies the signature and starts the matching Pass for that repository (issues.labeled with ready-for-agent → Pickup, pull_request events → Review or Fix, check_suite.completed → the CI watch). Cron stays as a slow fallback, for example hourly.
  2. Conditional requests, with no receiver. GitHub's REST documentation says a request with If-None-Match that returns 304 Not Modified does 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.
  3. 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 pickup from one?

Related

Activity

  1. added
    enhancement
    ready-for-human
    on Nov 17, 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

    enhancementready-for-human

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions