Repository navigation
Harden experimental pull request merging - #73922
Conversation
Bind merges to evaluated head revisions, fail closed on incomplete review evidence, and add workflow-owned CI and independent approval controls with decision evidence and final revalidation. Co-authored-by: Copilot App <[email protected]>
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
🧠 Matt Pocock Skills Reviewer failed during the skills-based review.
|
Document compiler and runtime evidence boundaries, opt-in CI and approval policies, revision binding, and residual trust risks in specification 1.0.81. Co-authored-by: Copilot App <[email protected]>
|
✅ 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.
|
|
✅ 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.
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.
|
🏗️ Design Decision Gate — ADR RequiredThis PR adds 131 lines to business logic directories under 📄 Draft ADR committed: The draft describes this decision: every
📋 What to do next
Once the ADR is linked in the PR body, this gate will run again and check that the implementation matches the decision. ❓ Why ADRs Matter
ADRs keep a searchable, permanent record of why the code looks the way it does. Future contributors, including you, can look up the reasoning later. 📋 Michael Nygard ADR Format ReferenceAn ADR must contain these four sections to be considered complete:
ADRs are stored in
|
Log only fixed events and phases, counts, and booleans for merge evidence, revalidation, and outcomes. Cover identifier and error exclusion with mocked regression tests and document the debug-only privacy boundary. Co-authored-by: Copilot App <[email protected]>
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.
Request changes
Two correctness issues should be fixed before merging:
Blocking findings
- Branch-protection-required checks can trigger
checks.listForRefwithout thechecks: readpermission when workflow-ownedrequired-checksis omitted, causing unexpected 403 failures. - Final revalidation treats asynchronous
mergeablerecomputation as policy mutation, causing flaky false rejections.
Inline comments contain the required remediation and test guidance.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~9 AIC · ⌖ ~1 AIC · ⊞ 1.7K
Comment /review to run again
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs and /tdd. The change is well tested and fails closed. Two notes, neither blocking.
📋 Verification and findings
Verified
- Go suites pass:
TestMainWorkflowSchema_MergePullRequestPolicies(pkg/parser) andTestMergePullRequest|TestValidateSafeOutputsMergePullRequest(pkg/workflow). - Check-read failures fail closed: the
tryaroundevaluateRequiredCheckscatches errors and returnsmerge_operation_error. - Protected branches are refused before check evaluation, so branch-protection-derived checks never reach the
checks: readpermission path. No gap there.
Notes
- Check-name collision (see inline comment on
merge_pull_request.go).required-checksmatches check-run names only. Acreate-check-runname that matches a required check would satisfy the gate. The agent cannot choose that name, since it comes from workflow config, so this needs a workflow author to configure both. Rejecting the overlap at compile time is a cheap hardening step. - Producer identity (see inline comment on
merge_pull_request.cjs). Filtering byapp.idwould make the producer of a check run explicit. The docs already state that check names do not authenticate the producer, so this is optional.
Not verified
- The JS suite
merge_pull_request.test.cjsdid not run. The npm registry TLS certificate is untrusted in this environment, so vitest is not installed. The JS behaviour is reviewed by reading only.
@copilot please address the review comments above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routing failed · ~10 AIC · ⌖ ~1 AIC · ⊞ 5.4K
Comment /matt to run again
There was a problem hiding this comment.
🟡 Changes recommended
Review selection uses creation IDs rather than submission times, allowing a later-submitted change request to be ignored and a stale approval to authorize a merge when reviewDecision is null.
3 open issues
What changed in this PR
Hardens the experimental merge-pull-request safe output across the runtime and compiler while preserving existing repository and branch restrictions.
Changes:
- Binds merges to the evaluated head SHA and adds fail-closed review reads and final policy revalidation.
- Introduces optional workflow-owned CI and independent-approver requirements, plus structured decision evidence.
- Updates configuration, permissions, regression coverage, tool descriptions, and documentation.
| File | Description |
|---|---|
specs/compiler-threat-detection-spec.md |
Defines merge authorization boundaries and evidence requirements. |
specs/compiler-threat-detection-changelog.md |
Records specification revision 1.0.81. |
pkg/workflow/safe_outputs_validation_merge_pull_request_test.go |
Tests policy parsing, serialization, validation, and permissions. |
pkg/workflow/safe_outputs_handler_registry_pull_requests.go |
Passes workflow-owned policies to the handler. |
pkg/workflow/safe_output_handlers.go |
Adds conditional checks: read permission. |
pkg/workflow/merge_pull_request.go |
Adds check and approver configuration and validation. |
pkg/workflow/js/safe_outputs_tools.json |
Updates the compiler-side merge tool description. |
pkg/workflow/compiler_validators.go |
Integrates policy validation into compilation. |
pkg/parser/schemas/main_workflow_schema.json |
Defines the new frontmatter policy fields. |
pkg/parser/schema_merge_pull_request_test.go |
Tests policy field schema constraints. |
docs/src/content/docs/specs/safe-outputs-specification.md |
Specifies merge gates, evidence, and operational limits. |
docs/src/content/docs/reference/safe-outputs-pull-requests.md |
Documents policy configuration and authorization boundaries. |
actions/setup/js/safe_outputs_tools.json |
Mirrors the updated runtime tool description. |
actions/setup/js/merge_pull_request.test.cjs |
Adds mocked merge-hardening regressions. |
actions/setup/js/merge_pull_request.cjs |
Implements revision binding, approval checks, revalidation, and evidence collection. |
Review effort: Max (auto)
Grant check-read permissions for branch-derived requirements, separate asynchronous mergeability from stable policy inputs, and record the merge authorization decision. Co-authored-by: Copilot App <[email protected]>
|
In response to this comment: No code change is needed for this completion notice. The two concrete findings from this review are addressed in their inline threads with focused regression coverage. |
|
In response to this comment: No code change is needed for this status notice, which now reports that the skills review failed. I am not treating it as successful review or validation evidence. |
|
In response to this comment: No code change is requested by this reported_no_action result. I am not treating that result as evidence that validation or publication succeeded. |
|
In response to this comment: No code change is requested by this reported_no_action result. Focused mocked runtime and compiler tests passed rather than relying on this status as test evidence. |
|
In response to this comment: The concrete ADR requirement below is addressed by adding the decision record and linking it in the PR body. This completion notice itself requires no separate code change. |
|
In response to this comment: Accepted: added and linked ADR-73922, covering the decision, alternatives, consequences, and remaining trust boundaries. No draft existed on the live branch, so the record was created without inventing named deciders or claiming maintainer approval. |
|
In response to this comment: Both recorded findings are addressed in their inline threads: check-read permissions now cover branch-derived requirements, and asynchronous mergeability is revalidated separately from stable authorization inputs. The fixes include focused regressions; this managed memory comment is left unchanged. |
Reject ambiguous check producers and agent-controlled check overlap, order reviews by validated submission time, and designate returned metadata as untrusted without weakening exact policy comparisons or approval provenance. Co-authored-by: Copilot App <[email protected]>
Keep exact untrusted decision evidence and runtime check permissions while avoiding redundant metadata/error text in logs. Verify live and staged execution skip check reads when no requirements exist. Co-authored-by: Copilot App <[email protected]>
|
In response to this comment: Completion acknowledged; the concrete findings have separate fixes and regression coverage. No additional change is requested here. |
|
In response to this comment: This review failed and is not successful validation evidence. No source change follows from this status alone. |
|
In response to this comment: The reported_no_action outcome is not validation or publication proof. No additional source change is requested. |
|
In response to this comment: This no-action notice does not establish test success. Focused regression results are separate evidence. |
|
In response to this comment: The ADR exists and is linked in the PR body. This completion notice requires no separate change. |
|
In response to this comment: ADR-73922 now exists with the requested sections and a PR-body link. It remains Draft pending maintainer review; named deciders or approval cannot be invented. |
|
In response to this comment: Both recorded findings have fixes and focused regressions on the current branch. The managed memory remains unchanged. |
|
In response to this comment: Confirmed: this completion notice needs no additional change. The two concrete findings have separate inline responses and regressions. |
|
In response to this comment: Confirmed: the failed review is not successful validation evidence. No additional change is needed for this status. |
|
In response to this comment: Confirmed: reported_no_action is not validation or publication proof. No further source change is requested. |
|
In response to this comment: Confirmed: focused regression coverage exists independently of the no-action notice. Validation results are not inferred from that notice. |
|
In response to this comment: Confirmed: the ADR artifact exists and the PR body links it. No separate change is needed for the completion notice. |
|
In response to this comment: Confirmed: the linked ADR covers the requested decision sections. Its status remains Draft with deciders unknown, not finalized or maintainer-approved. |
|
In response to this comment: Confirmed: current code covers branch-derived check permissions and separately revalidates mergeability, with regressions. The managed memory remains untouched. |
Correct check permission compatibility and map no-check reads, review ordering, check-name collisions, and scoped log minimization to the implemented regressions. Co-authored-by: Copilot App <[email protected]>
|
🎉 This pull request is included in a new release. Release: |


Why
The experimental merge handler evaluated one PR head but merged without an expected-head SHA, and missing GraphQL review data could be interpreted as no blocking reviews. Workflows also had no explicit CI or independent human-approval requirement for eligible unprotected integration branches.
Approach
required-checksandrequired-approvers. Named check runs must succeed on the evaluated revision. Approval requires at least one allowlisted human on that revision, excluding the PR author, bot accounts, and authenticated merge identity.checks: readfor branch-derived requirements even without configured checks; revalidate asynchronous mergeability separately from stable authorization inputs, with bounded read retries.create-check-runname. Review supersession uses validated submission times, not creation IDs, and missing/ambiguous ordering blocks authorization.The feature remains experimental. Existing targeting, repository allowlisting, max=1 default, protected/default branch refusal, open upstream PR requirement, and draft/conflict/reviewer/thread gates are preserved.
ADR: ADR-73922: Bind PR Merges to the Evaluated Head with Workflow-Owned Gates
Boundaries
The new CI and affirmative approval policies are opt-in; omitted policies do not imply successful CI or human authorization. Labels remain filters, not authorization. GitHub atomically enforces only the head SHA; other policy state retains a race window after final reads. Documentation explains credential separation, check-producer trust, and why reverting a merge does not undo downstream deployments or external effects.
No expected check producer is authenticated by name matching; ambiguous producers are rejected, but operators must protect CI publishers and workflow definitions.
checks: readremains necessary for runtime-discovered requirements; an empty requirement union does not query check runs or imply successful CI.Privacy-preserving debug records contain fixed events/phases, booleans, and counts, not identities, content, credentials, or raw errors. Label/pattern informational logs report counts; merge failure logs report status or phase while full diagnostics remain in untrusted results. These scoped controls do not establish that all operational logs or decision evidence are private, and
data_trust: untrustedis advisory, not prompt-injection isolation or sanitization.Validation