Why AI Code Needs Human Review and How to Review It
By Shye Uy

AI code needs human review because code written by an AI coding agent usually compiles, passes its tests and reads cleanly, which removes the signals reviewers have long relied on to spot weak changes. What it does not guarantee is that the code solves the problem in the ticket, that its tests would catch a real failure, or that it respects constraints the agent was never told about.
Reviewing AI-generated code therefore means less time on style and syntax and more on verifying intent, tests and failure modes. AI-generated pull requests also call for review rules written specifically for agent-authored changes.
Key Takeaways
- AI-generated code needs human review because clean, compiling code with passing tests can still solve the wrong problem, cover only the happy path, or rest on assumptions nobody stated.
- Tests written by the same agent that wrote the code tend to confirm what the code does rather than what it should do, so they are evidence to check, not proof.
- An efficient review order for agent pull requests is intent first, tests second, edge cases and error handling third, and style last.
- Pull requests that are too large or that change things outside the ticket's scope should be sent back before line-by-line review, whoever wrote them.
- Teams get the most from agents when they set explicit rules for size limits, labeling agent-authored changes, independent tests and human sign-off.
Why AI Code Needs Human Review
AI code needs human review because the qualities an agent reliably produces (code that compiles, tests that pass, names that read well) are not the qualities that make a change correct. Google's engineering practices guide, What to look for in a code review, puts design and functionality first: does the change belong in the system, and does it do what the author intended in a way that is good for its users. An agent-authored pull request (a pull request whose code was written by an AI coding agent rather than typed by the engineer who opened it) can look finished on every surface signal and still fail both questions.
The pattern shows up in four recurring ways. None of them is unique to AI, but agents make each one cheaper to produce and harder to see.

Plausible code that solves the wrong problem
GitHub's own guide to reviewing AI-generated code tells reviewers to be skeptical of code that "looks right" but does not match their intent, and to watch for hallucinated APIs, ignored constraints and incorrect logic. It frames the core reviewer question as whether the code solves the right problem and follows the team's conventions. An agent optimizes for a change that satisfies its prompt; if the prompt or ticket was ambiguous, the result is a confident, well-formatted answer to a slightly different question.
Tests written by the same agent that wrote the code
When one agent writes both the implementation and its tests, the tests tend to encode the implementation's behavior rather than an independent statement of what should happen. Google's guide makes the general point directly: tests do not test themselves, and a human must ensure tests are valid. It asks reviewers whether the tests would actually fail if the code were broken. GitHub adds an agent-specific warning to watch for tests that are deleted or skipped instead of fixed, which is one way an agent can turn a red build green without fixing anything.
Assumptions nobody stated
Every implementation embeds decisions about business rules, input shapes, error behavior and user expectations. A human author can be asked why they made a choice; an agent's choices are often implicit in the diff. GitHub's guide suggests asking directly what assumptions about business logic, design preferences or user behavior the code makes. Dependencies are a special case: GitHub warns reviewers to check that suggested packages exist, are maintained and have compatible licenses, and to watch for hallucinated or suspicious packages.
Missing context about the system
An agent sees the files it was given or chose to read. It does not know which service is being deprecated next quarter, which table is under a migration freeze, or why an odd-looking workaround exists. Google's guide asks reviewers to consider a change in the context of the whole system and not to accept changes that degrade its code health, noting that systems become complex through many small changes that add up. It also warns specifically about over-engineering, code made more generic than needed or built for problems that do not exist yet, which agents can produce in volume because extra abstraction costs them nothing to write.
General review technique is covered in code review best practices, and cleaning up a codebase that has already absorbed unreviewed AI code is covered in vibe code cleanup.
How to Review AI-Generated Code: A Review Order
A practical way to review AI-generated code is to check intent first, tests second, edge cases and error handling third, and style last. That order puts the questions an agent cannot answer for itself at the front, and leaves the checks that tooling handles well for the end.

It builds on Google's guide to navigating a CL (changelist, Google's term for a pull request) in review, which starts with a broad view of whether the change makes sense at all, then the most important part of the change, then the rest, and notes that it can help to read the tests before the main code to understand what the change is supposed to do. For agent output, reading tests early is not optional: they are the clearest record of what the agent believed it was building.
Step 1: Confirm the intent matches the ticket
Before reading any code, compare the pull request description and the diff's footprint against the ticket or issue. Ask whether this change should exist in this form. Google's guide says that if a change should not have happened in the first place, the reviewer should say so immediately and suggest what to do instead, because reviewing the rest is wasted effort. For agent pull requests, this step catches the wrong-problem failure: a refactor where a bug fix was requested, a new abstraction where a one-line change would do, or files touched that the ticket never mentioned.
Step 2: Read the tests before the code
Read the tests as a specification and judge them on their own terms. Do they cover the behavior the ticket asks for, or only the behavior the implementation happens to have? Would they fail if the core logic were wrong? Google's guide asks exactly that: will the tests actually fail when the code is broken, and does each test make simple, useful assertions. Check the diff for removed, skipped or loosened tests, which GitHub's guide flags as a specific pitfall in AI output.
Step 3: Check edge cases and error handling
With intent and tests confirmed, read the main implementation for what happens off the happy path: empty and null inputs, boundaries, partial failures, retries, timeouts, concurrency and permissions. Google's guide asks reviewers to think about edge cases and concurrency problems even when the author has tested the change, and to get a qualified reviewer for complex areas such as security, privacy and concurrency. This is also where hidden assumptions surface, including new dependencies that need to be checked for existence, maintenance and license.
Step 4: Check style last
Style and naming still matter, but they are the cheapest category to fix and the one automated tooling handles best. Google's guide recommends prefixing non-blocking style suggestions with "Nit:" and not blocking changes on personal preference. Linters and formatters in CI should catch most of this before a human looks. AI code review tools such as Copilot code review can also run a first pass, but they do not replace the human checks in steps 1 to 3.
AI code review checklist
The table below turns the review order into an AI code review checklist a reviewer can work through on any agent-authored pull request. The failure column lists patterns described in Google's and GitHub's review guidance, not measured frequencies.
Review step | What to look for | Common failure in agent output |
|---|---|---|
Intent | The diff solves the problem in the ticket, in the scope the ticket describes | Code that looks right but answers a different or broader question than was asked |
Scope | Every changed file is explained by the ticket | Unrequested refactors, reformatting or new abstractions mixed into the change |
Tests | Tests assert the required behavior and would fail if the logic broke | Tests that mirror the implementation, cover only the happy path, or were deleted or skipped to pass CI |
Edge cases | Empty inputs, boundaries, concurrency, partial failures and permissions are handled | Missing error handling, swallowed exceptions or unhandled failure paths |
Assumptions and dependencies | Business rules, input shapes and new packages are explicit and verified | Unstated assumptions, hallucinated APIs, or packages that do not exist or have incompatible licenses |
System context | The change fits current architecture and plans, and does not degrade code health | Over-engineered or generic code, or changes to areas that are being deprecated |
Style | Naming, comments and formatting follow the team's guides | Comments that restate what the code does instead of why |
Reviewing AI-Generated Pull Requests at Team Scale
Reviewing AI-generated pull requests at team scale depends on rejecting some changes before anyone reads them line by line. When agents can open pull requests faster than people can review them, the reviewer's attention becomes the bottleneck, and a pull request that is too large or out of scope consumes that attention without producing a trustworthy review.
What to reject on size alone
Google's guide to small CLs states that reviewers have discretion to reject a change outright for the sole reason of it being too large, and to ask for it as a series of smaller changes. It defines the right size as one self-contained change that addresses just one thing and includes its related tests. It gives rough guidance rather than a hard rule: about 100 lines is usually reasonable, 1,000 lines is usually too large, and a 200-line change spread across 50 files would usually be too large as well.

The reasons Google gives for small changes apply with more force to agent output: small changes are reviewed more thoroughly, are less likely to introduce bugs, waste less work if the direction is wrong, and are simpler to roll back. An agent can produce a 1,500-line pull request as easily as a 50-line one, so the cost of splitting falls on the person prompting the agent, not on the reviewer.
Google does make one exception that teams sometimes stretch to cover agents: large changes generated by an automatic refactoring tool that the team trusts completely, where the reviewer only needs to confirm the change is wanted. A coding agent does not fit that description. A deterministic codemod produces the same output for the same input and can be trusted once; an agent's output has to be reviewed every time.
What to reject on scope alone
Scope problems are often easier to spot than size problems and just as disqualifying. Send the pull request back before detailed review when it:
- Mixes refactoring with behavior changes. Google recommends keeping refactorings in a separate change from features or bug fixes, and keeping major style or reformatting changes out of functional changes, because combining them makes it hard to see what actually changed and complicates rollbacks.
- Touches files the ticket does not explain. Every changed file should trace back to the ticket or the pull request description. Unexplained changes are where unstated assumptions live.
- Changes or removes tests unrelated to the task. Test changes outside the scope of the ticket need their own justification, and deleted or skipped tests are a specific pattern GitHub warns about in AI output.
- Changes CI or workflow configuration as a side effect. GitHub's documentation on reviewing Copilot's pull requests tells reviewers to be especially alert to proposed changes in workflow files, because workflows can be privileged and have access to secrets.
These rules apply regardless of who or what wrote the code. Stating them that way avoids a two-tier review culture in which agent pull requests get waved through or human ones get less scrutiny.
Read every line of agent-written application logic
Google's guide asks reviewers to look at every line they are assigned and to make sure they understand what all the code is doing, while allowing faster scanning of data files, generated code and large data structures. That exception is for genuinely generated artifacts such as lockfiles or compiled schemas, not for agent-written application logic. If an agent-authored pull request is too long to read every line, that is a size problem to send back, not a reason to skim.
Review Rules for Agent-Authored Code
The review rules that make agent-authored code manageable cover four things: how big a pull request can be, how agent work is labeled, where the tests come from, and who is allowed to approve. Writing these down matters because traditional review norms were designed for pull requests written line by line by the person who opened them.
GitHub's guide to reviewing AI-generated code recommends exactly this kind of documentation: record your best practices for reviewing AI-generated code, and use a CONTRIBUTING.md file to state your expectations for AI-generated source code. The rules below are a starting set to adapt.
Set a PR size limit
Pick a size ceiling and apply it to every pull request, with agent-authored ones held to it strictly. Google's guidance that about 100 lines is usually reasonable and about 1,000 lines is usually too large is a defensible starting point, along with its note that file count also affects a change's size. Pair the limit with a rule that refactoring, reformatting and behavior changes go in separate pull requests, since agents will happily do all three in one pass if the prompt allows it.
Label agent-authored changes and record provenance
Every agent-authored pull request should say so, and should say which parts the agent wrote. Provenance, in this context, means a clear record of where code came from: which agent produced it, from what prompt or ticket, and which parts a human wrote or changed afterward. Reviewers use that record to decide where to spend their attention.
Some tooling already provides part of this. GitHub's risks and mitigations page for Copilot cloud agent states that the agent's commits are authored by Copilot with the requesting developer as co-author, are signed, and include a link to the agent's session log in each commit message for review and auditing. For agents that do not do this automatically, a pull request label plus a short description section (what the agent was asked to do, what it changed, what the human changed) covers the same ground.
Require tests the agent did not write
At minimum, each agent-authored pull request should be checked against at least one test that did not come from the same agent session: an existing test suite that already covers the behavior, a test written by the human who opened the pull request, or an acceptance test derived directly from the ticket. Google's guide notes that independent test changes can go in their own change first, for example validating existing code with new tests before refactoring it, which gives teams a natural pattern: land the human-written or pre-existing test first, then let the agent make it pass.
This rule addresses the core weakness described earlier. A test suite written by the same agent that wrote the code is one system checking itself. GitHub's agent runs its own Copilot code review and security scans before finishing a pull request, which is useful, but it is still a check by the same platform and does not replace an independent statement of what the code should do.
Decide who signs off on agent pull requests
The person who prompted the agent should not be the only approver. GitHub builds a version of this rule into Copilot cloud agent: according to its documentation, the user who asked the agent to create a pull request cannot approve it, the agent cannot approve or merge its own pull requests, and when the agent opens a pull request under its own app identity, one additional approval is required if the repository already requires at least one. Teams using other agents can enforce the same principle through branch protection and code ownership rules.
Google's guide adds the second half: the best reviewer is the one who can give the most thorough and correct review, which usually means the owner of the code, and complex areas such as security, privacy and concurrency should have a qualified reviewer. For agent-authored changes to those areas, require the code owner's approval rather than any available approver.
The broader questions of whether teams should use agents at all and what agents mean for engineering careers are covered in will AI replace software engineers.
How Interviews Are Starting to Test Code Review
Some engineering interviews now address AI coding tools and code review directly, which is a practical signal of how the reviewer's role is being defined at those companies. Fonzi is a curated talent marketplace for software engineers, and the examples below come from jobs that companies list there.
Of 173 open jobs on Fonzi with a published interview plan as of November 2026, 3 companies use interview round names that address AI coding tools directly. One requires strong use of AI coding tools in its technical round, one runs an agentic coding exercise, and one bans AI help in a one-hour coding round. Separately, one company in the same set runs a dedicated live code-reviewing round as its second technical interview.
Those formats test different things. A round that expects AI tool use or an agentic exercise tests whether a candidate can direct an agent and judge its output under time pressure, which is the review order described above in compressed form: confirm the agent built what was asked, check whether its tests prove anything, and find the edge case it missed. A round that bans AI help tests the underlying skill without assistance. A live code-reviewing round tests review directly, and preparing for it looks a lot like practicing the checklist in this article on real pull requests: state the intent before reading the code, read the tests first, and explain which failure modes you would block on and which comments are only nits.
Reviewing AI-Generated Code: What to Do Next
AI code needs human review because passing tests and clean formatting say little about whether a change solves the right problem, tests what matters, or holds up off the happy path. Review AI-generated pull requests intent first and style last, and send back anything out of scope or too large, using Google's guidance that about 100 lines is usually reasonable and 1,000 lines is usually too large. Give your team written rules for size, provenance, independent tests and sign-off. Some engineering interviews now test this skill directly, through live code-reviewing rounds and agentic coding exercises. If you want to work on teams that hold agent-authored code to a real human review, sign up on Fonzi.
FAQ
Should I review AI-generated code differently from human-written code?
Apply the same standard, but change the emphasis: spend less time on style and syntax and more on whether the change matches the ticket, whether its tests would fail if the logic broke, and what assumptions it makes. Size and scope limits should apply equally to both.
Can I trust tests that the AI agent wrote for its own code?
Treat them as evidence to check rather than proof, because tests written by the same agent tend to confirm what the code does rather than what it should do. Require at least one test that did not come from the same agent session, and check the diff for tests that were deleted or skipped.
How large should an agent-authored pull request be?
Google's engineering practices guide suggests about 100 lines is usually reasonable and 1,000 lines is usually too large, with file count mattering too. Reviewers there have discretion to reject a change for size alone, and the same rule works well for agent output.
Can the engineer who prompted the agent approve its pull request?
It is safer to require a second approver, and GitHub enforces this for Copilot cloud agent by preventing the requesting user from approving the pull request. Other agents can be held to the same rule through branch protection and code ownership.
Do AI code review tools replace human review of agent pull requests?
No. Tools such as Copilot code review can run a useful first pass, but they cannot confirm that the change matches the team's intent or system context, which is the part of review that matters most for agent-authored code.



