Repository navigation
Description
Problem or Motivation
devops pr view has only --repo and --dry-run, and devops pr list has only --state, --limit and --repo. devops gh pr is the same app. Agents typed gh's flags: --json on pr view and pr list 123 times (Claude 48, other tools 75 in 53 sessions), --head and --base on pr list 41 times, --comments on pr view 12 times and --search on pr list 9 times. devops pr status failed 27 times in 20 sessions. After the failures agents used devops gh api: 1,695 GET pulls/:n and 779 GET pulls in the Claude logs.
Tracker #4833, child 6. The owner asked on 2026-11-11 to fix the devops gh issue name and to record such errors for a later analysis of missing flags, features and aliases. The counts come from a study of Claude Code, Kilo, Antigravity and Loki records from 2026-09-23 to 2026-11-11.
Proposed Solution & Architectural Design
Both commands already pass their arguments to gh pr view and gh pr list through run_gh (github/pr_plans.py), so add gh's flags with gh's names and pass them on. pr view: --json <fields>, --jq/-q, --comments/-c. pr list: --json <fields>, --jq/-q, --search/-S, --head/-H, --base/-B. Add devops pr status as a pass-through to gh pr status with --json, --jq and --repo. --json takes gh's field list, and gh names the valid fields when one is wrong. Each flag goes into the dry-run request plan. The boolean --json of other commands does not change.
Target Subsystem
SDLC, Git & PR Governance (devops pr, src/devops_cli/github/pr_plans.py).
Existing Tool Considered
gh itself. devops pr view and pr list already pass their arguments to gh through run_gh, so the work is flag pass-through with gh's names; nothing new is built.
Acceptance Criteria
devops pr view <n> --json number,title --jq .title prints the title. devops pr list --head <branch> --json number prints a JSON array. devops pr list --search is:draft --base main passes both to gh. devops pr view <n> --comments prints the comments. devops pr status exits 0 on a branch with a pull request. --dry-run with each flag lists the gh argv with that flag and runs nothing. devops gh pr view <n> --json title works too. Tests in pr_plans cover each flag.
Dependencies
None. An agent can start it now.
Source: #4833
Alternatives check of 2026-11-24: in-use.
The repository already uses this tool.
Tool: cli/cli (https://github.com/cli/cli), MIT, last activity 2026-11-24, maintained.
Reason: Searches and the cli/cli facts confirm gh already implements pr view, pr list and pr status with --json, --jq, --comments, --search, --head, --base and --repo; only the project's flag forwarding is missing.
Covers:
- pr view with --json, --jq and --comments
- pr list with --json, --jq, --search, --head and --base
- pr status with --json, --jq and --repo
Lacks:
- The devops pr wiring and dry-run argv plans
- The new devops pr status command and devops gh pr path
- A raw-output branch that skips the current table fallback
Proposed design
Problem statement
Add the named gh flags to devops pr view and pr list, and add devops pr status as a pass-through to gh pr status. The devops pr commands reject these flags today. The rejected flags are --json and --comments on pr view, and --json, --head, --base and --search on pr list. devops pr status also fails because the command does not exist. The change prints the planned gh argv on --dry-run and exposes the commands at the devops gh pr path.
Acceptance criteria
Requirement: PR view forwards JSON and jq
The system SHALL pass --json and --jq from devops pr view to gh pr view.
Scenario: PR view forwards JSON and jq
- WHEN A user runs
devops pr view 12 --json number,title --jq .titlewith a gh process stub. - THEN The command passes
gh pr view 12 --json number,title --jq .titleto the stub and prints the stub output.
Requirement: PR view forwards comments
The system SHALL pass --comments from devops pr view to gh pr view.
Scenario: PR view forwards comments
- WHEN A user runs
devops pr view 12 --commentswith a gh process stub. - THEN The command passes
gh pr view 12 --commentsto the stub and prints the comments.
Requirement: PR list forwards head and JSON
The system SHALL pass --head and --json from devops pr list to gh pr list.
Scenario: PR list forwards head and JSON
- WHEN A user runs
devops pr list --head feature --json numberwith a gh process stub that prints a JSON array. - THEN The command passes
gh pr list --head feature --json numberto the stub and prints the JSON array with no table.
Requirement: PR list forwards search and base
The system SHALL pass --search and --base from devops pr list to gh pr list.
Scenario: PR list forwards search and base
- WHEN A user runs
devops pr list --search is:draft --base mainwith a gh process stub. - THEN The command passes
gh pr list --search is:draft --base mainto the stub and renders the table from the stub output.
Requirement: PR list forwards jq
The system SHALL pass --json and --jq from devops pr list to gh pr list.
Scenario: PR list forwards jq
- WHEN A user runs
devops pr list --json number --jq .[].numberwith a gh process stub. - THEN The command passes
gh pr list --json number --jq .[].numberto the stub and prints the stub output.
Requirement: PR status exits zero on a branch with a pull request
The system SHALL add devops pr status as a pass-through to gh pr status with --json, --jq and --repo.
Scenario: PR status exits zero on a branch with a pull request
- WHEN A user runs
devops pr statuson a branch with a pull request and the gh stub exits 0. - THEN The command passes
gh pr statusto the stub and exits 0.
Requirement: PR status forwards JSON and repo
The system SHALL pass --json, --jq and --repo from devops pr status to gh pr status.
Scenario: PR status forwards JSON and repo
- WHEN A user runs
devops pr status --json number --repo owner/repowith a gh process stub. - THEN The command passes
gh pr status --json number --repo owner/repoto the stub and prints the stub output.
Requirement: GH path forwards PR view JSON
The system SHALL expose pr view, pr list and pr status at both the devops pr and devops gh pr paths.
Scenario: GH path forwards PR view JSON
- WHEN A user runs
devops gh pr view 12 --json titlewith a gh process stub. - THEN The command passes
gh pr view 12 --json titleto the stub and prints the stub output.
Requirement: Dry run prints the gh argv
Each changed or new pr command SHALL print the planned gh argv with --dry-run and send zero requests.
Scenario: Dry run prints the gh argv
- WHEN A user runs
devops pr view 12 --json title --dry-run. - THEN The command prints the planned
gh pr view 12 --json titleargv and sends no request.
Requirement: Raw output failure prints the gh error
The system SHALL print the error of gh and exit with its code when a run with --json or --jq fails, and SHALL NOT print a table.
Scenario: Raw output failure prints the gh error
- WHEN A user runs
devops pr list --json numberand the gh stub exits 1 with a rate-limit error. - THEN The command prints the stub's error and exits 1, and prints no table.
Requirement: Tests cover each new flag
The change SHALL add tests in tests/commands/test_pr_dry_run.py for each new flag and for pr status.
Scenario: Tests cover each new flag
- WHEN The test suite runs
tests/commands/test_pr_dry_run.py. - THEN Each new flag and
pr statushas a passing argv test.
Existing Tool Considered
cli/cli (gh, https://github.com/cli/cli, MIT, maintained) covers pr view, pr list and pr status with --json, --jq, --comments, --search, --head, --base and --repo. It lacks the devops wiring that this change adds: the new devops pr status command, the flag forwarding in pr_plans.py and commands/pr.py, the dry-run argv plans, and the devops gh pr path. The check also names MCP allowlists and a --watch refusal for pr checks. The issue body does not ask for them, so this proposal leaves them out. The repository already runs gh through run_gh, so the change builds no wrapper.
Key questions
- Which
prcommands already build a gh argv and run it throughrun_gh?:pr view,pr list,pr checksandpr diffbuild a gh argv inpr_plans.pyand run it throughrun_gh.pr statushas no command.pr checksreads a fixed--jsonlist and renders a verdict table;pr diffpasses--color. [sources: src/devops_cli/github/pr_plans.py, src/devops_cli/commands/pr.py, src/devops_cli/github/check_verdict.py] - How should the new flags reach
gh?: Extend the existing argument builders andplan_pr_*functions inpr_plans.py, and call them fromcommands/pr.py. The commands already userun_ghandPlannedRequest, so one argv builder serves the real run and the dry run. (best practice) [sources: src/devops_cli/github/pr_plans.py, src/devops_cli/commands/pr.py, src/devops_cli/github/rate_limiter.py]- Chosen: Extend the existing
pr_plansbuilders. The commands already userun_ghandPlannedRequest; one argv builder serves the run and the plan. - Rejected: Build a separate gh pass-through wrapper.
ghalready implements the commands and flags; a wrapper adds code and drifts from gh's flags. - Rejected: Parse each flag in the command module. It duplicates the argv builder and leaves the dry-run plan to guess the request.
- Chosen: Extend the existing
- What should
devops pr listprint when--jsonor--jqis given?: Print the stdout ofgh pr listunchanged. Without--jsonor--jq, keep the current table. The current command always parses a fixed--jsonlist and renders a table, so a user-supplied--jsonneeds a raw-output branch. (best practice) [sources: src/devops_cli/commands/pr.py, src/devops_cli/github/pr_plans.py]- Chosen: Raw output on
--jsonor--jq. The acceptance criteria require a JSON array and a jq result; a table cannot be either. - Rejected: Always render the table. A table is not the JSON array that the user asked for.
- Rejected: Always print raw output. It removes the default table that users get with no flag.
- Chosen: Raw output on
- Should a failed
ghrun on the--jsonor--jqpath use the REST fallback?: No. Print gh's error and exit with its code. Keep the existing fallback only on the table path. A fallback table would violate the raw-output contract. (best practice) [sources: src/devops_cli/commands/pr.py, src/devops_cli/github/check_verdict.py]- Chosen: Skip the fallback on the raw path. The fallback prints a table, which is not the JSON or jq output the user asked for.
- Rejected: Keep the fallback on every path. A rate-limited
--jsonrun would print a table and hide the failure. - Rejected: Remove every fallback. That changes the no-flag table behavior beyond this issue.
- How should
--jsonfield names be validated?: Pass the field list toghunchanged.pr_view_payload_argsandpr_checks_argsalready pass fixed field lists, and gh reports an invalid field. The command adds no local allowlist. (best practice) [sources: src/devops_cli/github/pr_plans.py, src/devops_cli/github/check_verdict.py]- Chosen: Pass the field list through. gh owns the field list and names a wrong field; a local list would drift.
- Rejected: Validate against a local allowlist. It duplicates gh's schema and needs a change for each new gh field.
- Do
devops pr checksanddevops pr diffneed new flags in this change?: No.pr checksalready runsgh pr checks --json name,state,bucket,workflow,linkand renders the verdict table.pr diffalready runsgh pr diffwith--color. The measured failures namepr view,pr listandpr status, and the body's criteria name only those. The change leaves both commands as they are. (best practice) [sources: src/devops_cli/github/check_verdict.py, src/devops_cli/github/pr_plans.py, src/devops_cli/commands/pr.py]- Chosen: Leave
pr checksandpr diffas they are. Both already run gh; changingpr checksto raw output would remove the verdict table and its exit code. - Rejected: Make
pr checksa raw pass-through. It changes the verdict table and exit code thatpr check-readinessand the docs rely on, and the body does not ask for it. - Rejected: Add
--name-onlytopr diff. The body and the measured failures do not name it; it is a separate flag request.
- Chosen: Leave
- How should the commands work at the
devops gh prpath?: Expose the same command functions under theghgroup, so both paths build the same gh argv. The issue states thatdevops gh pris the same app, and its criteria requiredevops gh pr view 12 --json titleto work. (best practice) [sources: src/devops_cli/commands/pr.py, src/devops_cli/commands/gh.py]- Chosen: Share the command functions between the two groups. One argv builder serves both paths, and the issue requires the
devops gh prpath. - Rejected: Add a separate
gh primplementation. It duplicates the command and the dry-run plan. - Rejected: Expose only
devops pr. The issue's acceptance criteria requiredevops gh pr view.
- Chosen: Share the command functions between the two groups. One argv builder serves both paths, and the issue requires the
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 11, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(pr)scope of the title gives the scope.Agents fail 123 times on flag typos and 27 times on pr status, but no data is lost and no build is blocked.High-frequency agent failures (123 flag typos, 27 status failures, 41 head/base misses) are resolved by this change.The body states the work is flag pass-through to gh with no new logic, and an agent can start it now.Both extend devops pr governance, but #181 adds pr ready, diff, and close while the candidate adds gh flag pass-through to pr view and pr list and a new pr status command.dan-petty commentedon Nov 12, 2026
Live data, 2026-11-12. The OTLP records
cli_usage_error(servicedevops-cli, Loki) hold 159 usage errors in the last 7 days. All 159 come from agents (usage_caller=agent,usage_agent_tool=claude_code) on the development container. The Service and its Job pods recorded none. Releases 0.118.0 to 0.121.1.gh issue view--jsongh pr view--jsongh issue view--commentsgh issue list--searchopenspecvalidategh pr list--jsonpr view--jsonci--listgh pr create --head,gh issue view --jq,ci list,--formatat the root,gh pr list --head,pr list --head,gh pr ready --undo,infra onboard --format--jsonon a view or list command is 127 of 159 (80 %). #4848 covers 118 records (74 %) and #4842 covers 31 (20 %). The order agrees with the transcript study of this tracker (--json138,--search53,--comments42,--head/--base41). The query:sum by (usage_command_path, usage_kind, usage_name, usage_caller) (count_over_time({service_name="devops-cli"} |= "cli_usage_error" [7d])).dan-petty commentedon Nov 12, 2026
Re-scope (owner direction of 2026-11-12). New title:
feat(pr): pr view, list, checks, diff and status run gh.New scope
The owner asked that a devops command that runs a CLI tool take the names of the tool and pass its arguments through (#5223, ADR 0026). This item adds no flag by hand.
devops pr view,pr list,pr checksandpr diffbecome entries of the registry of #5223, anddevops pr statusis new. The key of each entry is the tool pathgh pr <verb>.devops gh pranddevops prare one app at two paths (an exception of ADR 0026), so each command works at both paths.Evidence
gh pr view --json25,pr view --json2,gh pr list --json2,gh pr list --head1,pr list --head1.--json123,--headand--base41,pr status27 in 20 sessions,--comments12,--search9.devops pr listuses-nfor gh's-L(commands/pr.py).pr checksnamesGET pulls/{n}/checks, and GitHub has no such route (github/pr_plans.py). A pass-through plan prints the gh argv.gh pr viewis 1 point. fix(tools): gh-dash costs about 9 GraphQL points at start and 28 an hour as shipped, so the config refreshes hourly with the preview closed and the docs state the real numbers #1918 measured 1 point for a list of 20 and 2 points for a list of 50.gh pr checks --watch -i 0polls GraphQL with no pause (ghpkg/cmd/pr/checks/checks.go), and the pacer charges one acquire for each gh run.Proposed Solution & Architectural Design
gh pr view,gh pr list,gh pr checks,gh pr diffandgh pr status, all read entries.pr listowns-L/--limitfor its cost.pr checksprints the view of gh and exits with the code of gh, which is 8 when a check is pending. It refuses--watch,-i/--intervaland--fail-fastwith exit 2 and namesdevops pr monitor, the paced watch. The required-check verdict stays indevops pr check-readinessanddevops pr monitor. Premise check: list each document, skill or prompt that runsdevops pr checksfor the verdict, and change it todevops pr check-readiness._render_pr_view_fallback). On a GraphQL rate-limit refusal, the command prints gh's error and the reset-time line of feat(cli): tool commands pass unknown arguments to the tool #5223.("pr", "status")toCONST_GH_GRAPHQL_PORCELAIN_COMMANDS. Add a read-only MCP row("pr", "status"), but not to the job roles: under the App identity, the pull requests of the viewer have no meaning. The rows of the four other commands get the allowlists of their gh read flags, with no-w/--weband with-Lat most 100.Acceptance Criteria
devops pr view <n> --json number,title --jq .titleprints the title.devops gh pr view <n> --json titlealso works.devops pr list --head <branch> --json numberprints a JSON array.devops pr list --search is:draft --base maingives both flags to gh.devops pr view <n> --commentsprints the comments.devops pr statusexits 0 on a branch with a pull request.devops pr checks <n> --requiredexits with the code of gh.devops pr checks <n> --watchexits 2, namesdevops pr monitorand runs no gh (process stub).devops pr diff <n> --name-onlyprints the file names.--dry-runwith each command prints the gh argv and sends 0 requests.Dependencies
Merge first: #5223. Open the pull request after the pull request of #4848 merges, because both change the generated command reference. Do not open it while another open pull request changes
commands/pr.py. Open items that change that file: #4708, #4782, #5112, #5144, #5178 and #2530.[-]feat(pr): add pr status and the gh json and filter flags[/-][+]feat(pr): pr view, list, checks, diff and status run gh[/+]dan-petty commentedon Nov 13, 2026
Another occurrence on 2026-11-13 (review of #5434): an agent typed gh's flag on
devops gh pr list.devops-cli-service commentedon Nov 14, 2026
Alternatives check: in-use
Reason: The searches turned up no separate wrapper library, but the issue's own subject, the GitHub CLI (
gh), already implements every command and flag the item asks to expose:pr view,pr list,pr checks,pr diffandpr statuswith--json,--jq,--comments,--search,--headand--base. The issue states the project already shells out toghthroughrun_gh, so this is flag pass-through to an existing, maintained tool rather than a new build.The repository already uses this tool.
Tool: cli/cli (https://github.com/cli/cli)
Covers:
Lacks:
devops pr statuscommand and the entries at both thedevops pranddevops gh prpathsTools considered:
Searches run:
Sources:
Checked on 2026-11-14. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 15, 2026
Refine cannot set this item to Ready at 72e062d while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.
The next refine round also looks at the item again when a commit on the default branch changes one of these files:
src/devops_cli/commands/pr.py,docs/CLI_REFERENCE.md.devops-cli-service commentedon Nov 15, 2026
Status set to Ready at 6786f1a (see proposed design in issue body).
feat(pr): forward gh options in pr view, list, and add status
devops-cli-service commentedon Nov 25, 2026
Released in v0.217.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.217.0
devops-cli-service commentedon Nov 25, 2026
Live since 2026-11-25 06:46 UTC