Skip to content

fix(service): the request budget counts only requests GitHub counts #3939

Closed

Description

@dan-petty

Problem

The Service (roadmap-service) stays at its own budget of 2000 GitHub requests per hour all day. Measured on 2026-11-07 with Prometheus:

  • increase(devops_cli_github_requests_total{job="roadmap-service"}[1h]) is 2020. In the last 12 hours it was 1800 to 1970 in each hour.
  • 881 of these (44%) have status 304. By status: 200 = 887, 304 = 880, none = 264.
  • The Service log has this warning 66 times in 24 hours: "The Service sent 2000 GitHub requests in the last hour, and its budget is 2000: no round starts until the window has room."
  • Rounds (refine, stage, alternatives, implement) start late or not at all, so the pipeline starves.

GitHub documents that a conditional request that gets a 304 answer does not count against the primary rate limit (docs.github.com, "Best practices for using the REST API", "Use conditional requests"). The budget protects the primary rate limit of the App installation (minimum 5,000 per hour, "Rate limits for the REST API"). RequestBudget.admit (src/devops_cli/server/service.py) counts a request before it is sent, so it counts each 304 answer.

Expected

The budget counts the requests that GitHub counts. A request that gets a 304 answer leaves the budget. A request with no answer still counts: GitHub may have received it, and a gh command has no status. The metric devops_cli_github_requests_total stays as it is: it counts every request, with a status label.

Acceptance criteria

  • A test shows that a request which gets a 304 answer is not in the budget after the answer, and that a 200 answer and a request with no answer stay in it.
  • The cost of a round, which sets the poll cadence, does not include the 304 answers.
  • docs/TELEMETRY.md says what the budget counts.

Existing tool considered

The GitHub conditional request (#3497) already exists. This change only reads its status at the budget. No library is needed.

Related

Related: #3672 (an idle repository polls less often), #3497, #2547.

Activity

  1. added
    source/agent
    type/bug
    scope/service
    status/new
    value/high
    effort/low
    on Nov 7, 2026
  2. dan-petty commented on Nov 7, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

  3. added
    priority/p1-high
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 7, 2026
  4. removed
    status/in-review
    owner/agent
    on Nov 7, 2026
  5. devops-cli-service commented on Nov 7, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-07 12:09 UTC

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

    effort/lowpriority/p1-highscope/servicesource/agenttype/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions