Skip to content

fix(github): devops gh rate-limit reads only the free /rate_limit endpoint #1441

Description

@dan-petty

Problem

Lines cited at 05e9388 (release/v0.2.29).

devops gh rate-limit (commands/gh.py:1394-1395, also the hidden rate_limit and the MCP tool gh_rate_limit at ai/mcp/server.py:2512) reads GET /rate_limit (:1407). _enrich_rate_limit_resources (:1320-1345, called at :1374) then overwrites its core and graphql entries with:

  • GET /user -i (:1261): one core request, read by a third copy of an x-ratelimit-* header parser (:1259-1281, beside github/rate_limiter.py:583-641);
  • a GraphQL rateLimit query (:1283-1317): at least one point.

The docstring (:1321) calls /rate_limit deprecated. GitHub's documentation says the endpoint "does not count against your REST API rate limit", that its resources include graphql, and that only the top-level rate object is closing down. So every budget check spends from both budgets, including the GraphQL one the roadmap Service runs short of (#1400).

Proposed remedy

Show the resources that /rate_limit returns as they are. Delete _enrich_rate_limit_resources, _extract_rest_rate_limit_headers and _extract_graphql_rate_limit.

Acceptance criteria

  • With a fake gh at the process edge, devops gh rate-limit and devops gh rate-limit --format json each start exactly one gh child, api rate_limit, and print every resource it returned.
  • rg -n "_enrich_rate_limit_resources|_extract_rest_rate_limit_headers|_extract_graphql_rate_limit" src prints nothing.
  • Every new test runs in under 1 s; uv run devops ci passes.

Related: #983, #1118, #1400.

Found by the 2026-10-08 client-library audit.

Opened as a borrow (#1153, budget/borrowed): the agent filing quota is spent for this cycle, and this is a defect or security finding of the owner-requested 2026-10-08 client-library audit.

Activity

  1. added
    type/bug
    scope/github
    source/agent
    on Oct 8, 2026
  2. dan-petty-bot commented on Oct 8, 2026

    @dan-petty-bot
    Collaborator

    Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.

    • Priority: P2-Medium. It wastes a user's rate-limit budget on every invocation and contributes to the GraphQL shortfall noted in #1400, but it is a diagnostic utility rather than a core workflow.
    • Value: Medium. Every call to the command silently burns one core request and one GraphQL point, which matters for users already near their limits.
    • Effort: Low. The fix is to delete three helper functions and let the command print the /rate_limit response as-is, with a small test update.
  3. dan-petty commented on Oct 9, 2026

    @dan-petty
    OwnerAuthor

    Finding: v0.2.29 Service gap assessment (2026-10-09)

    spend_between treats any resetAt difference as an hourly reset and then reports last.used. GitHub returns two GraphQL counters whose resetAt differs by about 1 s, so 3 of 21 spend lines in the v0.2.29 pod said "since the hourly reset" when none happened, under-reporting the round. Proposed: count a reset only when last.reset_at is later than first.reset_at by more than the clock-skew bound, and report a drop in used within one window as unreadable instead of as a spend.

  4. added a commit that references this issue on Oct 26, 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

    scope/githubsource/agenttype/bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions