Skip to content

Block merge until Copilot reviews HEAD + threads resolved#25

Merged
autholykos merged 1 commit into
mainfrom
claude/copilot-review-gate
May 29, 2026
Merged

Block merge until Copilot reviews HEAD + threads resolved#25
autholykos merged 1 commit into
mainfrom
claude/copilot-review-gate

Conversation

@autholykos

Copy link
Copy Markdown
Contributor

Problem (evidence-based)

Copilot reviews asynchronously. On pituitary #413 the review threads were created at 07:09:47Z/:48Z — the PR merged at 07:09:45Z, ~2s earlier. Native required_review_thread_resolution can't block on threads that don't exist yet at merge time. Two other gaps: ungated repos (cortex was tier=null) and summary-only Copilot reviews with no inline threads.

Fix

A custom required status check that stays red until Copilot has reviewed the current HEAD commit AND every review thread is resolved.

  • copilot-review-gate.yml (reusable) — GraphQL evaluation; exempts drafts + bot PRs.
  • required-copilot-review-gate.yml (wrapper) — re-evaluates on pull_request_review + pull_request_review_thread so resolving a thread flips it green without a re-push; skips on the meta-repo.
  • apply-org-policy.sh — adds production-copilot-review (Copilot review_on_push: true) and production-review-gate (requires the wrapper), both tier=production.

Why review_on_push: true is load-bearing

Without it, the strict "reviewed HEAD" gate deadlocks the instant you push a fixup past Copilot's first review. With it, Copilot re-reviews every push, so HEAD always gets a fresh review.

Honest limit

"Resolved" is a manual acknowledgment, not proof a comment was fixed — GitHub has no concept of "addressed". This forces conscious, per-thread resolution of the current code; for a solo self-merger it makes skipping deliberate and loud rather than accidental.

Apply order

Merge first (wrapper must be on main), then ./scripts/apply-org-policy.sh. Scope: tier=production + cortex promoted to production.

🤖 Generated with Claude Code

Copilot reviews asynchronously, so a fast self-merge can land *before*
Copilot posts its review threads — native required_review_thread_resolution
has nothing to block on, the merge succeeds, and the comments arrive seconds
later (observed on a real PR: threads created 2s after merge).

Add a custom required check that closes the race:
- copilot-review-gate.yml (reusable): GraphQL-evaluates the PR and fails
  unless Copilot has reviewed the current HEAD commit AND every review thread
  is resolved. Drafts and bot-authored PRs are exempt (avoid deadlocks).
- required-copilot-review-gate.yml (wrapper): re-evaluates on
  pull_request_review and pull_request_review_thread events so resolving a
  thread flips the check green without a re-push. Skips on the meta-repo.
- apply-org-policy.sh: two tier=production rulesets — production-copilot-review
  (Copilot auto-review with review_on_push:true, so HEAD is always re-reviewed
  after a fixup push and the gate can't deadlock) and production-review-gate
  (requires the wrapper).
- self-ci: ignore actionlint's stale "unknown event" error for the real
  pull_request_review_thread trigger.

Honest limit documented in ORG-POLICY.md: "resolved" is a manual ack, not
proof a comment was fixed — this forces conscious per-thread resolution of
the current code, making skip deliberate rather than accidental.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 29, 2026 13:42
@autholykos
autholykos merged commit 2803217 into main May 29, 2026
5 of 6 checks passed
@autholykos
autholykos deleted the claude/copilot-review-gate branch May 29, 2026 13:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants