Skip to content

refactor(github): pr ready and pr monitor read the merge-readiness verdict, and pr monitor waits until the checks settle and names every blocker #2443

Closed

Description

@dan-petty

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.py reads the pull request with its own fetch_pr_details, and commands/pr.py has a second _fetch_pr_details.
  • The mergeable state is judged twice, with different rules: _check_mergeable_blocker in commands/pr.py and _resolve_merge_failure_reason, _check_early_pr_failures and _evaluate_pr_settled_readiness in github/pr_monitor.py. The monitor counts behind as a blocker, and check-readiness does not.
  • Unresolved review threads are judged twice.
  • pr ready reads its checks through a third path, check_verdict.fetch_pr_check_verdicts.
  • pr monitor stops 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 ready and pr monitor read the merge-readiness verdict of part 1. Each command maps the verdict to the exit codes it has today: pr ready exits 8 while checks are pending and 1 when one fails or cannot be read; pr monitor exits 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_details and the monitor's own rules are deleted.
  • While any required check is pending, pr monitor keeps waiting, whatever other blockers it sees. When the checks settle, it reports every blocker at once, each with its reason.
  • The design decides whether behind blocks, 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 ready and pr monitor for 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 monitor returns once, after the checks settle, and names both the failed check and the thread.
  • rg -n 'def _?fetch_pr_details' src finds one function.
  • The pr monitor tests cover only its loop and its exit codes. No test patches devops_cli.commands.pr.run_gh.
  • The tests run offline. uv run devops ci passes.

Related

Parent: #998. Needs part 1 (the merge-readiness verdict).

Source: #998

Activity

  1. added
    source/agent
    type/refactor
    status/new
    value/medium
    effort/medium
    on Oct 28, 2026
  2. dan-petty commented on Oct 28, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/refactor. The title prefix is refactor and the change restructures existing code to share one verdict and delete duplicate paths.
    • Priority: P2-Medium. It is a planned second step of #998 with a dependency on Part 1, not an urgent defect.
    • Value: Medium. It removes three duplicate code paths and fixes the monitor so it reports all blockers after checks settle, but the commands still function today.
    • Effort: Medium. It touches pr.py, pr_monitor.py, their tests, and deletes one helper, but the scope is well-defined by the acceptance criteria.
    • Related: refactor(github): pr check-readiness reads one merge-readiness verdict from github/, and the item rules are public predicates in roadmap/ #2442, which asks for a different change. 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.
  3. added
    priority/p2-medium
    on Oct 28, 2026
  4. removed
    status/new
    on Oct 30, 2026
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-mediumsource/agenttype/refactorvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions