Skip to content

fix(github): count each page of a paginated GitHub read #4737

Closed

Description

@dan-petty

Problem or Motivation

A gh command counts as one request with status 'none' (src/devops_cli/github/rate_limiter.py:1744-1746), and _calculate_effective_cost gives 1 or 2 and ignores --paginate (rate_limiter.py:1814-1820). A 'gh api ... --paginate' read of 400 open items reads 4 pages and counts 1. Status 'none' is 7,744 Service and 27,163 workstation attempts in 24 h, so the GitHub request panels undercount by a share that nobody can measure: no series holds the count that GitHub reports (X-RateLimit-Used). src holds 9 --paginate uses in 6 files.

Proposed Solution & Architectural Design

Move the paginated reads from gh subprocesses to the GitHub session transport (src/devops_cli/github/session_transport.py), which counts each HTTP attempt with its status and sends conditional requests (#3497). Leave the metrics row reads to #3941, which moves them and removes the second open-issue listing. Where a gh call must stay, say why in the pull request. The GitHub count of each resource comes from the rate-limit gauges of #4752. Leave the page count of the scoped intake read to #3670. #4626 changes the read timeout of the same session transport; build after it merges.

Target Subsystem

SDLC, Git & PR Governance (GitHub client and its telemetry).

Existing Tool Considered

The GitHub session transport of this repository (#3497) already counts each HTTP attempt. No new tool.

Acceptance Criteria

  • A test: a paginated read of 4 pages through the GitHub fake adds 4 to devops_cli_github_requests_total.
  • 'git grep -- --paginate src' returns only the callers that the pull request lists with a reason.
  • After feat(github): record the rate limit of each response as gauges #4752 is live: for one hour of the Service, the counted core requests with status other than 304 are within 10 % of the last value of devops_cli_github_rate_limit_used for core before the GitHub window reset.

Files

  • src/devops_cli/github/session_transport.py
  • src/devops_cli/github/rate_limiter.py
  • src/devops_cli/github/client.py
  • src/devops_cli/commands/gh.py
  • src/devops_cli/github/request_classifier.py
  • tests/github/test_github_rate_limiter.py

Dependencies

#4626.

Related

#3941 (the metrics row reads), #3670 (scoped intake pages).

Source: #4675

Activity

  1. added
    source/agent
    on Nov 11, 2026
  2. added
    type/bug
    scope/github
    status/new
    value/medium
    effort/medium
    on Nov 11, 2026
  3. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

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

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: scope/github. The (github) scope of the title gives the scope.
    • Priority: P2-Medium. The undercount affects observability and rate-limit tracking but does not break functionality.
    • Value: Medium. Accurate per-page counting is needed for reliable rate-limit monitoring and capacity planning.
    • Effort: Medium. Requires moving paginated reads to the session transport, updating the rate limiter, and adding a multi-page test across six files.
    • Related: refactor(github): the github session owns transport, ledger, error classes and link pagination #983, which asks for a different change. Both work on the GitHub session transport and paginated reads, but #983 is the broader refactor that created the session transport while the candidate fixes the per-page counting that transport now performs.
  4. added
    priority/p2-medium
    owner/agent
    status/in-review
    and removed
    status/new
    on Nov 11, 2026
  5. removed
    status/in-review
    owner/agent
    on Nov 12, 2026
  6. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-12 15:46 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/mediumpriority/p2-mediumscope/githubsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions