I measured my AI code reviewer instead of guessing, and most of my intuitions were wrong
I spent a few weeks building an automated pull-request reviewer at Mixmax. I had two ways to run it.
The first was a coding agent with a checkout. It could decide what to open, what to search for, and how much of the repository it wanted to inspect. The second was a normal API call to the same model. In that version, ordinary code assembled the context before the model saw anything.
I wrote down a prediction before I ran the comparison: the API version would be cheaper and better. I was half right. It was better. Cost barely mattered, and several other assumptions I had were wrong too.
Build the test before the thing being tested
The useful work came before the reviewer. I made a fixed set of real, merged pull requests, a runner that could apply any reviewer to all of them, and a grader that marked each finding as useful, noise, or wrong.
The set covers two very different repositories. One is an older application where much of the behaviour lives in convention and history. The other is a monorepo of small Lambda functions, where changes tend to stay closer to their own files. I also held some pull requests back, so I would have a small check against tuning the reviewer to the examples I knew best.
I call a reviewer plus its surrounding machinery a harness. A harness decides how the model gets context and what output it has to produce. Every harness in this experiment got the same context bundle: pull-request description, full diff, complete changed files within a token budget, and the relevant slice of a generated catalog of our services and events.
async function buildContextBundle(pr) {
const diff = await git.diff(pr.base, pr.head);
const files = await readChangedFilesWithinBudget(diff, TOKEN_BUDGET);
const catalog = await catalogSliceForPaths(diff.paths);
return { description: pr.body, diff, files, catalog };
}
That bundle was built with normal code. There were no model calls while assembling it. The only variable was the harness around the model. Without that constraint, I would have been comparing a model, a retrieval strategy, and a tool interface at once, then pretending the result told me something specific.
I held the review model constant too. The agent's default model happened to support structured API output, which made that possible. The grader came from a different vendor, so the reviewer was not judging its own work.
The agent was faster, and noisier
The first comparison covered sixteen reviews across the two repositories. The API harness won on the only metric that felt decisive: 4% of its findings were wrong or not worth saying. The coding agent was at 27%.
The agent was also 2.6 times faster. Both versions used about 8% of the per-pull-request budget I had allowed. In other words, the agent had a real speed advantage, but neither speed nor price was close to deciding the choice. I would have made the right selection for the wrong reason if I had stopped at my original prediction.
One review showed what was going on. The agent returned no inline comments and summarized the result as "No confident inline defects found." Its free-text section then described the same issue the API version had attached to a specific line.
The model had noticed the issue. The harness could not turn its caution into an inline comment. For a code reviewer, that distinction matters. A human reads an empty review as approval.
More tools made the reviewer worse
This was the result that bothered me most. I gave the API reviewer read-only tools for the service catalog. It could ask who owned a path or which services consumed an event. Then I ran the same setup with no lookups, five lookups, and fifteen lookups.
| Lookups allowed | Findings per PR | Useful | Noise | Cost per PR |
|---|---|---|---|---|
| 0 | 2.0 | 100% | 0% | $0.041 |
| 5 | 1.6 | 93% | 0% | $0.061 |
| 15 | 1.3 | 67% | 8% | $0.069 |
More exploration meant fewer findings, worse findings, more noise, and higher cost. It got worse at every step.
My best explanation is that the tool budget changed the job. The model spent attention deciding what to search for and making sense of what it found, instead of reading the change in front of it. The instruction to investigate competed with the instruction to review.
There is a real tradeoff here. Without lookups, the catalog was barely used. Five lookups produced eight findings that cited it, compared with three with no lookups. In a later, larger run, the count was 27 against 6. Tools improved cross-service awareness. They just gave up more than they returned at this quality bar.
Asking it to be quiet removed useful comments
Many pull requests in the set are deliberately boring: version bumps, config edits, file moves. For those, no review is correct. I expected an explicit instruction that finding nothing is fine to reduce noise.
It did not. Recall fell from 56% to 36%, and usefulness fell from 92% to 88%. It suppressed valid findings without buying precision. I dropped the prompt change.
Recall here is the share of reference findings the reviewer produced. Those figures came from different experiments with different reference sets, so the comparison inside one experiment matters. A 36% recall number from one run cannot be compared directly to a 21% number from another.
The verifier fought the reviewer
I also tried a second pass. It took each initial finding and removed it unless it could point to concrete proof in the diff. I was convinced this would help.
It removed 6% of findings, compared with 8% in the version without that check, and recall still lost six points. Reading the prompts side by side explained it.
The review prompt asks for cautious language. "Could this be null here?" is safer than declaring that it is null when the reviewer might be wrong. The verifier treated that caution as lack of evidence. I had written two individually reasonable prompts a week apart that disagreed about what a good comment looked like.
The scores found the conflict. The prompt files did not.
Two corrections I had to make
I initially said the agent sometimes hung because two runs took 20 and 40 minutes. That was my runner. The agent reads extra instructions from stdin when stdin is a pipe. My runner left the pipe open, so the process waited for input forever. The first smoke test had even printed "Reading additional input from stdin..." and I missed it. My manual checks looked fine because nohup and </dev/null close stdin. Actual runtime was 30 to 90 seconds.
I also compared two independently sampled runs and described the difference as the effect of a configuration change. It was run-to-run variance. That mistake was mine as well.
One of the sixteen reviews failed after trying to parse an HTML gateway error as JSON. The client now reads the body as text, parses defensively, and retries 429s, 5xx responses, and invalid responses with backoff over four attempts. I left that run as zero findings in the results, so the averages are slightly pessimistic.
What I kept
Increasing reasoning effort did help a little. Recall rose from 15% to 21%, and catalog-cited findings rose from 3 to 5. It doubled cost and runtime, but the resulting cost was still only 12 times below the per-review cap. That was an easy trade.
The changes I cared most about, tool access and prompt wording, did not move recall in a useful direction. One pass over a diff has a limit. Getting past it needs better context and retrieval, not more elaborate instructions.
The first comparison cost about $5. By the time the wider round was settled, I had spent roughly $48 of a $100 allowance. Re-running the full suite for a new model should take an afternoon and around $20.
The configuration will not stay best for long. The test setup is what I wanted. It caught four of five assumptions I had walked in with, and it gives me a cheap way to find out which assumptions are wrong next time.