Skip to content

fix(github): devops gh api rate_limit --jq fails with Invalid rate_limit payload format #1886

Closed

Description

@dan-petty

The command devops gh api rate_limit --jq '.resources.graphql.remaining' fails. It prints "Invalid rate_limit payload format from GitHub API". A script cannot read one number from the rate limit. The GitHub request budget work needs that number.

Evidence: I reproduced the failure four times on 2026-10-22. The function _extract_rate_limit_endpoint_response in src/devops_cli/github/rate_limiter.py (about lines 1590 to 1610) parses the output that comes after the --jq filter as the whole payload. A filtered number is not a dictionary, so the parse fails.

Remedy: refresh the quota from the unfiltered answer, or skip the refresh when --jq is set. Write a test with a --jq filter over the GitHub session fake.

Existing tool considered: none applies. This is a defect in project code. The GitHub request budget investigation may replace this limiter. Until then the defect blocks scripts.

Acceptance criteria:

  • devops gh api rate_limit --jq '.resources.graphql.remaining' prints the number.
  • A test covers the --jq case and fails on the base.

Proposed design

Problem statement

The command devops gh api rate_limit --jq '.resources.graphql.remaining' fails with 'Invalid rate_limit payload format from GitHub API' because the rate limiter tries to parse the output of a filtered jq query as a full JSON payload, but a filtered number is not a dictionary.

Acceptance criteria

  • Criterion 1: devops gh api rate_limit --jq '.resources.graphql.remaining' prints the number.
    Verification: Run the command and verify it outputs a single integer value representing the remaining GraphQL requests.
  • Criterion 2: A test covers the --jq case and fails on the base.
    Verification: Write a unit test that mocks the GitHub session with a --jq filter and verifies the current behavior fails, then verify it passes after implementing the fix.

Key questions

  • What is the exact location in the code where the parsing of rate limit response fails?: The function _extract_rate_limit_endpoint_response in src/devops_cli/github/rate_limiter.py (around lines 1590 to 1610) parses the output that comes after the --jq filter as the whole payload. When --jq is used, the result is a filtered number which is not a dictionary, so the parse fails. [sources: src/devops_cli/github/rate_limiter.py:1589]
  • What is the remedy suggested in the issue description?: Refresh the quota from the unfiltered answer, or skip the refresh when --jq is set. Write a test with a --jq filter over the GitHub session fake. (proposed)

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/bug
    on Oct 22, 2026
  2. dan-petty commented on Oct 22, 2026

    @dan-petty
    OwnerAuthor

    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.

    • Type: type/bug. The candidate describes a defect in project code that causes a command to fail.
    • Priority: P1-High. The defect blocks scripts that need to read GitHub request budget information. The failed run 1867 does not set P0: it does not appear in the candidate's text. A person can set P0 on the board.
    • Value: High. Fixing this allows scripts to correctly read rate limit information from the GitHub API.
    • Effort: Medium. Requires modifying the rate limiter logic and adding a test with a GitHub session fake.
  3. dan-petty commented on Oct 22, 2026

    @dan-petty
    OwnerAuthor

    Status set to Ready at ae8c2d9 (see proposed design in issue body).

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

    source/agenttype/bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions