All posts

AI Engineering

After AI Repairs CI, Who Approves the Merge? Defining Agent Merge Boundaries

Separate automated repair from merge authority with a small, independently tested Node.js policy example inspired by GitHub Agent Merge. Reject stale checks and approvals.

Published and maintained by Sambro · Report a correction

7 min read Agent MergeGitHub ActionsCoding agentsCode review

A repair changes the code you need to examine

An agent repairs a failing CI job and pushes another commit. The pull request shows green checks and an approval. Before accepting the change, ask what those signals cover. Did the checks run against the repaired code? Was the approval given before the repair? Did permission to fix the failure include permission to merge?

Automated repair may reduce waiting, but every repair also creates changes to examine. This article separates repair authority, current-code checks, current-code approval, and merge authority. It combines official documentation with an independent executable exercise, rather than presenting a hands-on product review.

What the October 28 announcement establishes

GitHub announced Agent Merge integration into GitHub pull requests on October 28, 2026. Watch and fix lets users select failed Actions workflow repair, conflict resolution, or both. The announcement has no displayed individual byline; attribute it to GitHub. Source: github.blog — 2026-10-28-agent-merge-watches-and-fixes-pull-requests-in-the-cloud

The official documentation, checked October 30, 2026, distinguishes enabling Agent Merge from enabling auto-merge. Fork and stacked pull requests are unsupported, and access requires paid Copilot plus applicable policy permissions. This is living documentation: check it again before adoption. docs.github.com — watch-and-fix-pull-requests

The mergeEligible field below means only that our example policy accepts its input. It is not a query of GitHub mergeability, authenticated user permissions, or server-side protection rules.

Make a small policy explicit

The example uses fictional revision identifiers r1 and r2. The required checks, unit and build, are fixed in code so an input cannot remove requirements by sending an empty list. Each check must have exactly one successful record for the current revision. Duplicate current records are rejected because the example cannot determine which run is authoritative.

readyForReview means only that those two checks passed. It is a convenient review-start signal, not proof of correctness. mergeEligible additionally requires approval for the current revision and explicit merge authorization. repairAuthorized remains independent: allowing a repair does not grant merge authority.

This educational policy is deliberately strict. It does not accept skipped or neutral as success. It does not reproduce GitHub status-check semantics, test merge commits, merge queues, CODEOWNERS, administrator exceptions, or inherited permissions. Do not install it unchanged as a production merge gate.

Run five states with different missing evidence

Save the example files decision.mjs, demo.mjs, and decision.test.mjs linked below in one directory. They require Node.js 22 or later, with no external packages or API keys. We ran the commands below on October 30, 2026 with Node.js 24.22.1; all 12 automated tests passed. Every input is synthetic and hand-authored, not a real pull request or model response.

repair_only has successful current checks but lacks approval and merge authority. old_evidence points both checks and approval at the previous revision. old_approval has current checks but an outdated approval. no_merge_authority has current checks and approval but lacks merge permission. Only complete satisfies every condition in this example.

The commands evaluate state and run tests. They do not push a branch, call the GitHub API, or merge a pull request. The results.json file linked below preserves the observed output.

Evaluator: agent merge — decision.mjs · Demo: agent merge — demo.mjs · Tests: agent merge — decision.test.mjs · Recorded output: agent merge — results.json

Run the downloaded example files
node demo.mjs
node --test decision.test.mjs
Summary of the observed output
case                 readyForReview  mergeEligible  reason
repair_only          true            false          APPROVAL, MERGE_AUTHORIZATION
old_evidence         false           false          CHECK:unit, CHECK:build, APPROVAL
old_approval         true            false          APPROVAL
no_merge_authority   true            false          MERGE_AUTHORIZATION
complete             true            true           (none)

Do not turn malformed input into permission

Beyond the accepting case, the tests cover missing checks, stale approval, failed or pending checks, skipped results, and duplicate records. A string such as "false" can be truthy in JavaScript, so permissions must be actual booleans. Empty revision identifiers are rejected. A test also verifies that evaluation does not mutate the input.

These checks do not authenticate a reviewer. A local file containing approved: true is not evidence of identity or authority. A real integration would need trusted permission and review data, an explicit rule for selecting authoritative check runs, and a fresh version check immediately before execution. This example implements neither that integration nor an atomic merge operation.

Review repository settings before enabling repair

GitHub documents separate options for dismissing stale approvals and requiring another person to approve the most recent reviewable push. Choose deliberately after examining the rules applied to your repository. Do not assume our revision-equality policy is GitHub's default for every repository. Official explanation: docs.github.com — about-protected-branches

For an initial trial, choose a low-risk pull request, constrain the repair scope, and have a person examine the resulting diff and new checks. Look for deleted tests, expected values changed to match incorrect behavior, or edits to workflow permissions and deployment steps. These are our operational recommendations, not guarantees made by the product.

A concise record can name the authorized repair scope, last inspected code revision, check coverage and results, approval target, and merge decision owner. Mark an unverified item as unverified. An agent saying it has finished does not fill in missing evidence.

What we verified, and what remains outside the exercise

We verified that a small policy function accepts and rejects synthetic inputs according to its stated rules and passes 12 regression tests. We did not measure Agent Merge repair success, time savings, or the safety of actual CI and deployment. We did not enable the feature or change repository settings.

Write down the path that permits an agent to repair code separately from the path that accepts the change. That gives reviewers a more useful question than whether a screen is green: which evidence covers which code?

Back to Sambro Blog