Repository navigation
Closed
Labels
effort/mediumEffort Mediumpriority/p2-mediumPriority P2: standard worksource/agentFiled by an agenttype/refactorType refactor: a new structure, same behaviorvalue/mediumValue Medium
Description
Problem or Motivation
Part 2 of #998. devops pr ready and devops pr monitor (and its alias pr wait) judge a pull request with their own code, apart from the merge-readiness verdict of part 1:
github/pr_monitor.pyreads the pull request with its ownfetch_pr_details, andcommands/pr.pyhas a second_fetch_pr_details.- The mergeable state is judged twice, with different rules:
_check_mergeable_blockerincommands/pr.pyand_resolve_merge_failure_reason,_check_early_pr_failuresand_evaluate_pr_settled_readinessingithub/pr_monitor.py. The monitor countsbehindas a blocker, andcheck-readinessdoes not. - Unresolved review threads are judged twice.
pr readyreads its checks through a third path,check_verdict.fetch_pr_check_verdicts.pr monitorstops at the first failing check while other required checks still run, so a blocker that comes later is reported only on a second run (found on the v0.2.25 release PR, 2026-10-03; see refactor(github): pr readiness is one verdict module that the pr commands, the monitor and mcp consume #998).
Proposed Solution & Architectural Design
pr readyandpr monitorread the merge-readiness verdict of part 1. Each command maps the verdict to the exit codes it has today:pr readyexits 8 while checks are pending and 1 when one fails or cannot be read;pr monitorexits 1 for failing checks, 2 for a draft, requested changes or unresolved threads, and 3 on timeout.- One pull request read, one mergeable evaluation and one thread evaluation stay. The second
_fetch_pr_detailsand the monitor's own rules are deleted. - While any required check is pending,
pr monitorkeeps waiting, whatever other blockers it sees. When the checks settle, it reports every blocker at once, each with its reason. - The design decides whether
behindblocks, the same for every command.
Target Subsystem
src/devops_cli/commands/pr.py (ready, monitor), src/devops_cli/github/pr_monitor.py, and their tests.
Existing Tool Considered
gh pr checks --watch waits for checks but does not judge threads, Copilot reviews or the item rules. The monitor keeps its loop and reads the one verdict. The change deletes the monitor's own rules.
Acceptance criteria
- A table test pins the exit code of
pr readyandpr monitorfor ready, pending, failing and unread checks, unresolved threads, a draft and the monitor's timeout. - A scripted test: a head with two pending required checks and one unresolved thread; the checks complete, and one fails, after the thread is first seen.
pr monitorreturns once, after the checks settle, and names both the failed check and the thread. rg -n 'def _?fetch_pr_details' srcfinds one function.- The
pr monitortests cover only its loop and its exit codes. No test patchesdevops_cli.commands.pr.run_gh. - The tests run offline.
uv run devops cipasses.
Related
Parent: #998. Needs part 1 (the merge-readiness verdict).
Source: #998
Metadata
Metadata
Assignees
Labels
effort/mediumEffort Mediumpriority/p2-mediumPriority P2: standard worksource/agentFiled by an agenttype/refactorType refactor: a new structure, same behaviorvalue/mediumValue Medium
Activity
dan-petty commentedon Oct 28, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
The title prefix is refactor and the change restructures existing code to share one verdict and delete duplicate paths.It is a planned second step of #998 with a dependency on Part 1, not an urgent defect.It removes three duplicate code paths and fixes the monitor so it reports all blockers after checks settle, but the commands still function today.It touches pr.py, pr_monitor.py, their tests, and deletes one helper, but the scope is well-defined by the acceptance criteria.Both are parts of #998; #2442 extracts the merge-readiness verdict into a public module, while the candidate makes pr ready and pr monitor consume that verdict and delete their own rules.refactor(github): pr check-readiness reads one merge-readiness verdic…