PR Reviews Have Changed
In my last post, I said that if agents are gating things instead of humans, we need strong verification. Tests are a big part of that. But I’ve also been thinking a lot about PR reviews, and how different they’re going to look as AI writes more and more of our code.
Here’s where I’ve got to so far…
How PR Reviews Used to Work
Traditionally, a developer would look at the diff and make sure the code followed good patterns. If it was a significant change, they might pull the branch down, run it and do some testing. Obviously, that takes a lot of time, so it didn’t always happen.
Alongside the human reviewer, the pipeline did some validation too. There were unit tests, type checking and static analysis tools like SonarQube and ESLint, which spotted bad coding patterns. That’s what we had before the agentic era.
What AI PR Reviewers Do
AI PR reviewers take this to the next level. They read the code and check that it fits with the rest of the system, which is something static analysis tools could never do.
But generally, they don’t check out the code, run it and actually test it, like we sometimes did as humans back in the day. They’re still just reading the code.
Why Does This Matter More Now?
We’re getting to the stage where humans aren’t the gates in the pipeline anymore. For example, a low-risk PR might merge itself once the reviewer says yes and the required checks pass. Or, at the extreme, an agent might say a change is good to go to a higher environment, or even to prod. Humans are still accountable for what goes to production, though. But a human doesn’t need to step in on every change, and I think the risk of the change should decide when they do.
So verification is really important. Tests are a huge part of it, but the earlier we detect a problem, the better. One of the earliest places we can detect a problem is the PR review.
What I Want From a PR Reviewer Now
Read the code. This is still the starting point. The reviewer should check that the change fits the system and follows the patterns we use.
Check the PR is in the right shape. At the top, the PR should say how risky the change is. Can it easily be reverted, or is it a one-way door, like some schema or data changes? And how bad would it be if it went wrong? At the bottom, it should list the manual tests that have been carried out, whether a human did them or the coding agent did, with screenshots or maybe even a video. If the PR isn’t in that shape, it gets batted back.
This matters because the reviewing agent needs it to properly review the PR. It’s really valuable for a human too. At a glance, I can see whether a change is high risk or low risk, which manual tests have been done and what the result looked like.
The reviewer shouldn’t just take the risk rating on trust, though. If a gate depends on it, like a low-risk PR merging itself, it’s worth the double check.
Prove what it finds. When reading the code suggests that something might be wrong, the reviewer should run the code in a sandbox to prove it. It should come back with clear steps that reproduce the problem, what the user would see, and certainty that it’s a real problem and not a false alarm. False alarms waste time, and they just don’t work in an agentic pipeline. If there’s no human to say “that’s not a real problem”, the agent that wrote the code will go off and fix something that isn’t broken. And if checking shows there isn’t a problem after all, the finding gets dropped.
Here are two examples. In one PR, the code shortened long file names, and the reviewer suspected it could cut an emoji in half. So it ran the code with a long name containing an emoji, and it crashed. It came back with the exact file name to reproduce it and the error the user would see. In another PR, it looked as if two people removing owners at the same moment could leave something with no owner at all. So the reviewer ran both removals at the same time against a real database. The second one waited for the first to finish, saw there was only one owner left, and was refused. That wasn’t a real problem, so the reviewer dropped it.
Where it’s worth the extra time and tokens, the reviewer can also run the riskiest part of a change, even when nothing looks wrong. Some problems only show up when you run the code with unusual inputs.
Check the production logs and telemetry, where appropriate. The code only shows the reviewer what should happen. The production logs show what’s really happening: the main flows people go through, how often they go through them, and where things go wrong. So whenever a change relies on a guess about production, like a time limit, a threshold or “this hardly ever happens”, the reviewer checks it against the logs. It only needs read-only access to the logs it’s checking, and we need to be careful not to expose sensitive customer data to it.
One change assumed that if a piece of work hadn’t finished within 60 seconds of the user stopping it, it had died. The logs showed that 25 out of 562 took longer than that, and one took nearly eight minutes, so the change would have treated work that was still running as dead. Another was about a single file that had been wiped after a release. The reviewer found 99 in the logs since late October, and it was still happening. Neither of these would have shown up from reading alone.
Is It Worth the Cost?
Yes, this slows the process down. And yes, it burns more tokens.
But we also burn tokens when a coding agent fixes a problem that doesn’t exist and the PR goes round another review. And if we catch a regression before it gets to production, how much time and how many tokens have we saved? I think we need to look at the cost of the whole pipeline, not just one step of it. It’s the same reason I’ve stopped asking for low-level unit tests. I want to spend tokens where they give the most confidence.
So I think it’s worth it. A reviewer that proves what it finds and checks the change against production is what lets us take the human out of the loop. If humans aren’t the gates anymore, they can spend their time on higher-level things. We can push a lot more features and changes through, and the whole pipeline can run at night while we’re asleep.
Ultimately, that means we get value to our customers quicker.
Where I’ve Landed
So, PR reviews have changed. For now, I want my AI reviewer to read the code, make sure the PR is in the right shape, prove any problem before it reports it, and check the change against production where that makes sense, before it says a change is good to go.
I’m still experimenting with all of this, so my thoughts might be quite different in a few months’ time!