Risk-based code review: which agent changes need a closer look
Stefan-Iulian Tesoi · · 6 min read

Changes that are hard to undo or wide in reach: database migrations, authentication and permissions, payment paths, public APIs, and anything that deletes or sends. Read those line by line against the criteria. A copy change or a new test can be approved on its evidence. Reviewing every diff the same way spreads attention too thin to catch either.
That is risk-based code review, and coding agents turn it from a nice idea into a necessity. A team whose agents open fifteen pull requests a day cannot read all of them with the care a migration deserves, and a reviewer who tries ends up skimming the migration along with everything else.
What is risk-based code review?
Setting code review depth by what a change could break, not by who wrote it or how long the diff is.
The idea comes from risk-based testing, the established practice of choosing and ordering tests by the likelihood and impact of a failure. Applied to review, the question is the same: if this change is wrong, how much damage does it do, and how long before anyone notices?
Size is a poor proxy. A 600-line diff adding tests to an isolated module carries less risk than a one-line change to a permission check. Authorship is a poor proxy too. An agent and a senior engineer can both write a migration that locks a large table for twenty minutes, and the review that catches it is the same review.
Two questions: how far does it reach, and can it be undone?
Ask both of every change, and let the worse answer set the tier.
- Blast radius. How many users, tenants, services or records does a mistake touch? A change behind a feature flag for one internal team reaches a handful of people. A change to shared authentication middleware reaches every request.
- Reversibility. Does reverting the commit undo the damage? Reverting a stylesheet restores the page. Reverting a migration that dropped a column does not bring the data back, and reverting an email job does not unsend the 4,000 emails it sent.
| Tier | Typical changes | Review |
|---|---|---|
| 1. Evidence | Copy, styles, isolated tests, internal tooling | Read the hand-back and the test results, skim the diff |
| 2. Standard | Feature code behind existing interfaces | Read the diff against the acceptance criteria |
| 3. Line by line | Migrations, auth, payments, public APIs, deletion, infrastructure | A named owner reads every line, and runs it where possible |
Most work sits in the middle tier, which is what AI code review covers in detail: the diff is the evidence, and the agent's summary is a claim about it.
Which paths always get a line-by-line read?
The ones where a mistake outlives the revert. Keep the list short on purpose:
- Database migrations, including index builds on large tables and anything that renames, drops or retypes a field.
- Authentication and authorisation: login, sessions, tokens, role checks, tenant isolation.
- Payment and billing paths, where an error turns into a refund conversation.
- Public APIs and webhooks, which other people's code depends on in ways nobody here can see.
- Anything that deletes or sends: retention jobs, bulk email, outbound notifications.
- Infrastructure and CI configuration, including the files that decide who reviews what.
The last item is the easiest to miss. A change to a CODEOWNERS file or a CI workflow can quietly lower the tier of everything that follows it, which is why changing its own controls belongs among the agent guardrails worth enforcing.
High risk code changes in these paths are never approved on evidence alone. Passing tests are necessary there and nowhere near sufficient, because the failures that matter in these paths are the ones nobody thought to test.
Passing tests show that a change does what its author expected. A line-by-line read is for what nobody expected.
One from our own backend makes the point. A follow-up change added a counter field to an existing collection and selected records with a less-than comparison on it. Every test passed, because tests create records through the current schema, which fills in the default. In production, records written by the previous build had no such field, a missing field fails every less-than comparison, and those records could no longer be picked up. The question that catches this is about the rows already in production, and only a reader asks it.
Enforcing the tiers with CODEOWNERS and path rules
Write the tiers down as path rules, so the platform requests the right reviewer instead of someone remembering to.
On GitHub, a CODEOWNERS file maps path patterns to people or teams, and owners are requested automatically when a pull request touches their paths. GitHub's documentation sets out three rules worth knowing: the last matching pattern wins, a file of 3 MB or more is not loaded at all, and a requested review becomes a required one only when a branch protection rule or ruleset turns on "Require review from Code Owners".
/db/migrations/ @acme/data-owners
/src/auth/ @acme/security
/src/billing/ @acme/payments
/.github/ @acme/platform
That last condition is where codeowners review most often fails without anyone noticing. GitHub's plan comparison lists code owners and protected branches for private repositories only on the paid plans. On the free organisation plan, a private repository can hold a carefully written CODEOWNERS file that looks like policy and requests nobody. Before trusting the rules, open a test pull request that touches a tier-3 path and confirm it cannot merge without the owner.
Laimonade applies the same idea one step earlier, at the item. Each item names its blast radius, the repos and paths it touches and what must not break there, before a coding agent starts, so the tier is visible before a diff exists. The agent's work stops at In Review, carrying the checks it ran and the steps a person should verify. That is where the attention goes once agents stop being the bottleneck for engineering leaders, and it is the last step of a definition of done for agent work.
Where review tiers go wrong
Four failure modes, all of them quiet:
- The author sets the tier. If the agent, or the person who wrote the change, decides it is low risk, the riskiest changes are the likeliest to be mislabelled. Decide tiers by path, in advance.
- Mixed diffs. A copy change and a migration in one pull request get the review the title suggested. Split them so the migration arrives alone.
- Rules nobody tests. A CODEOWNERS pattern that stopped matching after a directory rename protects nothing, and nothing reports it.
- Everything drifts to tier 3. When every pull request needs a line-by-line read, reviewers start skimming them all. Keep the list short enough to honour.
Frequently asked questions
Does a low-risk change still need a human approval?
Usually, but a light one. Someone confirms that the evidence covers the acceptance criteria and that the diff matches its description, which takes minutes. Risk changes the depth of the read, not whether it happens. In Laimonade a coding agent cannot move its own item past In Review; Laimon, the product owner agent, can close one once nothing is left for a person to check, and stamps that closure as its own.
Who decides which paths count as high risk?
The people who would be paged when those paths fail, agreed once and written into the repository. That is usually the tech lead together with whoever owns security, data and payments. Revisit the list when the architecture changes, and never let a single change redraw its own tier.
Should an agent be told which tier its change falls into?
Yes. Put the tier, and the paths that set it, in the item. An agent that knows a migration will be read line by line can write it to be read: small, reversible where possible, with the rollback stated. Telling it the tier does not let it choose one; the paths decide.