Repository navigation
feat: enforce protected files for merge-pull-request - #76771
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
✅ 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.
|
|
✅ PR Specification Reviewer completed successfully!
|
This comment has been minimized.
This comment has been minimized.
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
✅ 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 — ADR RequiredThis PR makes significant changes to core business logic (>100 new lines) but does not have a linked Architecture Decision Record (ADR). Evidence: 121 added lines in business-logic directories ( 📄 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.
Reviewed PR head 960ea62 against safe-outputs specification 1.29.22 and related protected-file contracts. The implementation and tests substantively align: default-blocked complete changed-file inspection, rename old/new paths, fail-closed malformed/incomplete/count limits, and final revalidation. Synchronized docs/src/content/docs/specs/safe-outputs-specification.md to version 1.29.23 with metadata and changelog updates; the specification-only commit was queued to the same-repository PR branch. No blocking conformance findings identified.
Generated by PR Specification Reviewer for #76771 · copilot · gpt50 · ~8 AIC · ⌖ ~2 AIC · ⊞ 1.6K
Comment /review-specs to run again
There was a problem hiding this comment.
Reviewed the changed lines and relevant implementation paths. I found no actionable correctness, security, performance, or maintainability issues requiring a blocking comment. This was a static review; tests were not run.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~8 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /tdd, /diagnosing-bugs, and /grill-with-docs. Requesting changes for one confirmed correctness bug. The fail-closed design is sound.
📋 Key Themes and Highlights
Blocking
- Import exclusions dropped for merge-pull-request (inline on
safe_outputs_handler_registry_pull_requests.go).MergeSafeOutputsonly re-applies accumulatedprotected-files.excludefor create and push types. A temporary repro confirmed it: the create-pull-request control kept its exclusion, and merge-pull-request returned an empty list.
Non-blocking
- Changeset bump and migration (inline on
.changeset/merge-protected-files.md). This is default-on, so it should state the migration path and confirmminorvsmajor. - Test mock ordering (inline on
merge_pull_request.test.cjs). SequencedlistFilesmocks can shift silently. Assert the pagination call count. - Debug playbook gap.
.github/aw/debug-playbook.md(around line 203) lists merge failure codes but omitsprotected_files_modified, so operators get no remedy for this new block. - Summary advice gap.
safe_output_summary.cjs(line 395) gives tailored advice only formanual_review_caution. Consider the same forprotected_files_modified.
Positive Highlights
- ✅ Fail-closed on malformed, partial, or over-3000 file evidence, and on unknown policy values.
- ✅ Checks both rename sides and re-evaluates the file list at final revalidation.
- ✅ Reuses the create-pull-request protected set, so the two stay consistent.
@copilot please address the review comments above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~12 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again
There was a problem hiding this comment.
🟡 Changes recommended
Dynamic protected-file expressions lack JSON-safe serialization, risking configuration corruption or merge-gate overrides, and merge handlers silently discard imported exclusions.
2 open issues
What changed in this PR
Adds live protected-file enforcement to gh-aw’s merge-pull-request safe output, supplementing caution notices while preserving existing merge gates.
Changes:
- Checks complete PR file lists, including deletions and rename paths, and repeats protection checks before merging or staged previews.
- Adds shared protection rules, scoped exclusions, and a trusted
allowedopt-out through schema and compiler configuration. - Expands tests, audit codes, tool descriptions, documentation, and release notes.
| File | Description |
|---|---|
pkg/workflow/safe_outputs_validation_merge_pull_request_test.go |
Tests policy parsing and handler defaults. |
pkg/workflow/safe_outputs_handler_registry_pull_requests.go |
Emits merge file-protection configuration. |
pkg/workflow/merge_pull_request.go |
Parses and validates protection policies. |
pkg/workflow/js/safe_outputs_tools.json |
Updates the embedded merge tool description. |
pkg/workflow/compiler_safe_outputs_config_protection_test.go |
Tests compiled exclusions and shared protection rules. |
pkg/parser/schemas/main_workflow_schema.json |
Defines supported policies and exclusions. |
pkg/parser/schema_test.go |
Extends exclusion validation to merges. |
pkg/parser/schema_merge_pull_request_test.go |
Tests accepted and rejected policy forms. |
docs/src/content/docs/specs/safe-outputs-specification.md |
Specifies file-inspection and revalidation requirements. |
docs/src/content/docs/reference/safe-outputs-pull-requests.md |
Documents defaults, exceptions, and limitations. |
actions/setup/js/safe_outputs_tools.json |
Updates the runtime merge tool description. |
actions/setup/js/safe_output_manifest.cjs |
Registers the protected-file failure code. |
actions/setup/js/merge_pull_request.test.cjs |
Covers protected paths, evidence validation, and rechecks. |
actions/setup/js/merge_pull_request.cjs |
Implements live file inspection and final revalidation. |
.changeset/merge-protected-files.md |
Adds a minor-release changeset. |
Review effort: Max (auto)
Preserve imported exclusions, minimize protected-file diagnostics, strengthen revalidation tests, document breaking migration, and complete the ADR. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Regarding the Ponytail Reviewer completion notice: no code change is requested by this notification. I treated |
|
Regarding the specification review: the normative protected-file rules were already present, but the reported version synchronization was not on the branch. Updated the specification metadata and history to 1.29.23 without changing those rules. |
|
Regarding the ADR draft notification: reviewed and completed the generated ADR's context, decision, alternatives, and consequences. The record distinguishes implemented user direction from maintainer sign-off that has not been recorded. |
|
Regarding the skills-based review: addressed import exclusions, migration/versioning, and endpoint-specific pagination assertions. Added |
|
Regarding the code-quality review: no code change is requested by this completion notice. The follow-up fixes have focused regression coverage; the final gate separately reports existing custom-linter violations in unchanged portions of |
|
Regarding the Test Quality Sentinel notice: |
|
Accepted the ADR gate feedback. Completed ADR-76771, removed unsupported historical and validation claims, and linked it in the PR body without claiming unrecorded maintainer approval. |
Use raw toJSON expressions for merge policies and cover quoted input in both generated configuration paths. Add the rooted imported-exclusion regression. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Regarding the Ponytail completion notice: this was already acknowledged in the previous batch and requests no further code change. |
|
Regarding the specification completion notice: the prior fix already synchronized the protected-file specification metadata and history to 1.29.23. No additional specification change is requested here. |
|
Regarding the ADR draft notification: the draft was completed in |
|
Regarding the skills-review completion notice: the import, migration, pagination-assertion, and diagnostic-guidance fixes from the previous batch remain in place. No additional change follows from this repeated completion notice. |
|
Regarding the code-quality completion notice: no further implementation change is requested. Static review and focused execution results remain separate evidence. |
|
Regarding the Test Quality Sentinel notice: no new change is requested by this repeated notification. The serialization and import cases are evaluated with focused tests rather than inferred from |
|
The ADR gate request is already addressed: ADR-76771 has completed context, decision, alternatives, and consequences and is linked in the PR body. No new ADR revision is needed for this repeated request. |
|
No further change is requested by this earlier acknowledgment. Its distinction between a no-action notification and actual validation evidence remains applicable. |
|
This earlier response is already reflected in the branch: specification version 1.29.23 and its history entry remain present. No additional version bump is needed for acknowledging the same review. |
|
The completed ADR described in this earlier response remains unchanged. It continues to distinguish the implemented decision from unrecorded maintainer approval. |
|
The fixes listed in this earlier response remain in place, including the major migration notice and protected-file operator guidance. This acknowledgment introduces no new implementation request. |
|
No additional change is requested by this earlier response. The existing custom-linter findings in unchanged portions of |
|
The pagination and path-minimization regressions described in this earlier response remain part of the branch. This batch adds focused validation for the new serialization feedback instead of treating review notifications as test evidence. |
|
The ADR completion and PR link described in this earlier response are already present. No further edit or claim of maintainer sign-off is warranted by this acknowledgment. |
|
🎉 This pull request is included in a new release. Release: |


Why
merge-pull-requestpreviously relied on protected-file caution notices rather than inspecting actual changes. A PR without those notices could merge protected files into an otherwise eligible feature branch.Approach
create-pull-request, including repository-wide exceptions and the defaultCHANGELOG.mdexception.protected-files: allowedas an explicit workflow-owned opt-out and object-form scoped exclusions. Creation-specificrequest-reviewandfallback-to-issuepolicies are intentionally unsupported. Existing caution, branch, and review gates remain enforced;required-approversremains optional.toJSON(...)values in both handler-manager and MCP configurations, preventing quoted or multiline input from overwriting sibling merge gates.Migration
This changes existing behavior and carries a major changeset. Workflows that intentionally merge protected files must configure scoped
protected-files.excludeexceptions or explicitly setprotected-files: allowed, then recompile; otherwise keep the default and merge those PRs manually. The opt-out does not bypass caution notices or other gates.ADR: ADR-76771: Enforce Protected-File Checks for merge-pull-request
Validation
make agent-report-progressgate remains blocked by the same 12 pre-existing custom-linter diagnostics in unchanged portions ofpkg/workflow/imports.go.Limitations
GitHub atomically enforces only the evaluated head SHA. File inspection and other mutable policy reads do not eliminate the race window between final revalidation and the merge API call. No live merge or workflow dispatch was performed. The ADR records implemented user direction without claiming unrecorded maintainer sign-off.