Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

feat(guardrails): block gh pr merge and gh pr ready while a PR has unresolved review threads or failing checks

Đang mở
#6,463 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
52/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
bash, github, graphql, powershell, shell

Hướng nghiên cứu

Start from flag-commit-pr-skill-bypass.sh (it already guards gh pr create around the lines named in the issue) and the existing PreToolUse Bash/PowerShell hook pattern in this plugins repo. Add a command-position match for gh pr merge (including --auto and --admin) and extend the advisory to gh pr ready and gh pr merge pointing at /source-control:pull-request. Resolve the PR from args or the current branch, query unresolved reviewThreads, CHANGES_REQUESTED reviews, and failed/pending checks in one GraphQL call, block with the listed message, and fail open with a visible warning if gh is missing or unauthenticated. Done when the acceptance cases pass and tests cover both shells.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

needs-human needs-triage

Problem

An agent can mark a PR ready and merge it without reading its reviews. flag-commit-pr-skill-bypass.sh covers only gh pr create (lines 2 and 256), so a direct gh pr ready or gh pr merge gets no check at all.

What happened on melodic-software/claude-code-account-rotation#218 (2026-10-05):

  1. The agent ran gh pr ready, which made Codex post a review with one P2 thread.
  2. The agent then ran gh pr merge without reading that thread.
  3. When the merge came back BLOCKED, it blamed an org ruleset parameter and asked the operator to run gh pr merge --admin.

The block was the unresolved review thread. Instructions and memory don't reliably prevent this, and the rule has to hold on every machine and in every repo. A hook in a plugin that ships everywhere does both.

Proposal

Add a PreToolUse guard for Bash and PowerShell that matches gh pr merge (including --auto and --admin) at a command position.

  1. Resolve the PR from the arguments, or from the current branch when none is given.
  2. Query in one GraphQL call:
    • unresolved reviewThreads
    • reviews with state CHANGES_REQUESTED
    • failed or pending check runs on the head commit
  3. Block if anything is unresolved. Print each item: thread path:line with the first line of its comment, each failed check's name, and each changes-requested reviewer. The message names the fix: read and address the threads, then resolve them, then merge.
  4. Treat --admin the same way. A bypass flag does not exempt a merge from unread feedback.

Also extend the advisory in flag-commit-pr-skill-bypass.sh to gh pr ready and gh pr merge, pointing to /source-control:pull-request. Marking a PR ready is when bot reviewers post their reviews.

Related: #5947 proposes an opt-in ask guard for high-stakes gh calls. This guard is a deterministic block on PR state and doesn't depend on that one.

Acceptance

  • gh pr merge on a PR with an unresolved thread is blocked, and the block message lists the thread.
  • After the thread is resolved and checks are green, the merge runs with no prompt.
  • --admin and --auto are blocked under the same conditions.
  • The guard fails open, with a visible warning, when gh is missing or unauthenticated, so CI and other machines are never wedged. The warning says so plainly.
  • Tests cover both shells.
Ngôn ngữ chính
Shell
Star
22
Fork
2
Merge trung bình
5 giờ 15 phút
Pull request đã merge (30 ngày)
833

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của melodic-software/claude-code-plugins

Tất cả issue của melodic-software/claude-code-plugins

Issue tương tự

Thêm issue về Shell/Bash

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.