Skip to content

SolveLang Blog · Code review

How do I review AI-generated code before merging?

Published

The bottleneck moved. Faros's 2026 engineering data (22,000 developers) found merges per developer up 16.2% with AI assistance, while median time in review rose 441.5%. Teams are not short of code; they are short of verified code. Reviewing an AI-written change with the habits built for human-written changes misses the failure modes that are specific to generated code.

The failure modes that are actually new

Invented dependencies. A USENIX Security 2025 study of AI package recommendations found that about 19.7% of recommended packages did not exist — 205,474 unique hallucinated package names across the models tested. An attacker who registers one of those names owns everyone who installs it. Every new dependency in an AI-written change gets checked against the real registry, by hand, once.

Plausible insecurity. Veracode's testing of AI-generated code across more than 100 models found a security flaw introduced in 45% of cases. Generated code tends to be idiomatic and readable, which is exactly what makes its flaws easy to skim past — the review has to include the security questions a linter cannot answer: where does input cross a trust boundary, and what proves it is safe?

Tests that freeze the bug. When the same model writes the code and the tests, the tests can encode the same misunderstanding. The counter-move is cheap: break the code on purpose — change a boundary, invert a condition — and watch whether any test notices. A test suite that stays green while the behaviour changes is decoration.

A working review order

Start with the files agents skim: build scripts, lockfiles, CI workflows, and anything that runs at install time. Then run the repository's own checks against the change as it will land — the combined tree, not the branch in isolation — and treat any finding the checks cannot confirm as unverified rather than fine. Read the diff last, with the run evidence in hand; it is a much shorter read when you know which claims are already proven.

That order is the one SolveLang Verification is built around: run the repo's own checks on the combined tree and grade every finding verified, failed, or unverified. Across its first 13 verified pull requests and 117 findings, 19.7% of findings graded unverified and none graded falsely verified — the unverified bucket is the point. It is the part of the review a human should spend their time on, instead of re-checking what a machine already proved.

Questions, answered briefly

Can I trust AI code that passes all tests?

Passing tests prove the code does what the tests check. When the tests were generated with the code, they may check the wrong thing. Break the code deliberately and confirm the tests fail; then the green run means something.

What is the one check with the highest return?

Verify that every newly introduced dependency actually exists and belongs to the publisher you expect. Hallucinated package names are measurable, common across models, and directly exploitable — and the check takes under a minute per package.

Sources

More answers on the SolveLang blog