When an AI coding agent writes the diff, the pull request review becomes the point where a person decides whether the change is right. Reviewing AI-generated code in pull requests uses the same skills as any code review, but the emphasis moves: less on style, which tools and agents handle well, and more on intent, scope, tests, and dependencies. This article is a checklist for the senior engineer who approves the merge.

What changes when an agent writes the diff

Three things change, and each one affects how you review.

There is more code to review. A Codacy article on agents and review puts it plainly: "Human review cannot simply scale linearly with AI-generated output." Review capacity becomes the bottleneck, and the risks it lists are familiar: reviewer fatigue, shallow checks, and over-trust in output that usually looks fine.

The code looks right more often than it is right. In Sonar's State of Code developer survey of more than 1,100 developers, as reported by The Register, 53 percent named code that looks correct but is not as a drawback of AI tools, and 38 percent said AI-generated code takes more effort to review than code written by people, against 27 percent who said less. Only 48 percent said they always check AI-assisted code before committing it. Sonar sells code verification tools, so read the figures with that in mind.

The author cannot explain its intent the way a colleague can. You cannot ask an agent what it was thinking yesterday. The reference for the review is the specification the agent worked from, not the agent's own summary of what it did.

Responsibility does not move. OpenAI's guide to building an AI-native engineering team states that "engineers ultimately own the code that is deployed to production," even when an agent does the first review pass.

A checklist for reviewing AI-generated code

Google's public code review guidance says reviewers may sometimes scan over generated code, but should not scan over a human-written class or function and assume it is fine. That rule was written for the output of code generators. Code from an AI agent is not mechanical output: review it with the care the guide asks for human-written code, and make sure you understand what all of it does.

Go through these points in order. The first ones are the cheapest and catch the most.

  1. Does the change match the specification? Compare the diff with the acceptance criteria, one by one. Check that it does what was asked, and nothing that was not.
  2. Is the diff limited to its task? Agents tend to tidy up nearby code, rename things, or reformat files. Unrelated changes hide the real one and should go into their own pull request, or nowhere.
  3. Does it fit the existing design? The OpenAI guide asks reviewers to focus on architecture: whether the work follows the codebase's patterns and conventions. Look for a second way of doing something the codebase already does, such as a new HTTP client, a new date utility, or a new error type.
  4. Does it reuse what exists? Agents often write a helper that already exists elsewhere in the repository. Search before you approve.
  5. Are the edge cases and errors handled? Empty inputs, missing data, timeouts, retries, concurrent updates. Check what happens when an external call fails, not only when it succeeds.
  6. Is it as simple as the problem? Google's guide warns against over-engineering: solve the problem that needs solving now. Extra configuration options and abstractions with one implementation are a common sign.
  7. Do the names and comments tell the truth? A comment that describes what an earlier version of the function did is worse than no comment.

Tests the agent must add

Tests written by the same agent that wrote the code need their own review. The OpenAI guide warns that engineers must check model-generated tests closely to make sure the agent did not take shortcuts or write stubbed tests. It suggests having the agent write the tests in a separate session from the implementation, and checking that new tests fail before the feature work begins.

The question to ask comes from Google's guide: "Will the tests actually fail when the code is broken?" In practice:

  • Each acceptance criterion has a test. You should be able to point from a line in the specification to the test that proves it.
  • Existing tests were not weakened. Look at every changed or deleted assertion in the diff. A test that was edited until it passed is a bug report, not a fix.
  • The code under test is not mocked away. A test that mocks the component it is meant to test proves nothing.
  • Break it once. For an important change, revert one line of the implementation locally and run the tests. If nothing fails, the tests are not testing that line.

Security checks

Some risks are more frequent when an agent writes the code, and some are specific to it.

Dependencies that should not exist. A study presented at USENIX Security 2025 generated 576,000 code samples in two programming languages and found that, on average, at least 5.2 percent of the packages suggested by commercial models and 21.7 percent of those suggested by open-source models were hallucinated: packages that do not exist. It counted 205,474 unique hallucinated package names. A name that does not exist today is a name someone can register tomorrow. For every new dependency, check that it is the package you think it is, that it is maintained, that the version is pinned in the lock file, and that the codebase really needs it.

The usual suspects, checked on purpose. Secrets in code or configuration, missing authorisation checks on a new endpoint, unvalidated input reaching a query or a shell command, personal data written to logs, and changes to CI pipelines or deployment files. These are not new, but a reviewer reading a large, tidy diff is more likely to miss them.

The right reviewer. Google's guide asks for a qualified reviewer for areas such as privacy, security, concurrency, accessibility, and internationalisation. That applies even more when the author is an agent.

Automated checks before a person reviews

People should spend their review time on what machines cannot judge. Linters, type checks, the test suite, dependency scanning, and an automated review comment on each pull request can run before anyone opens the diff. The Codacy article notes that being seen by a person "is not enough unless review is supported by consistent automated enforcement." The OpenAI guide adds that automated review has to be tuned for high-signal feedback, because noisy output gets ignored.

For one way to run an automated review on every pull request without blocking it, see PRmate.

When to reject

Rejecting an agent's pull request is cheap: the work goes back with a reason, and the agent tries again. Reject, or send back for changes, when:

  • you cannot explain what the change does after reading it;
  • the diff is too large to review properly, so ask for smaller changes;
  • it does not match the specification, or adds what was not asked for;
  • tests were weakened, or the new tests would pass without the new code;
  • it adds a dependency nobody can justify;
  • it touches security-sensitive code and no qualified reviewer has seen it.

When the same reason comes up twice, add it to the specification or to the instructions the agent works from. The next pull request then starts from a better place.

How we can help

We do product development with AI coding agents: the agents write code and tests in small changes, and our engineers review the changes and run the tests. Work that is not right goes back to the agents.