Skip to content

feat(pr): pr close and pr ready pass gh arguments #5908

Open

Description

@devops-cli-service

Split from #4852.

The issue title names pr close and pr ready as passing gh arguments, but the body's Proposed Solution only specifies the --body-file change for pr create and pr edit. The pass-through of unknown gh arguments for pr close and pr ready, the removal of non-gh flags (pr ready -m/-f), the removal of pr wait, the rename of pr update to pr update-branch, the removal of REST fallbacks, and the MCP schema changes are not specified in the body. Acceptance criteria: pr close SHALL pass unknown gh arguments unchanged; pr ready SHALL refuse -m/--monitor and -f/--force with exit 2; pr wait MUST exit 2 as an unknown command; pr update-branch SHALL replace pr update; pr create and pr edit MUST have no REST fallback; the MCP schema SHALL reflect the changes.

Proposed design

Problem statement

The devops pr commands do not match gh argument handling. pr close and pr ready drop the gh arguments they do not declare, pr ready accepts the non-gh flags -m/--monitor and -f/--force, pr wait duplicates pr monitor, pr update has a name that gh does not, and pr create and pr edit keep REST fallbacks. The change forwards the gh arguments to gh pr close and gh pr ready, refuses the two non-gh flags, removes pr wait, renames pr update to pr update-branch with its required-check guard, removes the REST fallbacks, and updates the MCP schema from the same command metadata.

Acceptance criteria

Requirement: pr close gh argument pass-through

devops pr close SHALL pass each argument that it does not declare itself to gh pr close unchanged and in the same order.

Scenario: close forwards comment and delete-branch

  • WHEN a test runs devops pr close 42 --comment done --delete-branch with a fake gh that records its arguments
  • THEN the fake gh receives pr close 42 --comment done --delete-branch.

Requirement: pr ready gh argument pass-through

devops pr ready SHALL pass each argument that it does not declare itself to gh pr ready unchanged and in the same order, and SHALL skip the readiness verdict and the Status write for --undo.

Scenario: ready forwards undo without the verdict

  • WHEN a test runs devops pr ready 42 --undo with a fake gh that records its arguments and a pull request that the readiness verdict would refuse
  • THEN the fake gh receives pr ready 42 --undo and the command prints no readiness refusal.

Requirement: pr ready rejects non-gh flags

devops pr ready MUST exit with code 2 when it gets -m, --monitor, -f or --force, and MUST invoke no gh command.

Scenario: ready refuses monitor and force

  • WHEN a test runs devops pr ready 42 -m and devops pr ready 42 --force with a fake gh that records its arguments
  • THEN each run exits with code 2 and the fake gh records no call.

Requirement: pr wait removal

devops pr wait MUST exit with code 2 as an unknown command.

Scenario: wait is unknown

  • WHEN a test runs devops pr wait 42
  • THEN the command exits with code 2 and writes an unknown-command error.

Requirement: pr update-branch replaces pr update

devops pr update-branch SHALL replace devops pr update and SHALL send the update-branch request only when a required check failed on the head and GitHub reports no conflict.

Scenario: update-branch sends only for a failed required check

  • WHEN a test runs devops pr update-branch 42 with a fake gh that reports no conflict, a failed required check on the head and the head SHA
  • THEN the fake gh receives api -X PUT repos/<owner>/<repo>/pulls/42/update-branch -f expected_head_sha=<sha>.

Requirement: pr update removal

devops pr update MUST exit with code 2 as an unknown command.

Scenario: update is unknown

  • WHEN a test runs devops pr update 42
  • THEN the command exits with code 2 and writes an unknown-command error.

Requirement: no REST fallback

devops pr create and devops pr edit MUST return the gh failure and MUST call no REST fallback.

Scenario: gh failure stops create and edit

  • WHEN a test runs devops pr create or devops pr edit with a fake gh that exits with code 1
  • THEN the command exits with code 1 and the fake gh records no api call.

Requirement: MCP schema reflects the pr commands

The MCP server SHALL publish pr_update_branch and SHALL publish no pr_update, pr_wait, pr_close comment or delete_branch property, pr_ready monitor option or pr_ready force option.

Scenario: the tool listing names the renamed command

  • WHEN uv run devops ci test tests/ai/mcp/test_mcp_tool_listing.py runs after the exposure table changes
  • THEN the snapshot test passes with pr_update_branch in the listing, no pr_update or pr_wait entry, no comment or delete_branch property in pr_close, and no monitor or force property in pr_ready.

Existing Tool Considered

No alternatives check has run. gh (GitHub CLI) is the open, maintained tool that covers the need: it provides pr close, pr ready, pr update-branch, pr create and pr edit, with their argument parsing (https://cli.github.com/manual/gh_pr_update-branch, fetched 2026-11-18). It has no pr wait or pr update, so the proposal removes both. gh pr update-branch has no --expected-head-sha flag, so devops pr update-branch keeps the existing gh api request and its required-check guard (docs/SDLC.md:322). The proposal forwards the gh arguments to gh pr close and gh pr ready, deletes the REST fallbacks of pr create and pr edit, and builds no GitHub client of its own.

Key questions

  • Which gh pr subcommands exist for the commands in this issue?: gh provides pr close, pr ready, pr update-branch, pr create and pr edit; it provides no pr wait or pr update. The repository already calls four of them in src/devops_cli/github/pr_plans.py (pr_close_args, pr_ready_args, pr_create_args, pr_edit_args), and build_updte_branch_cmd in src/devops_cli/github/branch_updte.py builds the gh api -X PUT .../updte-branch request for the fifth. [sources: src/devops_cli/github/pr_plans.py:204, src/devops_cli/github/pr_plans.py:263, src/devops_cli/github/pr_plans.py:144, src/devops_cli/github/pr_plans.py:102]
  • Should pr close forward unknown arguments to gh or keep a fixed flag list?: Forward every argument that the command does not declare itself to gh pr close unchanged and in the same order. Declare only number, --repo/-R and --dry-run; pass --comment, --delete-branch and any later gh flag through ctx.args. (best practice) [sources: src/devops_cli/github/pr_plans.py:263, src/devops_cli/commands/pr.py:1622, src/devops_cli/commands/gh.py:1446]
    • Chosen: forward undeclared arguments. It keeps the command in step with gh and adds no flag list to maintain.
    • Rejected: allow a fixed flag list. It drops a valid gh flag when gh adds one.
    • Rejected: reject unknown arguments. It blocks gh flags that the command does not name.
  • Should pr ready forward unknown arguments and reject -m/--monitor and -f/--force?: Yes. Forward every argument that the command does not declare itself to gh pr ready unchanged and in the same order, except -m, --monitor, -f and --force, which MUST exit with code 2 before any gh call. For --undo, forward it and skip the readiness verdict and the Status write; for every other call, run the verdict and mark_ready with the extra arguments. (best practice) [sources: src/devops_cli/commands/pr.py:1516, src/devops_cli/commands/pr.py:1520, src/devops_cli/commands/pr.py:1508]
    • Chosen: reject the non-gh flags and forward the rest. It matches gh pr ready, which has no monnitor or force flag, and keeps the readiness verdict for a mark-ready call.
    • Rejected: keep the flags as devops flags. It keeps two behaviors that gh does not have.
    • Rejected: forward the flags to gh. gh pr ready rejects them, so the command fails later.
    • Rejected: keep the readiness verdict for --undo. It can refuse an un-draft that gh pr ready --undo accepts.
  • Should pr update stay as an alias for pr update-branch?: No. Remove pr update and keep only pr update-branch. The rename keeps the existing required-check guard and the expected_head_sha lock: gh pr update-branch has no --expected-head-sha flag, and docs/SDLC.md (No Catch-Up Updates) forbids an update with no failed required check. (best practice) [sources: docs/SDLC.md:322, openspec/specs/pr-update/spec.md:9, src/devops_cli/commands/pr.py:2003, CONTRIBUTING.md:36, CONTRIBUTING.md:37]
    • Chosen: rename and keep the guard. One name matches gh, and the recorded SDLC rule and the expected_head_sha lock stay.
    • Rejected: delegate unconditionally to gh pr update-branch. It drops the guard and the lock, and gh has no --expected-head-sha flag.
    • Rejected: keep pr update as an alias. It adds a second name and a test surface for the same action, which the pre-1.0 policy forbids.
    • Rejected: deprecate pr update with a warning. The pre-1.0 policy forbids deprecation shims.
  • Should pr create and pr edit keep a REST fallback when gh fails?: No. Remove _fallback_create_pr and _fallback_patch_pr and return the gh exit status and error. (best practice) [sources: src/devops_cli/commands/pr.py:1400, src/devops_cli/commands/pr.py:949, src/devops_cli/commands/pr.py:1036, src/devops_cli/commands/pr.py:852]
    • Chosen: remove the REST fallback. gh is the single write path, so a second path cannot diverge.
    • Rejected: keep the REST fallback. Two write paths can duplicate or diverge on failure.
    • Rejected: use REST first. It bypasses gh argument handling and its errors.
  • Should pr wait be removed?: Yes. Remove the wait alias of pr monitor; pr wait then exits with code 2 as an unknown command. docs/SDLC.md names pr monitor as the monitoring command, and the pre-1.0 policy forbids a second name. (best practice) [sources: src/devops_cli/commands/pr.py:733, docs/SDLC.md:358, openspec/specs/command-dry-run-class/spec.md:98, CONTRIBUTING.md:37]
    • Chosen: remove the alias. One name, pr monitor, matches the documented command and needs no second test surface.
    • Rejected: keep the alias. It keeps a second name for the same code, which the pre-1.0 policy forbids.
    • Rejected: keep pr wait and remove pr monitor. pr monitor is the name that docs/SDLC.md and the workflows use.
  • Should the MCP schema change be part of this change or deferred?: Part of this change. The MCP tool bridge is generated from Typer/Click metadata driven by CONST_MCP_EXPOSURE_TABLE, so the rename is one row (src/devops_cli/config/constants.py:415), and the snapshot test (tests/ai/mcp/test_mcp_tool_listing.py:11) and the generated docs/MCP_TOOLS.md show the diff. No schema field is hand-written. (best practice) [sources: src/devops_cli/config/constants.py:415, tests/ai/mcp/test_mcp_tool_listing.py:11, src/devops_cli/ai/mcp/generator.py:1]
    • Chosen: include the table row and snapshot update. The issue requires the MCP schema to reflect the change, and the path and validator are known.
    • Rejected: defer it to a new issue. The change is one table row and a reviewed snapshot diff, and the issue's acceptance criteria name it.
    • Rejected: hand-write the schema. The bridge is generated from Typer/Click metadata; a hand-written schema would diverge.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/feature
    source/agent
    status/new
    value/medium
    effort/medium
    scope/pr
    on Nov 16, 2026
  2. devops-cli-service commented on Nov 16, 2026

    @devops-cli-service
    ContributorAuthor
  3. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    ContributorAuthor

    Waiting for the alternatives check to run. The next refine round looks at the item again after the check records a verdict.

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/prsource/agentstatus/newtype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions