You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(github): run_gh paces gh pr checks, gh pr list and gh issue list as core REST though gh sends them as GraphQL #1415
scope/githubGitHub Projects v2, Views, Milestones, Labels, and PR automationsource/agentFiled by an agenttype/bugType bug: the code does not do what it must
_detect_resource (src/devops_cli/github/rate_limiter.py:475-494) counts a command as GraphQL only for project or when an argument contains graphql (_is_graphql_command, :450-452). On the release/v0.2.29 tip (05e9388), gh_request_resource (:497) returns core for pr checks, pr list and issue list (checked 2026-10-08). gh runs those porcelain commands over GraphQL: pr checks resolves the pull request and reads statusCheckRollup with GraphQL queries. So run_gh paces and reserves them against the core budget, never the GraphQL one, and every dry-run plan labels them 'REST read'.
devops pr checks, for example, calls fetch_pr_check_verdicts (src/devops_cli/github/check_verdict.py:450) for the pull request it checks (src/devops_cli/commands/pr.py:385-386). The Service's main failure today is the GraphQL budget (#1400), and these calls go uncounted there.
Proposed remedy
Class gh's GraphQL-backed porcelain commands as graphql in one constants-module table, which run_gh's pacing and planned_gh (src/devops_cli/roadmap/request_plan.py:68) both read. Alternatively, replace the porcelain calls on the roadmap paths with the REST endpoints they stand for, such as repos/{repo}/commits/{sha}/check-runs, which fetch_pr_check_verdicts already falls back to.
Acceptance criteria
gh_request_resource(['pr', 'checks', '1']) returns graphql, or fetch_pr_check_verdicts reads check runs over REST. The label in the dry-run plan of planned_gh matches.
Amendment from the 2026-10-08 client-library audit (checked offline with gh_request_resource at 05e9388):
False positives as well as the false negatives above._is_graphql_command (github/rate_limiter.py:450-452) and _is_general_search_command (:470-472) look for substrings in every argument, titles, bodies and paths included:
issue create --title "Fix GraphQL quota" --body x gives graphql;
api -X POST repos/o/r/issues/1/comments -f "body=see search/issues for details" gives search;
api repos/o/r/contents/docs/graphql.md gives graphql.
So an issue or comment that mentions GraphQL is paced and planned against the GraphQL budget. Since fix(roadmap): a GraphQL budget refusal pauses every Service worker until the reset, and each Service round ends with its spend line #1400, the roadmap store also sends a closing budget read and logs a spend line for a round whose only "GraphQL" call was such a REST write. The table this item proposes should key on the command words (gh_command_words) and, for gh api, on the parsed endpoint (parse_gh_api_args(...).endpoint), never on argument text.
More porcelain classed core today that gh may send as GraphQL. Confirm each with GH_DEBUG=api:
release list (github/release_notes.py:62-63);
label list (commands/gh.py:154, github/client.py:329);
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. The misclassification contributes to the project's main operational failure (GraphQL budget exhaustion per #1400) by leaving these calls uncounted against the GraphQL budget, but a REST fallback exists and it is one contributor among severa
Value: Medium. Accurate budget classification prevents premature GraphQL exhaustion and corrects misleading dry-run labels, directly improving reliability of the closure and roadmap workflows.
Effort: Low. The fix is adding a few command names to a constants table that both run_gh pacing and planned_gh already read, or swapping two porcelain calls for REST endpoints that already exist as fallbacks.
Amendment (2026-10-18): the same function also misclasses REST paths by substring
_is_graphql_command, _is_code_search_command, _is_code_scanning_autofix_command and _is_general_search_command (src/devops_cli/github/rate_limiter.py:457-479 at release/v0.2.37 30b8fdd) test whether any argument containsgraphql, search/code, code-scanning and autofix, or search/. A REST path that merely contains those letters is paced against the wrong budget. Checked with gh_request_resource at 30b8fdd:
Call
Resource returned
Should be
api repos/graphql/graphql-js/issues
graphql
core
api repos/octo/research/issues
search (30 a minute)
core
api repos/octo/app/contents/docs/search/index.md
search
core
api graphql -f query=x
graphql
graphql
A repository named research, or any file under a search/ directory, is throttled to the search budget's 30 requests a minute. The GitHub session from #983 (PR 1) reuses this function through gh_request_resource to pace its REST requests, so the defect now reaches both transports.
AGENTS.md forbids matching against a subset of possible values. The remedy belongs with this item's table: classify by the parsed request, not by substrings. For gh api, the endpoint is the first positional argument after api; it is graphql exactly, or a REST path whose resource follows from its leading segments (search/code, search/..., repos/{owner}/{repo}/code-scanning/.../autofix, .../dependency-graph/sbom), which GitHub's REST reference defines. For porcelain commands, use the table this item already proposes.
Extra acceptance criteria for this item:
gh_request_resource returns core for api repos/graphql/graphql-js/issues, api repos/octo/research/issues and api repos/octo/app/contents/docs/search/index.md, and the existing classes stay as they are for api graphql, api search/issues, api search/code, search issues x and search code x.
No in arg substring test remains in the resource predicates.
Amendment (2026-10-18): gh pr view and gh pr edit too
#1345 PR 1's review found two more gh porcelain commands that run_gh paces against the wrong budget. gh_request_resource returns core for gh pr view <branch> --json number ..., and planned_gh renders it as "REST read" (gh pr edit as "REST write"). gh 2.102.0 resolves pr view <branch> with a GraphQL query, and requests reviewers with the requestReviewsByLogin mutation. So client-side pacing and dry-run labels draw on the core quota while GitHub charges GraphQL. Add both to this item's table of GraphQL-backed porcelain commands.
scope/githubGitHub Projects v2, Views, Milestones, Labels, and PR automationsource/agentFiled by an agenttype/bugType bug: the code does not do what it must
Activity
dan-petty commentedon Oct 8, 2026
Amendment from the 2026-10-08 client-library audit (checked offline with
gh_request_resourceat 05e9388):False positives as well as the false negatives above.
_is_graphql_command(github/rate_limiter.py:450-452) and_is_general_search_command(:470-472) look for substrings in every argument, titles, bodies and paths included:issue create --title "Fix GraphQL quota" --body xgivesgraphql;api -X POST repos/o/r/issues/1/comments -f "body=see search/issues for details"givessearch;api repos/o/r/contents/docs/graphql.mdgivesgraphql.So an issue or comment that mentions GraphQL is paced and planned against the GraphQL budget. Since fix(roadmap): a GraphQL budget refusal pauses every Service worker until the reset, and each Service round ends with its spend line #1400, the roadmap store also sends a closing budget read and logs a spend line for a round whose only "GraphQL" call was such a REST write. The table this item proposes should key on the command words (
gh_command_words) and, forgh api, on the parsed endpoint (parse_gh_api_args(...).endpoint), never on argument text.More porcelain classed
coretoday that gh may send as GraphQL. Confirm each withGH_DEBUG=api:release list(github/release_notes.py:62-63);label list(commands/gh.py:154,github/client.py:329);issue create(github/issues.py:206);pr view(commands/pr.py:374,github/check_verdict.py:428);pr edit(commands/pr.py:776),pr ready(:1093) andpr close(:1166).Found by the 2026-10-08 client-library audit.
dan-petty-bot commentedon Oct 8, 2026
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.
The misclassification contributes to the project's main operational failure (GraphQL budget exhaustion per #1400) by leaving these calls uncounted against the GraphQL budget, but a REST fallback exists and it is one contributor among severaAccurate budget classification prevents premature GraphQL exhaustion and corrects misleading dry-run labels, directly improving reliability of the closure and roadmap workflows.The fix is adding a few command names to a constants table that both run_gh pacing and planned_gh already read, or swapping two porcelain calls for REST endpoints that already exist as fallbacks.dan-petty commentedon Oct 18, 2026
Amendment (2026-10-18): the same function also misclasses REST paths by substring
_is_graphql_command,_is_code_search_command,_is_code_scanning_autofix_commandand_is_general_search_command(src/devops_cli/github/rate_limiter.py:457-479at release/v0.2.37 30b8fdd) test whether any argument containsgraphql,search/code,code-scanningandautofix, orsearch/. A REST path that merely contains those letters is paced against the wrong budget. Checked withgh_request_resourceat 30b8fdd:api repos/graphql/graphql-js/issuesgraphqlcoreapi repos/octo/research/issuessearch(30 a minute)coreapi repos/octo/app/contents/docs/search/index.mdsearchcoreapi graphql -f query=xgraphqlgraphqlA repository named
research, or any file under asearch/directory, is throttled to the search budget's 30 requests a minute. The GitHub session from #983 (PR 1) reuses this function throughgh_request_resourceto pace its REST requests, so the defect now reaches both transports.AGENTS.md forbids matching against a subset of possible values. The remedy belongs with this item's table: classify by the parsed request, not by substrings. For
gh api, the endpoint is the first positional argument afterapi; it isgraphqlexactly, or a REST path whose resource follows from its leading segments (search/code,search/...,repos/{owner}/{repo}/code-scanning/.../autofix,.../dependency-graph/sbom), which GitHub's REST reference defines. For porcelain commands, use the table this item already proposes.Extra acceptance criteria for this item:
gh_request_resourcereturnscoreforapi repos/graphql/graphql-js/issues,api repos/octo/research/issuesandapi repos/octo/app/contents/docs/search/index.md, and the existing classes stay as they are forapi graphql,api search/issues,api search/code,search issues xandsearch code x.in argsubstring test remains in the resource predicates.dan-petty commentedon Oct 18, 2026
Amendment (2026-10-18):
gh pr viewandgh pr edittoo#1345 PR 1's review found two more gh porcelain commands that
run_ghpaces against the wrong budget.gh_request_resourcereturnscoreforgh pr view <branch> --json number ..., andplanned_ghrenders it as "REST read" (gh pr editas "REST write"). gh 2.102.0 resolvespr view <branch>with a GraphQL query, and requests reviewers with therequestReviewsByLoginmutation. So client-side pacing and dry-run labels draw on the core quota while GitHub charges GraphQL. Add both to this item's table of GraphQL-backed porcelain commands.chore(main): release 0.6.1 (#2279)