29 Nov 20269 min read

Who should approve AI-written code? Merge rules for teams using coding agents

Merge rules for coding agents: what GitHub, GitLab and Azure DevOps enforce, which changes an AI reviewer can approve, who signs the rest and what to log.

Two glowing blue branching trees on dark rocks, with a curving line of light running across still water between them

A coding agent that writes a change is its author, so it should not approve that change. A second party should, and for high-risk changes that party should be a named person. GitHub, GitLab and Azure DevOps can enforce this through branch rules and code owners. A written policy in the repository decides the rest.

Why are merge rules for coding agents a question now?

Several vendors now offer agents that approve pull requests as well as comment on them. Anthropic introduced Claude Ship on 23 Nov 2026. It pairs Code Review, already generally available, with two agents in beta, PR Steward and Claude Approvals. Claude Approvals applies an approval policy the team writes as a file in the repository.

On 17 Nov 2026 Microsoft said Copilot Code becomes generally available "in the coming weeks", letting staff describe an app and have Copilot build it, and our explainer covers when staff-built apps need engineers. Other tools already review code:

Three permissions are at stake: comment, approve and merge. An agent can comment freely. A policy has to assign the other two.

What do GitHub, GitLab and Azure DevOps already enforce?

All three support branch protection, meaning rules that stop a merge until set conditions are met, and all three route reviews by file path. On GitHub that is CODEOWNERS, a file naming who must review changes to which paths.

ControlGitHubGitLabAzure DevOps
Author approves own changeAuthors cannot approve their own pull requests"Prevent approval by merge request creator", on by defaultCreator's vote does not count unless "Allow requestors to approve their own changes" is on
Last pusher approves"Require approval of the most recent reviewable push""Prevent approvals by users who add commits", off by default"Prohibit the most recent pusher from approving their own changes"
New commits after approvalStale review dismissal"Remove all approvals when commits are added", on by default"Reset all code reviewer votes"
Reviewers by path"Require review from Code Owners"Code Owner approval on protected branchesAutomatically included reviewers

GitHub counts approvals from people with write or admin permission, and owners and admins can merge without one. Rulesets stack so the most restrictive rule applies, and bypass lists can include GitHub Apps. The "Allow GitHub Actions to create and approve pull requests" setting is off for new organisations, so check older ones. In Azure DevOps, bypass permissions defeat required reviewers, validation and status checks.

Why should the author not be the approver?

GitHub applies author separation to agents too: you cannot approve a Copilot pull request if you assigned Copilot to the issue.

SLSA v1.2 Source Level 4 says changes in protected branches "MUST be agreed to by two or more trusted persons prior to submission". SLSA defines a trusted person as a human. NIST's Secure Software Development Framework says self-review should complement review by others. The NCSC's Software Security Code of Practice guidance lists peer review by two or more people among its testing activities.

In a 2023 study by Perry and colleagues, participants with an AI assistant wrote less secure code and were more likely to believe it was secure. Anthropic's Code Review documentation says a review with no findings does not mean the code is secure.

Which changes can an automated reviewer approve, and which keep a named person?

The OWASP Code Review Guide says review intensity should vary with the risk a change presents. A written policy can let an automated reviewer approve low-risk classes and send the rest to a named person.

ChangeApproverBasis
Documentation and tests in low-risk paths, under a size limitAutomated reviewer, if the policy allowsPolicy choice. Google's review guide calls about 100 lines usually reasonable.
Dependency manifests and lock filesNamed personGitHub says Copilot code review does not review dependency files such as package.json.
CI and workflow filesNamed person through CODEOWNERSOWASP CICD-SEC-4 and GitHub's secure use reference for Actions
Agent instruction files such as CLAUDE.md, AGENTS.md and .mcp.jsonNamed ownerAnthropic's approval policy documentation tells teams to write rules for these files.
Authentication and secrets handlingNamed personPolicy choice. Anthropic says automated security reviews should complement manual code review.
Database migrations, the policy file and CODEOWNERSNamed personPolicy choice

How do you write an approval policy that can be audited?

A merge policy is one control inside the wider model for governing coding agents across an engineering team, and its rules should follow that model's risk tiers. A policy that can be audited has five parts:

  • A versioned file in the repository, so every rule change has a commit.
  • A named owner who approves changes to it, enforced through CODEOWNERS.
  • A scope: the repositories, branches and change classes an automated reviewer may approve.
  • Enforcement through branch protection or rulesets, so the platform blocks a merge the policy forbids.
  • Bypass rules: who may bypass, when, and who reviews each bypass afterwards.

What should you log for each approval?

Record the approver's identity, including bot accounts, the commit approved, the time, the policy version and any bypass. GitHub's pull request reviews API returns the reviewer, state, commit_id and submission time, and commit_id ties an approval to the code reviewed. To show which rules applied, record the commit of the policy file alongside each approval.

GitHub's organisation audit log records review submissions and dismissals, merges, ruleset changes and branch protection overrides. It keeps events for 180 days, and enterprise audit log streaming sends them to your own storage. Azure DevOps auditing is in public preview, off by default and keeps 90 days. It records policy bypasses, while approvals are read from the pull request.

Where to get help with merge rules

If you are commissioning custom software in the UK, name who approves merges into your repositories in the contract. SpotDev helps with setting up coding agents for an engineering team, including building your review policy into the tools' own controls.

In our engineering team subscription, every pull request is reviewed by an engineer and checked automatically for bugs and security issues before it merges. Where AI-written code shipped without a named approver, a security review of the AI-built app ends with CTO sign-off.

To discuss your merge rules, Request a Quote. Platform settings and vendor features above are as described when we checked on 28 Nov 2026.

Frequently asked questions

Can an AI approve a pull request?

Yes, on some platforms, and whether that approval counts toward a merge is a setting your admins control. Allow it only for change classes your written policy names.

Can the agent that wrote a change also approve it?

No. Treat the agent as the author and require a second party, with a named person for high-risk changes.

Which changes should keep a named human approver?

Dependency files, CI and workflow files, agent instruction files, authentication and secrets code, database migrations and the policy file itself.

What should we log for each approval?

Log the approving identity, the exact commit and the policy file version for every merge. Export platform audit logs before their retention window closes.

Written by

John Kelleher

John is the founder and the Chief Executive at SpotDev.