Repository navigation
Require scoped base branches for merge-pull-request - #77371
Conversation
Add mandatory owner-declared destination allowlists, enforce them during merge evaluation and revalidation, and reject unrestricted wildcard policies. Preserve source filtering and all existing merge safeguards, with regression coverage and migration documentation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep the merge destination policy change scoped by restoring the pre-existing generated maintenance workflow after the workflow-drift check. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
✅ 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.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
✅ Ponytail Reviewer completed successfully!
|
This comment has been minimized.
This comment has been minimized.
|
✅ PR Specification Reviewer completed successfully! Caution agentic threat detected DetailsPotential security threats were detected in the agent output. Detected threat types: malicious patch. Review the workflow run logs for details.
|
There was a problem hiding this comment.
What this change does: It requires an owner-defined list of destination branches for automated merges. The handler checks that policy alongside the existing merge gates.
Should fix: The final destination match duplicates the earlier match and the existing snapshot comparison. See the inline comment.
Verdict: Ship.
Lean: -3 lines possible.
Generated by ✂️ Ponytail Reviewer for #77371 · codex · routed: gpt61 medium · ~7 AIC · ⌖ ~1 AIC · ⊞ 182
Comment /ponytail to run again
There was a problem hiding this comment.
Static review completed. I found one actionable documentation/editor regression: the autocomplete entry is marked expandable without nested properties, so the required merge destination configuration cannot be discovered or completed. No tests were run per review constraints; the specialist pass was unavailable because its diff access was denied.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again
🏗️ Design Decision Gate — ADR RequiredThis PR makes significant changes to core business logic (144 new lines in business-logic directories) but does not have a linked Architecture Decision Record (ADR). 📄 Draft ADR committed:
📋 What to do next
Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision. ❓ Why ADRs Matter
ADRs create a searchable, permanent record of why the codebase looks the way it does. Future contributors (and your future self) will thank you. 📋 Michael Nygard ADR Format ReferenceAn ADR must contain these four sections to be considered complete:
All ADRs are stored in
|
There was a problem hiding this comment.
Caution
agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.
Details
Potential security threats were detected in the agent output. Detected threat types: malicious patch.
Review the workflow run logs for details.
Reviewed PR head 9150ef36ef0805bfbcf198952dba368d9d8ff399 against the Safe Outputs MCP Gateway Specification, §7.3 merge_pull_request requirements and MPR-001–MPR-005. The implementation, schema, runtime revalidation, and focused regression evidence align with the intentional allowed-base-branches change; protected/default branch refusals and existing gates remain preserved.
Synchronized docs/src/content/docs/specs/safe-outputs-specification.md to Version 1.30.0 (2026-11-13), clarified the mandatory destination-policy wording, and added the corresponding changelog entry. The specification-only commit is queued for publication to the same-repository PR branch.
Coverage limit: this was a static contract review; tests were not run.
Generated by PR Specification Reviewer for #77371 · copilot · gpt50 · ~6 AIC · ⌖ ~3 AIC · ⊞ 1.6K
Comment /review-specs to run again
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs, /tdd and /codebase-design to the destination-policy changes. Requesting changes on one correctness gap in the new wildcard guard.
📋 Key Themes & Highlights
Key Themes
- Incomplete wildcard rejection (blocking): The guard is implemented three times (JS at
merge_pull_request.cjs:610, Go atmerge_pull_request.go:147, schema atmain_workflow_schema.json:10906). Each one rejects only runs of*, so**/*,*/*,*/**and**/**pass all three. I confirmed withglobPatternToRegexand the Go validator. These patterns match nearly every nested branch, which defeats the stated “scoped destination” boundary. - Regression coverage: The new tests cover
*and**but not slash-only variants. Add them so the fix is pinned. - Triplicated rule: The same check lives in three places. Keep the rule identical across them, or the layers will drift again.
Positive Highlights
- ✅ The base-branch check runs at evaluation and again at final revalidation, so retargeting is caught.
- ✅
allowed-base-branchesis kept independent ofallowed-branches, and the test for a destination match not bypassing the source filter is useful. - ✅ Protected and default-branch vetoes are preserved, with tests for each.
@copilot please address the inline comments above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~5 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again
There was a problem hiding this comment.
🟡 Changes recommended
Critical validation gaps allow unencoded expressions to inject handler settings and overly broad or unsupported glob patterns to authorize unintended destination branches.
2 open issues
What changed in this PR
This PR adds an explicit destination boundary to gh-aw’s merge-pull-request safe output, requiring owners to declare which integration branches autonomous merges may update.
Changes:
- Require non-empty
allowed-base-branchesconfiguration across the schema, compiler, and runtime types. - Check the live destination during evaluation and final revalidation while preserving existing merge gates.
- Update regression coverage, examples, migration guidance, and the breaking-change changeset.
| File | Description |
|---|---|
pkg/workflow/safe_outputs_validation_merge_pull_request_test.go |
Tests destination-policy validation and serialization. |
pkg/workflow/safe_outputs_specification_merge_pull_request_test.go |
Checks that the specification documents the requirement. |
pkg/workflow/safe_outputs_permissions_test.go |
Adds destination scope to permission-test fixtures. |
pkg/workflow/safe_outputs_import_test.go |
Updates imported merge configurations. |
pkg/workflow/safe_outputs_handler_registry_pull_requests.go |
Passes destination patterns to the runtime handler. |
pkg/workflow/safe_outputs_allowed_labels_validation_test.go |
Updates the label-validation fixture. |
pkg/workflow/merge_pull_request.go |
Parses and validates required destination patterns. |
pkg/workflow/merge_pull_request_experimental_warning_test.go |
Updates the experimental-warning fixture. |
pkg/workflow/compiler_safe_outputs_config_protection_test.go |
Updates the protected-file configuration fixture. |
pkg/workflow/compiler_safe_outputs_config_pr_policy_test.go |
Verifies destination-policy serialization. |
pkg/parser/schemas/main_workflow_schema.json |
Requires destination patterns and removes null configuration. |
pkg/parser/schema_test.go |
Updates protected-file schema fixtures. |
pkg/parser/schema_safe_outputs_target_test.go |
Updates target-selection schema fixtures. |
pkg/parser/schema_merge_pull_request_test.go |
Tests required lists and invalid destination configurations. |
pkg/cli/workflows/test-copilot-merge-pull-request.md |
Adds destination scope to the example workflow. |
docs/src/content/docs/specs/safe-outputs-specification.md |
Specifies destination matching and owner responsibilities. |
docs/src/content/docs/reference/safe-outputs-pull-requests.md |
Explains matching, migration, and policy limitations. |
docs/src/content/docs/reference/frontmatter-full.md |
Updates the full configuration reference. |
docs/public/editor/autocomplete-data.json |
Marks merge configuration as object-only. |
actions/setup/js/types/safe-outputs-config.d.ts |
Declares the required workflow configuration field. |
actions/setup/js/types/handler-factory.d.ts |
Declares the runtime destination-policy field. |
actions/setup/js/safe_output_manifest.cjs |
Recognizes the destination-rejection failure code. |
actions/setup/js/merge_pull_request.test.cjs |
Covers destination matching, retargeting, and existing vetoes. |
actions/setup/js/merge_pull_request.cjs |
Enforces destination policy before merging or previewing. |
.github/aw/safe-outputs-management.md |
Updates agent-facing configuration guidance. |
.changeset/merge-required-base-branches.md |
Records the breaking requirement and migration. |
Review effort: Max (dynamic)
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering. Structured data{
"completed_task": 0,
"head": "45d8f8ec97ae6c285d9956a19dd3d5decbd6036e",
"kind": "requested",
"schema_version": "1",
"state": "d2cf3a0ec068e11daa52c0d967d8fd2e0b995d8e8d7d4d367ad45b1c1916a4ed",
"work": [
"07b8fc9647941234c1e1a4e0336f5c13da6d030b3b1ab749b8e0c2791a9cf6ec",
"37a406e7390a81793f6fbe91ab3e4fdfeafebe6e3735b91a53954a3bc099a4b7",
"4d46aa1c6618044c692ae6442ff14c0093d5ca7560d77fdf4f34f6db35db1c03",
"55101ecd244f4501f2d77cba60a652414fecf8fa1823609bdedba8831a5691bc",
"ac37977c2c96860772840b62892f8e82c29f2bfe15fd2725377f73b75fd188de"
],
"workflow": "pr-sous-chef"
}
|
…lidation 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>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Reject expressions and unsupported glob syntax consistently across schema, compiler and runtime; preserve scoped wildcard checks and snapshot-based retargeting protection. Add compiler, runtime and editor-data regressions, synchronize policy guidance, and complete the proposed ADR without claiming human review clearance. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
In response to Test Quality Sentinel: no code change is requested by this status notice. This batch was checked directly with focused regression tests and repository validation rather than treating the earlier no-op report as verification. |
|
In response to Matt Pocock Skills Reviewer: accepted the actionable inline findings. Wildcard/separator-only destination patterns are rejected consistently across the schema, compiler and runtime, with regression cases for the reported forms. |
|
In response to PR Code Quality Reviewer: accepted the inline autocomplete finding. Nested merge settings are discoverable in generated editor data, with a generator regression test covering the mandatory destination configuration. |
|
In response to Ponytail Reviewer: accepted the inline simplification. The redundant final match is removed while snapshot-based retargeting protection and its regression coverage remain. |
|
In response to Design Decision Gate: completed the generated ADR's rationale, alternatives and consequences and linked it in the PR description. This documents the decision without claiming an unavailable human RAI approval. |
|
In response to PR Specification Reviewer: the existing detection artifact reports malicious_patch=true but supplies no reasons or warnings, so I cannot establish or clear the flagged concern from that evidence. The caution remains intact and requires independent human review; this batch does not approve or merge the PR. |
|
In response to ADR Required: accepted the documentation request and completed ADR-77371, including context, decision, alternatives and consequences. The PR description now links it; the document does not substitute for independent human review. |
|
In response to PR Sous Chef: accepted the branch synchronization and code-feedback requests, ran make merge-main, and addressed the listed review findings. No PR merge or manual workflow dispatch was performed. |
|
🎉 This pull request is included in a new release. Release: |

Why
Refusing default and protected branches does not by itself establish an explicit human-owned boundary for autonomous merges. Require repository owners to declare the non-consequential integration destinations that
merge-pull-requestmay update.Changes
allowed-base-branchesconfiguration. Reject wildcard/separator-only entries such as"*","**","*/*", and"**/**", GitHub Actions expressions, and unsupported glob operators; only*and**are supported.allowed-branchesas an independent source filter and preserve default/protected-branch refusals, caution vetoes, protected-file checks, review gates, configured CI requirements, and head-SHA binding.ADR: ADR-77371: Require scoped base branches for merge-pull-request
Migration and limitations
Existing workflows must add a scoped destination list and recompile. Null/default-only merge configuration and omitted or empty destination lists are no longer accepted; destination policy is never inferred from source filters.
This is an owner declaration of suitable integration scope, not automated proof of harmless downstream effects or per-merge human approval. Owners remain responsible for assessing downstream automation and protecting policy definitions from agent edits. The existing mutable-policy race remains: GitHub atomically enforces only the evaluated head SHA.
The existing specification-review detection caution remains intact and requires independent human review. Completing the proposed ADR or passing local checks does not clear it or imply maintainer approval.
Validation
make agent-report-progresspassed: build, JavaScript type checking/lint, change-scoped Go lint/custom analyzers, impacted tests, schema freshness, and workflow drift. Custom analyzer diagnostics were confined to unchanged files.mainusingmake merge-main. No PR merge or manual workflow dispatch was performed.