How to review an agent-written PR
How do you review an agent-written PR? Review it the same way you review a human one, with more attention on what the diff does not show. Confirm the contract, find callers the patch did not touch, read the tests against that contract, and treat the agent's summary as a claim rather than as evidence.
Agents are good at making a pull request look finished. The summary is tidy, the tests are new, and the diff compiles. The misses are usually next to the change, not in it. That is the same gap as a diff-only review, and it shows up more often when the author never opened the other files.
What do agent-written pull requests usually miss?
They usually miss callers, tests, and comments outside the files the agent edited. The change can be correct in the files you see and still break a path the agent never opened.
Typical shapes:
- A function was renamed or its arguments changed, and a caller in another package still uses the old shape.
- A new branch was added, and the existing tests still pass because they never hit it.
- The agent updated a comment in the file it edited, and left a stale one in a guide or an
AGENTS.mdthat still describes the old behavior.
None of these requires bad intent. The agent did the work it could see.
How do you review an agent-written PR?
Work through the change in this order. Stop when a step fails, and only then go back to the diff.
- Read the contract, not the summary. In one or two sentences, say what must still be true after the merge: the return value, the error cases, the callers that should keep working. Write that down before you read the agent's description, so you are not talked into a weaker check.
- Skim the diff for the real change. Ignore reformatting. Find the functions, types and schema that actually moved.
- Find callers the patch did not touch. Search is a start, and it fails when the call goes through an alias, an interface or a re-export. A code graph is built for this question. Code change blast radius walks through the query.
- Read the tests against the contract. Do they fail if the new behavior is wrong, or do they only confirm the agent's own helper? If this is a refactor, check for a silent behavior change, as in how to detect a behavior change in a refactor PR.
- Check the claims. If the summary says "all callers updated" or "no behavior change," go prove it. A graph-grounded review can help, and a person still has to accept the result.
- Leave comments about the code. Name the file, the line and the behavior you want changed. The fact that an agent wrote the patch is not useful in the comment thread.
If you only have time for one pass, do steps 1, 3 and 4. That is where agent-written PRs usually break.
Should you review agent-written code more strictly?
Review the risk, not the author. A small, well-tested change can be read quickly. A refactor that touches a busy function needs the callers and the tests, whoever wrote it.
A useful rule of thumb: the more the agent claims to have finished, the more you should look outside the diff. A long "I updated every caller" paragraph is a prompt to go list the callers yourself.
How can a code graph help in the review?
A code graph answers who calls a function, what a change reaches, and which tests sit on that path, with file and line. That is the part a diff-only review cannot see.
The Graphify CLI builds that graph locally and serves it to you or to an agent:
uv tool install --python 3.12 graphifyy
graphify update .
graphify affected "the_function"graphify affected walks backward from a symbol and lists the importers and callers it finds. If the name appears in more than one file, the CLI lists the candidates and asks you to pick one. The install guide covers setup, and the hosted app is at app.graphify.com if you want the same map for the whole team.
Use Graphify in your agent
Add Graphify to ChatGPT, Claude, Cursor and more in one click.