Key takeaways
- ✓Keep the model fixed and change only the harness: what the reviewer is shown, what it can look up, and how it's asked. That answers the team's real question, buy a review tool or call the model ourselves, which a vendor comparison can't, because vendors change the model too.
- ✓A reviewer is a classifier. Recall is the share of planted bugs it finds; precision is the share of its bug comments that are right. In run 1: single prompt 22/30 and 69%, agent 24/30 and 71%, PR-Agent 19/30 and 82%. PR-Agent is a less sensitive smoke alarm: fewer comments that point at nothing, more missed fires.
- ✓The agent costs 0.97¢ a review against 0.49¢, and takes 10 s against 3 s (medians). Each step resends the conversation, but cached input is billed at a tenth of the price, so it's 2× and not 5×. All three write about the same number of bug comments: 0.8–0.9 per PR.
- ✓Compare reviewers paired, on the same bugs, averaged over runs. Agent minus single prompt: +2 points, 95% interval −8 to +13. Zero is inside, so on 30 bugs the two can't be told apart. PR-Agent minus single: −14 (−29 to −1), just excluding zero.
- ✓Same recall isn't the same bugs. The agent and the single prompt each found 2 bugs the other never found in any run. The agent found a contract bug in the PR that adds default values to field mappings (n33-d1): the API saves `default`, the worker reads `defaultValue`. It found it in 3 of 3 runs by opening a file the PR doesn't touch; the other two never did.
- ✓'Unmatched' isn't 'wrong'. Of 50 comments that matched nothing in the answer key, AI labellers called 13 real, 24 debatable, 12 wrong and 1 a planted bug cited too far away. Four issues were proven with a test that fails on the PR and passes with a fix, and joined the key. PR-Agent's noise fell from 0.23 to 0.15 per PR.
- ✓One run is one draw. Pooling three runs lifts the single prompt and the agent from 22 and 24 to 28 of 30, at three times the cost and the reading. PR-Agent only reaches 21: its misses are consistent, and re-rolling doesn't fix a blind spot.
Should a team buy an AI code review tool or call a model itself? This chapter answers with one model in three harnesses. A harness is everything around the model: what it's shown, what it can look up, and how it's asked. Think of one chef in three kitchens: same skill, different tools and recipes. Each harness reviewed the same 40 pull requests three times, and the lab scored them the way you'd score any classifier.
The source is Lab 03 of the code review labs ("The AI Reviewer Is a Classifier"), scripts 01_run_reviewers.py (cost, and what the agent reads), 03_scorecard.py (recall, precision, paired comparisons) and 04_unmatched.py (are the false alarms false?), recorded in October 2026. It is part 4 of the "Hands-on AI code review" video series. No person reviewed anything here: the three reviewers are AI, the judge that matches comments to bugs is AI, and the labels on unmatched comments are by AI subagents. The pull requests come from the testbed of Chapters 1 and 2: a made-up app with planted bugs and an answer key. The 40 PRs are the sample from Chapter 3, where a stand-in reviewer (an LLM given a reviewer's brief) was scored on them.
How the PRs are named. Each pull request has an id like n33-d1. The first part is the change: n33 is one feature, adding default values to field mappings. (c changes come from the app's own history, n changes were written for the test set.) The second part is the version: n33-clean is the correct PR, and n33-d1, n33-d2 are copies of it with one planted bug each.
Same model, three harnesses
All three reviewers run gpt-5.4-mini at low reasoning effort. Only the harness changes.
| Reviewer | What it sees | How it works |
|---|---|---|
| Single prompt | the brief and the line-numbered diff | one call: Chapter 3's standard stand-in |
| Agent | the same, plus the whole repo at the PR's head | up to 20 tool calls (search, read a file, list a folder), then it submits a review |
| PR-Agent | PR-Agent's own prompt and view of the diff | the open-source PR-Agent 0.49.0 /review, run locally |
The 40 PRs hold 30 planted bugs, one each, and 10 are clean. Every reviewer ran three times, so 120 reviews each. The single prompt's runs are copied from Chapter 3's lab; the agent and PR-Agent cost $1.64 together, and the judge $0.17.
What a review costs
| Reviewer | Per review | Median seconds | Bug comments per PR | Reviews with no bug comment |
|---|---|---|---|---|
| Single prompt | 0.49¢ | 3 | 0.9 | 25% |
| Agent | 0.97¢ | 10 | 0.9 | 21% |
| PR-Agent | 0.40¢ | 5 | 0.8 | 36% |
The agent costs twice as much and takes about three times as long. Each step sends the whole conversation again, but text the provider has already seen (cached input) is billed at a tenth of the price: $0.075 per million tokens instead of $0.75. That's why it's 2× and not 5×. All three write about the same number of comments: fewer than one bug comment per PR.
Does the agent use its tools? Median 5 tool calls per review. 14 of 120 reviews (12%) made none. 76 of 120 (63%) read a file the PR doesn't change, and 12 hit the 20-call limit. Searches (302) and file reads (298) were about even; it listed a folder only 9 times.
Recall and precision
A reviewer's bug comment is a prediction: "there's a problem here". So a reviewer is a classifier, with the same two numbers:
- Recall: the share of the 30 planted bugs it found. A comment finds a bug if it sits on the bug's lines (same file, within 3 lines, checked by code) and an AI judge confirms it describes the same problem, as in Chapter 3.
- Precision: of its bug comments, the share that were right: they match a planted bug or a known issue.
- Noise per PR: bug comments per PR that match nothing. That's what the author of a pull request feels: comments that point at nothing.
Sees the brief and the line-numbered diff, in one call.
Sees the same, plus tools to search and read the whole repo (up to 20 calls).
Sees PR-Agent 0.49.0's own prompt and view of the diff, one call.
Share of the 30 planted bugs found in the first run, with a 95% interval. On 30 bugs, one run's interval is about ±17 points wide.
Highlighted: the best value (higher is better). Precision and noise count the 4 issues proven in this lab as known issues. All three wrote about the same number of bug comments: 0.9, 0.9 and 0.8 per PR.
| Reviewer | Recall, run 1 (95% interval) | Runs 1 / 2 / 3 | Precision, run 1 | Noise per PR | Clean PRs flagged (of 10) |
|---|---|---|---|---|---|
| Single prompt | 22/30, 73% (56–86%) | 22 / 23 / 24 | 24/35 (69%) | 0.28 | 4 |
| Agent | 24/30, 80% (63–90%) | 24 / 22 / 25 | 27/38 (71%) | 0.28 | 3 |
| PR-Agent | 19/30, 63% (46–78%) | 19 / 18 / 19 | 27/33 (82%) | 0.15 | 3 |
PR-Agent has the best precision and half the noise, and the lowest recall. Its prompt tells it to be certain before flagging lower-severity concerns, and not to flag stylistic preferences. That fits what we see: it stays silent on more PRs (36%), is right more often when it speaks, and finds only 1 of the 4 broken conventions (the other two find all 4). Remember the smoke alarm from Chapter 3: PR-Agent is set less sensitive, so fewer comments that point at nothing and more missed fires. It isn't fewer false alarms on clean code, though: it flagged 3 of the 10 clean PRs, the same as the agent.
Is the agent better?
In run 1, the agent found two more bugs than the single prompt, at twice the price. That's one draw. To compare fairly, the lab gives each reviewer a score per bug, the share of its three runs that found it (0, ⅓, ⅔ or 1), and compares the two reviewers paired, bug by bug. A paired bootstrap then redraws the 30 bugs at random, with replacement, 2,000 times, to see how much the difference moves.
| Comparison (mean of 3 runs) | Difference | 95% interval | Found only by the first | Found only by the second |
|---|---|---|---|---|
| Agent − single prompt | +2 points | −8 to +13 | 2 | 2 |
| PR-Agent − single prompt | −14 points | −29 to −1 | 1 | 8 |
Averaged over three runs, the agent is 2 points ahead: less than one bug. Zero is inside the interval, so on 30 bugs, the two can't be told apart. That doesn't show they're equal; it shows this sample is too small to see a gap that size. PR-Agent is 14 points behind, an interval that only just excludes zero.
Yet they don't find the same bugs: each finds two the other never found, in any run. Explore it bug by bug:
Difference in mean recall over 3 runs (single 77%, agent 79%), paired on the same bugs. 95% interval from 2,000 resamples of the 30 bugs: -8 to +13 points. Zero is inside: on 30 bugs, the two can't be told apart. “Found only by” means in at least one run, and never by the other in any run.
| Planted bug (PR) | Type | Single prompt | Agent | PR-Agent |
|---|---|---|---|---|
| n36-d2 Let each destination set how many times to retry | reliability | |||
| c18-d2 Filter syncRuns by status | logic | |||
| n17-d2 Add --sync to run-once | security | |||
| n22-d1 Show the exact time of the last run on hover | ui | |||
| n05-d2 Paginate the syncs query | security | |||
| n27-d2 Pick the destination in the sync form, grouped by kind | ai-shaped | |||
| c16-d2 Don't send email subscribers without an address | performance | |||
| n32-d4 Count rows skipped for a missing key separately from failures | tests | |||
| worker-release-d2 Worker release: delivery, scheduling, signing and safety fixes | logic | |||
| n31-d3 Let teams pause a sync with a reason | convention | |||
| c38-d2 Send the partner's token header on webhook requests | security | |||
| n26-d2 Ask before deleting a sync | convention | |||
| c20-d2 Add a per-sync batch size | tests | |||
| n33-d1 Add default values to field mappings | contract | |||
| n29-d3 Add a sync detail page with recent-run stats | ui | |||
| n02-d2 Add deleteDestination, refused while syncs use it | performance | |||
| n09-d2 Add updateSync for editing name, mode, mappings and schedule | ai-shaped | |||
| c02-d1 Return NOT_FOUND when deleting a sync that doesn't exist | ai-shaped | |||
| c28-d1 Split run_pending into claim_next_run and execute_run | reliability | |||
| n24-d2 Filter the sync list by name or source table | security | |||
| n30-d2 Colour status badges by outcome | convention | |||
| n34-d2 Give webhook destinations their own URL | contract | |||
| n19-d3 Skip records that haven't changed since the last run | performance | |||
| n10-d2 Show how many syncs use each destination, and allow renaming | logic | |||
| n16-d1 Log one JSON line per finished run | contract | |||
| n28-d3 Make the sync form usable with a screen reader | convention | |||
| n23-d2 Add a run history table | ui | |||
| c35-d3 Fail runs that crash instead of leaving them RUNNING | security | |||
| n25-d2 Clearer schedule errors in the sync form | ui | |||
| c27-d3 Inject the transport into destination clients | reliability |
Each dot is one run: filled means that run found the planted bug. Shaded rows: one of the two found it and the other never did. Every bug was found by some reviewer in some run; 19 of 30 were found by all three.
The other side of the diff
One of the agent's two is the field-mapping PR, n33-d1, "Add default values to field mappings": when a column is empty, send this value instead. Its planted bug is a mismatch between the API and the worker. The agent found it in 3 of 3 runs. The single prompt and PR-Agent: 0 of 3.
The API saves each mapping's default under the key default. The worker loads the saved mappings with FieldMapping.model_validate(...), and a rule near the top of its model file says names in saved data are camel case, so it looks for defaultValue. It never sees the default, and the fallback silently never applies. Neither worker line is in the diff.
Single prompt
Agent
PR-Agent
The pull request adds a default value to field mappings: when a column is empty, send this value instead. The agent has the diff plus tools to search and read the whole repo. Step through what it did.
That's a contract bug: two parts of a system disagree about a name. A reviewer that reads only the diff can't see the other side of the agreement. Every one of the agent's runs on this PR opened worker/harbor_worker/models.py; in run 1 it took 7 steps to get there. The sample has 3 contract bugs. In at least one of three runs, the agent found all 3, the single prompt 2, and PR-Agent 1.
Are the false alarms false?
A comment that matches nothing in the answer key might be a bug nobody planted. The lab sampled 50 unmatched bug comments from all three runs (17 single prompt, 17 agent, 16 PR-Agent), and AI subagents read each one against the code:
| Label | Count | Example |
|---|---|---|
| Real | 13 | run-once --dry-run --sync syn_a previews every sync, not just syn_a |
| Debatable | 24 | Retry-After in HTTP-date form, where the class documents seconds |
| Wrong | 12 | a race between check and delete, in an API that's synchronous and single-threaded |
| Planted | 1 | the planted duration_seconds bug, cited on its docstring 10 lines away |
About 1 in 4 (26%, interval 16–40%) looked real, at about the same rate for every reviewer. But "looks real" is still an opinion, so the lab asked for proof. A proof is a test that fails on the PR and passes once a fix is applied. Passing with the fix is what shows the test fails because of this bug, not a typo or a missing fixture.
The 13 real-looking comments came down to 5 distinct problems. Four were proven, each on the three variant PRs of one change (12 of 12):
| Issue | PRs | What the test shows |
|---|---|---|
| f1 | n17, add --sync to run-once (3 variants) |
run-once --sync skips a named sync that isn't due, though re-running a sync now is what the flag is for |
| f2 | n17, the same change (3) | --dry-run ignores --sync: a dry run of syn_a also prints syn_b |
| f3 | n34, give webhook destinations their own URL (3) | the private-host check lets https://[::ffff:127.0.0.1]/ and https://[::]/ through |
| f4 | n36, let each destination set how many times to retry (3) | the "with retries" badge assumes 100 records per request; an EMAIL run of 120 rows (3 requests, no retry) shows it |
The fifth (the badge counting a failed batch as a retry) isn't proven: the UI doesn't get enough data to tell the two apart, so its fix is a design change, not a line.
Proven issues join the answer key, so a reviewer that flags them gets credit instead of a mark for noise. Noise per PR in run 1, before and after: single prompt 0.30 → 0.28, agent 0.33 → 0.28, PR-Agent 0.23 → 0.15, down by a third. Its quiet comments were right more often than they looked. Every scorecard above already counts these four. False alarms on the clean PRs don't change, because all four issues sit in changes whose sample PR is a buggy variant.
Pool the runs
The same reviewer on the same PR finds different things each run. The single prompt found 18 bugs in all 3 runs and 10 in only 1 or 2; those are coin flips. Read all three runs' comments together (the union) and the single prompt and the agent both reach 28 of 30 (93%, 79–98%). That costs three times the money (still under 3¢ a PR) and three times the reading. PR-Agent's union only reaches 21 (70%): it never found 9 bugs in any run. Re-rolling finds coin flips, not blind spots.
Also in the lab
From the lab's README (its own run, October 2026), beyond the video:
- The judge was checked by verdict. It said "different problem" to only 15 of 232 candidate comments on a bug's lines, so a random 100 would hold about 6. The check labelled all 15 "different" and 85 "same": 100 of 100 agreed. About 1 in 15 comments on a bug's lines is about something else, for every reviewer, so line overlap alone over-counts. The labels are from AI subagents blind to the verdicts, not people.
- The 3-line window decides little here. Widening it to 8 lines added 0–1 candidates per reviewer, and the judge rejected them all: these reviewers cite the line they mean. The one planted find the matcher missed was 10 lines away.
- Per type, 19 of 30 bugs were found by all three reviewers, and none was missed by all. Those 19 are the candidates for Chapter 6: if a type check or a contract test finds them for free, no reviewer should spend attention on them.
- Cost per PR depends on what you average. Over all 120 reviews, 0.49¢ / 0.97¢ / 0.40¢ (the numbers in this chapter and the video). The scorecard's run 1 alone averages 0.54¢ / 1.20¢ / 0.60¢, and the agent's run-1 median is 11 s.
- Structured output cut comments short on one PR: 4 of 325 comments ended where the model meant to quote
"batch_size". Valid JSON, broken comment.
What to do
- Fix the model, change the harness, when you choose between a review tool and your own prompt. Then change one thing at a time.
- Report recall and precision together, with noise per PR and cost. A higher recall bought with twice the comments costs every author reading time.
- Compare reviewers paired on the same bugs, averaged over runs, with an interval. Overlapping intervals from separate runs aren't the test.
- Look at which bugs each reviewer finds, not only how many. Two reviewers with the same recall that find different bugs are worth combining.
- Give a reviewer the repo when bugs live between files. Contract bugs need the other side of the agreement.
- Read the unmatched comments. Prove the real ones with a test that fails on the PR and passes with the fix, and add them to the answer key.
Caveats
- 30 bugs is small. One run's recall has an interval about ±17 points wide. Small differences (agent vs single prompt) and per-type rates (2–5 bugs a type) can't be measured here; large and qualitative ones can.
- No person reviewed. The reviewers, the judge and the labels of unmatched comments are all AI. The judge is the same model as the reviewers; the stratified check is the guard, and it was labelled by AI subagents too.
- One model, one effort. A stronger model might use tools better, or need them less. How another model would rank the harnesses is open.
- A sample, not the corpus. The 40 PRs are Chapter 3's sample, which over-weights large PRs. The full testbed has 173 bugs, including 18 contract bugs.
- Planted bugs are findable by design. They sit in or near the diff; there are no missing-file bugs or design mistakes.
- "Debatable" is its own number. 24 of 50 unmatched comments were matters of spec or taste. They cost reading time like wrong ones, but a team may want some of them.
The checklist
- Pin the model and effort across every reviewer you compare.
- Run each reviewer at least three times on the same PRs with planted bugs, and keep every review.
- Match comments by lines and a judge, and check the judge on a sample stratified by its verdict.
- Report recall with its interval, precision, noise per PR, false alarms on clean PRs, cost and time.
- Compare paired, on the mean of runs per bug, and list the bugs found by only one reviewer.
- Label a sample of unmatched comments, prove the real ones with fail-then-pass tests, and add them to the answer key before re-scoring.
Practice: score a reviewer like a classifier
Count recall per run and pooled, find the bugs only one reviewer found, run the paired bootstrap, compute precision, and decide when a test proves a bug. The tests use the lab's recorded runs on the 30 planted bugs and expect its numbers: 22/23/24, 24/22/25 and 19/18/19 per run; 28, 28 and 21 pooled; +2 (−8 to +13) and −14 (−29 to −1) paired.
Quiz
1.Why do all three reviewers in the lab run on the same model at the same effort?
2.PR-Agent has the best precision (82%) and the lowest recall (19 of 30 in run 1). What does that mean?
3.Averaged over three runs, the agent's recall is 2 points above the single prompt's, with a 95% interval of −8 to +13. What can you conclude?
4.A PR adds default values to field mappings, with a planted contract bug (n33-d1). Why did the agent find it when the single prompt and PR-Agent never did?
5.A reviewer's comment matches nothing in the answer key. Is it wrong?
6.A proof test fails on the pull request. Why must it also pass once a fix is applied?
Check your understanding
Try each question before opening its answer.
What is a harness, and why keep the model fixed when comparing them?
Everything around the model: what it's shown, what it can look up, and how it's asked. With gpt-5.4-mini at low effort for all three reviewers, differences in recall, precision and cost come from the harness alone. That's the choice a team faces when it picks a review tool or builds its own; a vendor comparison changes the model too.
The agent's recall is +2 points over a single prompt (−8 to +13) at twice the cost. Is reading the repo worth it?
Not for recall on average, on these 30 bugs: the interval includes zero. But it finds different bugs. The contract bug in the field-mapping PR (n33-d1) can't be seen in the diff, and the agent found it in all 3 runs by reading the worker's models; the single prompt never did. Reading the repo pays for bugs that live between files. At 0.97¢ against 0.49¢, both are close to free next to a person's minute; latency (10 s vs 3 s) matters more if the review blocks a merge.
PR-Agent has the best precision and the lowest recall. Which reviewer would you put in front of your team?
It depends on what the team will tolerate, which is why you measure both. PR-Agent writes about half the noise (0.15 vs 0.28 per PR) and 82% of its bug comments are right, but it finds 14 points fewer bugs (−29 to −1) and 1 of 4 broken conventions. A team that ignores bots may prefer its precision; a team that relies on the bot to catch things needs recall.
Why report the union of three runs, and what does it cost?
One run is one draw, and many bugs are coin flips. Reading all three runs lifts the single prompt and the agent from about 77% to 93% (28 of 30). It costs three times the money and three times the comments to read. PR-Agent's union reaches only 21 of 30, because it never finds 9 bugs: re-rolling doesn't fix a blind spot.
A quarter of unmatched comments looked like real bugs. What does that do to noise and precision?
It makes them partly a measurement of the answer key: an unmatched comment only means the key didn't know about it. Of 50 sampled, 13 looked real, 24 debatable, 12 wrong and 1 was a planted bug cited 10 lines away. After 4 issues were proven and added to the key, PR-Agent's noise fell from 0.23 to 0.15 per PR. Each proven issue makes every later score more honest.
Why must a proof test also pass once the fix is applied?
A test can fail for the wrong reason: a typo, a missing fixture, or another bug on the same lines. Failing on the PR and passing after one targeted fix shows it catches this bug. On the PR that gives webhook destinations their own URL, with its planted bug (n34-d1), the first test of the private-host check still failed with the fix, because that planted bug also let 169.254/16 through; that case was dropped, and the rest still proved the bypass on all three variants.
A vendor says their AI reviewer has 90% recall. What do you ask?
Recall of what, on whose code, matched how, and at what precision? Ask for the bug types and counts, the interval, how a comment counted as a find (line overlap alone over-counts by about 1 in 15 here), how many comments per PR it writes and how many are right, and whether it's one run or the best of several. Better: run it on your own PRs with known bugs, paired against your current reviewer.
Next up: Chapter 5 asks what happens if the reviewer has to prove each finding itself, before anyone reads it: prove it or drop it.