Repository navigation
Fix PR branch rejection for Copilot-review-only rulesets - #75230
Conversation
Confirm classic protection is absent and read every applicable rules page before allowing the narrow advisory-only exception. Keep restrictive and uncertain protection blocked. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. Design Decision Gate 🏗️Outcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Specification Reviewer completed successfully!
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
There was a problem hiding this comment.
Reviewed head ef1b8f09d04c0b1c43b867b84c8ce806d81aa8a2 against the Safe Outputs MCP Gateway Specification (repository checkout-resolution requirements RCR1–RCR7) and Checkout Behavior Specification §6.3/T-CHK-015. The implementation preserves target/default-branch and checkout authorization boundaries, enumerates rules pages, and fails closed on incomplete protection evidence. I found no demonstrated normative contract violation requiring code changes.
One documentation correction is requested inline: the new claim that branch and rules reads use only contents: read is inaccurate for the rules/classic-protection endpoints, which may require Administration: read; this matters because the implementation intentionally blocks when those reads cannot be confirmed. No specification synchronization or branch push was necessary.
Generated by PR Specification Reviewer for #75230 · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review-specs to run again
Comment MemoryPeek at saved memory (pr-code-quality-reviewer)Note This comment is managed by comment memory.Expand the saved memory block to view or edit the persistent context for this thread.
|
There was a problem hiding this comment.
The protection classification is narrowly scoped and otherwise fail-closed, but the new pagination loop has no termination bound. A malformed or non-paginating response can hang the safe-output job until runner timeout and consume API rate limits. Please bound pagination and add a regression test.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs and /tdd. Requesting changes: the new exception can let a protected default branch through when repos.get fails.
📋 Key Findings
Blocking
- Default-branch bypass. If
repos.getfails,defaultBranchisnulland the default-branch guard is skipped. With only Copilot review rules, the new exception then allows a protected default branch. I reproduced this with a standalone Node probe: base returns a protection-rules block, and this PR returnsnull. Guarding the exception withdefaultBranchrestores base behaviour and keeps the intended allow path. See the inline comment onpr_helpers.cjs.
Non-blocking
- Add a regression test for the failing
repos.getcase (inline on the test file). - The docs claim the default branch is "always rejected"; that is not true when
repos.getfails (inline on the doc). - The rules loop has no page cap (inline on
pr_helpers.cjs).
Positive highlights
- ✅ Fails closed on malformed, empty, mixed, and unknown rules, and on any rules-query error.
- ✅ Reads rule pages directly to avoid the paginator swallowing a later-page 409.
- ✅ Good test coverage of the allow and block matrix.
Limitations
I did not run the vitest suite here because it is not installed in this environment. The default-branch finding comes from a standalone Node probe that exercises checkBranchPushable directly.
@copilot please address the review comments above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~4 AIC · ⌖ ~1 AIC · ⊞ 5.4K
Comment /matt to run again
There was a problem hiding this comment.
🟡 Changes recommended
The branch-protection exception can fail open when default-branch metadata is unavailable or a generic 404 is treated as absent protection, potentially allowing direct agent commits to default or protected branches.
3 open issues
What changed in this PR
This PR narrows gh-aw’s safe-output branch checks so Copilot-review-only rulesets can qualify for an exception instead of automatically blocking PR branch pushes.
Changes:
- Adds an exception requiring explicit metadata, Copilot-only rules, and classic-protection absence confirmation.
- Reads rules page by page and blocks the exception when rule evidence is incomplete or unavailable.
- Adds helper and handler regression coverage and documents permission limitations.
| File | Description |
|---|---|
docs/src/content/docs/reference/safe-outputs-pull-requests.md |
Documents the exception and permission-dependent behavior. |
actions/setup/js/push_to_pull_request_branch.test.cjs |
Covers successful Copilot-only pushes and rejection before git operations. |
actions/setup/js/pr_helpers.test.cjs |
Covers pagination, malformed responses, classic protection, and API failures. |
actions/setup/js/pr_helpers.cjs |
Implements rule classification and classic-protection confirmation. |
Review effort: Max (auto)
|
Copilot assignment requested for the following outstanding work:
Once you start work, post this work summary as a PR comment without the leading Copilot mention, including the Sous-chef head, work, and state lines below, to record that the assignment is running. Apply the necessary fixes on this PR's existing branch, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved; stop when only human review or CI remains. Do not merge or trigger CI. Sous-chef requested-head: ef1b8f0
|
Sous-chef requested-head: ef1b8f0 Work is underway: I’m merging the latest |
…anch-safe-outputs Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Require the authoritative Branch not protected response, explain Administration permission failures, and extend metadata and no-git regression coverage. Correct endpoint-specific permission documentation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
🎉 This pull request is included in a new release. Release: |


GitHub reports
protected: truefor branches covered only by automatic Copilot code-review rulesets, although those rules do not restrict pushes. This caused Design Decision Gate run 42076616520 to reject an ADR push for #75196 before any git operation. Current main retained the same broad flag check after #74946.Approach
Permit a narrow exception only when branch metadata explicitly disables classic protection, every applicable rule is
copilot_code_review, and the classic protection endpoint confirms absence with HTTP 404. Read rule pages directly: Octokit's paginator can swallow a later-page HTTP 409 and return incomplete results.Default branches, classic protection, restrictive or unknown rules, mixed rulesets, malformed/empty initial responses, and failed confirmation remain blocked. Existing GitHub enforcement and push mechanics are unchanged. No repository rules, credentials, workflow prompts, or generated locks are modified.
Validation
pr_helpers.test.cjsandpush_to_pull_request_branch.test.cjs, including later-page restrictive rules/409, classic protection, default branches, unavailable metadata, and handler-level no-git assertions.git diff --checkpassed.make agent-report-progresspassed; a subsequent guarded error-status adjustment passedmake agent-report-progress-no-testand the same focused tests without lint warnings.Review notes and limitations
Classic-protection confirmation can require Administration read permission. If the existing runtime token cannot confirm absence, this exception intentionally remains blocked; this change does not request or grant broader credentials. The observed ruleset metadata is current, not a historical snapshot of the failed run.
The initial read-only security review identified pagination and classic-protection evidence issues, addressed in this candidate. Formal security-review clearance for the revised source remains unavailable because the synchronous reviewer invocation could not accept follow-up messages. This draft does not claim that clearance; the exception and permission behavior need review before merge.
Only reference-documentation prose changed in Markdown, documenting the narrower classification and fail-closed permission handling. No workflow frontmatter, executable snippets, prompts, imports, sandbox, or credential destinations changed. No live workflow was dispatched or rerun.
Relates to #75196.