A&A INSIGHTS
Naming a code owner does not require their approval: what to check before AI opens pull requests against your repo
For teams that receive AI-generated pull requests. Using GitHub's own CODEOWNERS and branch protection documentation as the lens, this article separates review routing from required approval and lists what an integration lead should verify per repository.
日本語で読むTHE STARTING POINT
Adding a code owner to CODEOWNERS makes GitHub automatically request their review, but by itself it does not prevent a merge without that approval. Using GitHub's official CODEOWNERS and branch protection pages, this article proposes that teams receiving AI-generated pull requests verify the routing configuration and the required-approval configuration as two separate concerns. A hypothetical configuration change illustrates three places where the two commonly drift apart.
"A name is written" and "approval is required" are two different settings
Hypothetical example
Imagine a small development team that runs an AI coding agent to open small pull requests. A person cannot read every line, so the team writes owners into CODEOWNERS for each file the agent touches, expecting reviews to reliably reach the responsible person. This is a hypothetical situation. A few weeks later, while the owner is on leave, a pull request touching a file that names them as owner is merged without their approval. The team put a CODEOWNERS entry in place, so a natural question follows: why was the merge not blocked?
From the sources
GitHub's own documentation on code owners states that code owners are automatically requested for review when a pull request modifies code they own. The same document notes that once required reviews are enabled by an administrator or owner, they can additionally require approval from a code owner. The two capabilities are described in the same section but are separately configured.
A&A perspective
A&A's reading is that there is a step between those two sentences. CODEOWNERS decides where a review request is sent; whether an answer comes back, and whether an approval is required to merge, is decided by a different setting. Teams that treat both as the same operation feel protected the moment they add a name and only discover later that they were not. The trigger for that discovery is often a merge that should have been blocked.
Required approval is turned on explicitly in branch protection, not in CODEOWNERS
From the sources
GitHub's documentation on protected branches says that when a branch protection rule requires reviews from code owners, any pull request that affects code with a code owner must be approved by that code owner before the pull request can be merged into the protected branch. The mere presence of a CODEOWNERS file does not activate that gate; the branch protection setting does.
A&A perspective
In deployments where an AI agent opens pull requests, repositories are often added without rechecking this two-layer relationship. When a template repository is copied to create a new repository, the CODEOWNERS file is duplicated, but the branch protection configuration is not automatically the same as the source. What appears to be a horizontal rollout can therefore mix repositories where required approval is enforced with repositories where it is not. The integration lead has to inspect the CODEOWNERS contents and the branch protection settings on the target branches as two separate pieces of evidence.
A&A perspective
The shortest way to check this in practice is to open the branch protection rule for the relevant branch in the GitHub UI and look at whether the item that requires review from code owners is enabled. When the newer repository ruleset feature is used at the organization level instead, verify that the equivalent required-review item is present under whatever label the UI shows today. Do not decide from a documentation snippet; have the person responsible open the actual settings for the target repository and read them.
Patterns are evaluated last-match-wins
From the sources
GitHub's documentation on code owners states that pattern order matters and that the last matching pattern takes the most precedence. When a single file matches several lines, the owners chosen as recipients are those of the pattern that appears last in the file among the matching ones.
Hypothetical example
A hypothetical example makes this concrete. Suppose the CODEOWNERS file lists `*.ts @web-team` near the top and `packages/payments/** @payments-team` further down. When an AI agent opens a pull request that modifies `packages/payments/api.ts`, the review request goes only to `@payments-team`. The `@web-team` line above it does not add to the recipient list. To route to both teams, CODEOWNERS syntax requires listing both owners on the same line. If order and per-line owner listing are not reviewed before an AI starts opening pull requests that cross module boundaries, requests may quietly stop reaching the reviewer the team assumed.
From the sources
The same code owners documentation notes that for code owners to receive review requests, the CODEOWNERS file must be on the base branch of the pull request. Adding or editing CODEOWNERS on the topic branch alone does not change routing for that same pull request.
A&A perspective
It is technically possible for an AI agent to submit a pull request that adds CODEOWNERS on its own working branch, but that pull request itself is reviewed while the base still does not carry the file. Routing based on the new entries only takes effect from subsequent pull requests, once the change is merged into the base. Changes that edit ownership records therefore need the base branch's own protection to be in place first, so that the ownership change itself is subject to required approval.
Three places where AI-driven pull requests slip through
A&A perspective
In teams that run AI agents daily, when CODEOWNERS and branch protection drift apart, merges start happening without the intended reviewer seeing them. Three drifts are common. First, CODEOWNERS is populated, but the branch protection option requiring code owner review is off. Second, code owner review is required, but the required approval count is one, so a colleague who is not the owner can approve an AI-authored pull request and unblock the merge. Third, the CODEOWNERS pattern order has not been updated to reflect a change in team responsibility, so the last-match owner is still the previous team.
A&A perspective
None of these are AI-specific defects; the same drifts can arise for human-authored pull requests when the two-layer meaning of these settings is not understood. What AI changes is the frequency: an agent that opens many small pull requests per day exposes the drifts sooner, which is an operational advantage if the team notices. The integration checkpoint that turns this into an advantage is a review, at introduction time, in which the target repository's CODEOWNERS, the target branch's protection settings, and the most recent merged pull requests' approver lists are read side by side.
Hypothetical example
In the same hypothetical team, imagine the AI is configured to open both documentation typo fixes and edits to a payments module. If the required approval count was set to one to match the pace of documentation changes and the same setting is inherited by the branch on which the payments module lives, a payments change can be merged with a single non-owner approval. Because branch protection can be configured per target branch, treat branches that carry higher-risk code separately: require code owner approval, raise the required approval count, and re-check both when responsibilities move.
A verification checklist for the integration lead
A&A perspective
Before turning on wider AI-driven changes, verify four items on each target repository. First, CODEOWNERS lives on the base branch and the intended owner appears in the pattern that matches last for the paths in question. Second, the target branch's protection rule or ruleset has required review enabled and code owner review specifically required. Third, the required approval count matches the risk of the code that branch carries. Fourth, open a handful of the most recently merged pull requests and confirm that the required approvals were actually present at merge time. Widen the AI's scope only after all four pass.
A&A perspective
This checklist tends to surface a separate operational question: how many owners really exist for each area, and what happens when they are on leave. Tighter required approval means merges pause when the owner is unavailable. That pause is desirable in some cases and too costly in others, and the trade-off is a business decision, not a security default. Because CODEOWNERS can name a team rather than an individual, moving from a single person to a small team as the owner preserves the safety property while reducing single-point-of-failure pauses. Treat the settings as something to revalidate against merge history whenever they are changed.
A&A perspective
A&A's suggestion for a small development team is to fill in the four items as a single-page table for each repository before broadening AI's remit, and to fix drifts starting with the repositories where AI is most active. It is more productive to complete one repository than to leave many partially covered. Our related article "After AI says the work is done, how do you actually verify the business outcome" extends the same separation of layered checks to the moment when a person confirms an execution result.
Writing an owner into CODEOWNERS does not by itself require that owner's approval before a merge. Required approval lives in branch protection or in a repository ruleset, and CODEOWNERS is only the routing side. Teams receiving AI-driven pull requests should verify routing and required approval separately, and vary the strictness by target branch and by the risk of the code that branch carries.
Sources & editorial note
Primary pages read for this article. Publication dates below belong to the sources; access dates record our research.
- About code owners
GitHub Docs · Publication date not stated on page
Accessed 2026-09-17 - About protected branches
GitHub Docs · Publication date not stated on page
Accessed 2026-09-17
AI-assisted editorial production
A&A uses AI for research, writing, translation and editorial checks. Source facts, our analysis and hypothetical examples are labeled separately.
Editorial check: 2026-09-17