Skip to content

fix(github): gate pr merge readiness on required approvals, mergeable state, and reviewer feedback #183

Closed

Description

@dan-petty

Problem Description

Pull requests are currently reported as '100% READY FOR MERGING' prematurely even when they cannot be merged.

Root Causes

  1. Missing mergeable_state Verification: is_ready_for_merge and monitor_pr() only inspect CI checks, draft status, and thread count. They ignore GitHub's mergeable_state (REST) and mergeStateStatus (GraphQL). A PR with mergeable_state: 'blocked' (awaiting required approvals/branch protection) or 'dirty' (conflicts) is falsely declared ready.
  2. Copilot Review Header Disregard: GitHub Copilot's Code Review bot often submits reviews with state: 'COMMENTED' while the review body begins with '### Changes recommended'. The current logic only inspects state == 'CHANGES_REQUESTED', misclassifying active recommendations as completed without changes requested.
  3. Missing Review Approval Check: When --require-reviews is enabled (default True), PR readiness is evaluated without validating that the PR has been approved.

Remediation Plan

  • Add mergeable, mergeable_state, and reviewer state checks to PRMonitorStatus.
  • In _detect_copilot_status, classify 'changes recommended' in review body as changes_requested.
  • Enforce that monitor_pr fails closed (exit code 2) when mergeable_state == 'blocked', conflicting, or changes requested.
  • Update tests to ensure 100% test-first verification of these gates.

Activity

  1. added this to the v0.2.17 milestone on Sep 12, 2026
  2. added
    type/bug
    scope/github
    status/ready
    status/in-progress
    and removed
    status/ready
    on Sep 12, 2026
  3. dan-petty commented on Sep 14, 2026

    @dan-petty
    OwnerAuthor

    Resolved and merged into release/v0.2.17.

  4. added and removed
    status/in-progress
    on Sep 14, 2026
  5. added a commit that references this issue on Sep 14, 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

    scope/githubtype/bug

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions