Skip to content

A Command waiting on GitHub asks every 10 seconds and reads the PR twice per CI poll #2138

Closed

Description

@JacobStephens2

This was generated by AI during triage.

Problem

While a Command waits on GitHub (CI on a pushed head, a PR's mergeable state, a child Run), it asks GitHub again every 10 seconds for as long as the wait lasts. In CI watching, each poll makes about three reads or more:

  • it observes the PR twice to confirm it is still actionable, once before and once after reading checks;
  • it reads the head commit's check runs;
  • it sometimes also checks whether the head moved.

From the code, one Command watching CI therefore spends roughly 1,000–1,800 GitHub requests an hour. All Fleet machines authenticate as one GitHub user and share its 5,000/hr core quota. Two or three Commands watching thirdshift's long CI at once can use most of it. That matches the fleet's quota drops on 2026-11-12, which came while Pickup and Fix runs had PRs in CI. The 10-second interval is a fixed default in the poll module, overridable only by an environment variable kept for tests.

Related: #1992 (idle Passes' reads), #1993 (raising the ceiling with a GitHub App), #1998 (estimating scheduled-Pass load). This issue covers the running Command's waits, which none of them do.

Agent Brief

Category: enhancement
Summary: Make a Command's GitHub waits back off and stop duplicating reads, so one CI wait costs a small fraction of today's requests.

Current behavior:
Every poll-module wait (CI watching, waiting for a PR's mergeable state, waiting on a child Run) pauses a fixed 10 seconds between asks. During CI watching, each poll observes the PR before and after reading check runs. The existing check-read retry delay is separate from this pause.

Desired behavior:

  • The pause between asks grows the longer a wait goes unchanged. Start at the current 10 seconds, so a fast check or a mergeable state is still noticed quickly, then lengthen to at most 60 seconds. Suggested steps: 10s for the first 2 minutes, 30s up to 10 minutes, then 60s. Any observed change (a check changes state, the head moves, a new check appears) resets the pause to its shortest step.
  • One CI-watch poll observes the PR at most once. Actionability (the PR is still open, not superseded or taken) is still confirmed before any write or action that depends on it, such as a Check re-run.
  • How quickly a Command reacts to an interruption, a stop or a Quota wait is unchanged. A longer pause stays interruptible, as it is today.
  • The interval used by binary tests can still be shortened through the existing environment override, so the test suite does not slow down.

Key interfaces:

  • The poll module's pause() and its interval: today it is fixed; it becomes a schedule driven by how long the caller's wait has gone unchanged. The CI watcher's Outside::pause and the other poll::pause callers pass or keep that state.
  • The CI watcher's Outside::checks_on, which today runs the actionable check on both sides of the check-runs read.

Acceptance criteria:

  • A binary test with the fake gh shows CI staying pending for a simulated 30 minutes, makes at most about 40 polls, and still reports the result.
  • A test shows a check changing state mid-wait resets the pause to its shortest step.
  • A test shows a single CI-watch poll making one PR observation, not two.
  • Existing tests for interruption during a CI wait, a head moving mid-wait, Check re-runs and mergeable waits pass unchanged.
  • docs/guide.md (and the regenerated user manual) say how often a waiting Command asks GitHub, if they describe it today.

Out of scope:

Activity

  1. added
    enhancement
    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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions