Repository navigation
Backlog
4 / 44 of 4 issues completedBacklog
4 / 44 of 4 issues completed
Copy link
Labels
effort/mediumEffort Mediumowner/agentOwner Agent: an agentic coder works on the itempriority/p2-mediumPriority P2: standard workscope/prThe devops pr commandssource/agentFiled by an agentstatus/in-progressStatus In Progress: an owner works on the itemtype/refactorType refactor: a new structure, same behaviorvalue/highValue High: the delivery of the item matters much
Description
Problem
devops-cli rebuilds check and merge logic that GitHub and gh already have. It polls check runs and statuses, and removes the older runs. It guesses which workflows a PR starts. It decides "ready" and "merge".
The code (lines at commit d0bc3dffa), about 2,100 lines and 111 tests:
src/devops_cli/github/check_verdict.py:251-270:latest_run_of_each_check. Its docstring says "gh pr checksalso shows only the newer run".check_verdict.py:342-470and:507-548: the verdict.github/workflow_triggers.py:1-129: a copy of theon.pull_requestbranch and path filters of GitHub.merge_readiness.py:282-357: the readiness.pr_monitor.py:646-713: the poll loop.onboard/template_pr.py:31-55,:137-146and:312-377: the same checks for the template PR.
Every agent PR and every person PR goes through this code. In 30 days it broke 17 times:
- Issues: fix(github): Fix check-readiness base and monitor merged state #2530, fix(github): pr monitor polls again after one failed read #4838, fix(github): pr monitor reports ready when a poll reads no check #4927, fix(pr): pr monitor fits a repository with no CI #5144, fix(pr): readiness counts a check run that a newer run replaced #5383, fix(github): the other pull request change readers still use a stale base #5388, fix(pr): pr ready waits for checks that no workflow starts #5408, fix(pr): pr monitor waits for the checks of a code pull request #5417.
- Fix PRs: fix(github): pr monitor waits until the checks settle and names every blocker, and pr ready reads the merge-readiness verdict #2498, fix(github): correct readiness files and merged monitor output #5349, fix(pr): count only the latest run of each check #5393, fix(github): read the plan diff and the release files from the merge base #5401, fix(github): poll again after one failed read in pr monitor #5678, fix(pr): Read the head workflow triggers for the merge verdict #6173, fix(github): Fail closed when a poll reads no head commit #6300, fix(pr): judge the branch and path filters of pull request workflows #6803, fix(pr): raise pr monitor default timeout to 600 seconds #7118.
- fix(pr): readiness counts a check run that a newer run replaced #5383 rebuilt the filter for the latest run. fix(pr): pr ready waits for checks that no workflow starts #5408 rebuilt the trigger filter. GitHub and
ghalready do both.
Change
Replace the mechanics with gh and the merge rules of GitHub.
- Tool: GitHub CLI (https://github.com/cli/cli), MIT, v2.106.0 (2026-11-25).
gh pr checks <n> --required --watch --fail-fast --interval <s>replaces the poll loop, the filter for the latest run and the trigger guess. GitHub reports only the checks that run, and the newest run of each.gh pr view <n> --json mergeStateStatus,statusCheckRollup,reviewDecisionreplaces the readiness reads.gh pr readymarks a draft ready.gh pr merge <n> --auto --squash --match-head-commit <sha>replaces the merge mechanics. GitHub merges only that head commit, after the required checks pass. Who may merge does not change.- The ruleset rule
required_review_thread_resolutionmakes GitHub refuse a merge while a review thread is open. A person adds it to the ruleset baseline.
Keep, because these rules are project policy over the gh output:
- the grounding rules, and the plan and stage-eval rules;
- the settle time of the Copilot review;
- the map of exit codes and the fail-closed report.
Keep one fallback. A private repository on the Free plan has no rulesets, so --required reads nothing there. For such a repository, read all checks with gh pr checks and no --required.
Delete:
workflow_triggers.pyand its tests.latest_run_of_each_checkand the custom dedup incheck_verdict.py.- The poll loop of
pr_monitor.py, and the check reads oftemplate_pr.py.
Existing tool considered
gh(MIT, v2.106.0). It covers the check list, the watch, the readiness fields, the ready mark and the auto-merge. It has no project policy rules.- peter-evans/enable-pull-request-automerge. It is not chosen, because its last release is from 2023-03.
gh pr merge --autodoes the same.
Done when
workflow_triggers.py,latest_run_of_each_checkand the custom poll loop are deleted.- The monitor, ready and merge commands of
devops prrungh pr checks --required --watchandgh pr merge --auto --match-head-commit. - A test proves that each command sends these
gharguments and maps theghexit code to the project verdict. - A test proves the all-checks fallback for a repository with no ruleset.
- The tests of the policy rules stay and pass.
Source
Sub-issues
Collapse Sub-issuesSub-issues
Loading 4 sub-issues
Metadata
Metadata
Assignees
Labels
effort/mediumEffort Mediumowner/agentOwner Agent: an agentic coder works on the itempriority/p2-mediumPriority P2: standard workscope/prThe devops pr commandssource/agentFiled by an agentstatus/in-progressStatus In Progress: an owner works on the itemtype/refactorType refactor: a new structure, same behaviorvalue/highValue High: the delivery of the item matters much
Activity
dan-petty commentedon Nov 28, 2026
Both touch pr_monitor.py and the check/merge readiness flow, but #2443 reorganises the readiness code into a shared verdict while the candidate replaces the underlying check mechanics with gh commands.dan-petty commentedon Nov 28, 2026
This item is larger than one pull request: about 20 modules read checks through
check_verdict.py. It is split by command into four sub-issues:devops pr ready,check-readiness, and the verdict thatpr monitorreads) anddevops pr checksmove togh pr checks --json. It deletesworkflow_triggers.py,pull_request_workflow_at,read_commit_checksandwcmatch.pr monitormoves togh pr checks --watch --fail-fast --interval.read_check_runs,latest_run_of_each_check) move togh pr checks.repos onboardmoves togh pr checksandgh pr merge --auto --squash --match-head-commit.Evidence for the split and the design:
/usr/local/bin/gh). Inpkg/cmd/pr/checks/checks.go,--watchand--jsonexclude each other, and a head with no check exits 1 withno checks reported, the same exit code as a failed check.--requiredcannot replace the trigger guess. It cannot tell a branch that requires no check from required checks that have not started. The rules of the base branch (GET /repos/{repo}/rules/branches/{base}) tell them apart.isRequiredof the GraphQL rollup). If the readiness verdict used--required,pr readywould pass a failed Fail-to-Pass Check, CodeQL or Plan Check. That lowers a quality threshold (AGENTS.md rule 5), so refactor(pr): read the readiness checks with gh pr checks #7508 keeps all checks in the verdict.required_review_thread_resolutionis alreadytruein the rules ofmainand in the onboard baseline (src/devops_cli/github/onboard/ruleset_merge.py:51). No person step remains for it. The thread blocker of the readiness verdict stays, because it names the threads to fix (pr_threads.pyis in the Keep table of the audit).devops prhas no merge command. The only merge mechanics are those of the onboard template pull request (refactor(repos): wait for and merge the onboard template PR with gh #7512).refactor(pr): read the readiness checks with gh pr checks (#7519)