A common scenario: a PR has several hundred lines of changes, most of them AI-generated. Review time goes into naming, function decomposition, “you could drop a temporary variable here.” When the meeting ends, nobody has asked: this code assumes upstream will always return within 3 seconds—does that assumption hold?
This isn’t because reviewers are careless. Review trains attention to land exactly here: naming, indentation, boundaries, null handling. The problem is that AI happens to do this layer very cleanly, so review attention stalls at the lowest-value place.
AI has driven the cost of “does it look right” very low
Watching coding style used to make sense. Different people write code very differently; inconsistent style accumulates into long-term maintenance cost, and style problems (duplicated logic, overly long functions, implicit coupling) really can predict defects. That experience had a high cost-performance ratio in the era of purely human-written code.
Now the marginal return on this layer is dropping fast. Model-generated code has consistent style, tidy naming, plausible comments; add lint, formatting, type checking, and most surface problems are caught before review. What you pick out in a diff is increasingly “I’d write it differently,” not “this will break.”
Conversely, AI-generated code has a structural weakness: its assumptions about requirements are inferred, and the inference process isn’t recorded anywhere.
When people write code, hesitation leaves traces. A commit message saying “writing it this way for now, pending confirmation,” a temporary discussion, a TODO in the code, even an unusually long variable name—all tell later readers there was a trade-off here. AI doesn’t. It outputs a confident, complete result that looks like everything was considered. The hesitation is smoothed away, and it’s smoothed away exactly where it most needs to be seen.
So the focus of review should shift from “is this written correctly” to “is this solving the problem we actually need solved, and what assumptions does it make about the runtime environment.” Tools have largely taken over whether the writing is correct; people doing it again is duplicated effort.
In AI-generated code, the most expensive defects aren’t syntax or style—they’re a reasonable but wrong assumption about a constraint you never wrote down. These defects don’t fail the build; they just make the system behave abnormally someday in a way nobody anticipated.
A three-line PR description is worth more than a several-hundred-line diff
The approach is crude: require the submitter to answer three questions in the PR description.
- What behavior should change with this change, in business language, not technical language
- Approaches considered but not adopted, and why they were rejected
- Assumptions you’re not confident about, listed one by one
The third matters most. The uncertainty in AI-written code is real; it just doesn’t volunteer it. Getting the submitter (usually the person who wrote the prompt) to write down “I’m not sure” turns implicit assumptions into reviewable objects. Only a person can fill this in, because only the person knows what they didn’t say at the time. The template can be just these few lines:
1 | intent: 一句话说清这次改动改变了什么用户可见或系统可见的行为 |
The first action in review therefore becomes: don’t look at the diff; read these three paragraphs first, then ask “if I accept this against this intent, which test proves it was achieved.” If they can’t answer, don’t look at the diff yet. This isn’t process purism. A change whose intent can’t even be stated can’t be judged line by line either—you’ll only read style disagreements.
There’s another case worth noting: the submitter can’t write the intent. This usually means the problem is earlier in the chain—what was wanted wasn’t clear when the prompt was given. In that case, sending it back to redo is much cheaper than filling in the gaps by guessing during review.
No matter how beautifully a piece of code is written, if it solves a different problem than the one you think, approving the review is a precondition for an incident.
Failure paths: AI’s error handling is often decorative
The most common shape of AI-generated code: the main flow has all its branches, exception handling appears to exist, but it doesn’t hold up to questioning. try/except wraps it, and the except logs a line and returns None. Retries are written, but with no backoff and no cap. A batch operation has half successes and half failures, and the function just returns the successful part.
These usually don’t show up in demos or unit tests, because tests mostly verify the happy path. In production the symptom is “the API occasionally returns empty and nobody knows why,” and then someone spends half a day adding logs to locate it.
Points worth asking about one by one in review:
- Retries: is there backoff, is there a cap, is the retried operation idempotent
- Timeouts: is one set for every external call, and what trace does this request leave after a timeout
- Partial failure: where do the failed items in a batch go, can the caller know
- Resources: connections, handles, locks—are they released on exception paths
This judgment has boundaries. A script you run once and throw away doesn’t need any of this; if it crashes, rerun it. But as long as this path has state, concurrency, or someone waiting on the result, the quality of failure handling determines whether it can ship or only demo.
AI being weak on failure paths isn’t accidental. Training data contains far more successful code than failing code, and error handling written wrong often doesn’t fail tests—it doesn’t produce red lights, only silence.
Maintainability is about whether others can change it
AI is very good at generating things that look well-structured: an extra interface layer, an extra config option, an extra strategy class. At the moment of generation the abstraction is self-consistent, because it was thought through all at once. The problem is that the next person to change it has to rebuild that abstraction in their head, and the rebuild cost doesn’t show up in any metric.
Here are two fairly plain criteria. First: when this code breaks at midnight, can the on-call person locate the failing line without reading the whole file. Second: how many files need changing to delete this code. If the answer is “many,” the coupling didn’t disappear—it was hidden behind the abstraction.
The second criterion is especially effective for AI-generated code. Models tend to reserve structure for “possible future extension,” and the real direction of extension often differs from what they guessed. The reserved interfaces end up either idle or bypassed on the second change, becoming corners nobody dares to delete.
One more detail deserves its own mention: naming. AI-chosen function names often accurately describe what it does, but not why it exists. In review, asking “if this function didn’t exist, which requirement would be missing” is far more useful than asking “is this name appropriate.” The former exposes duplicate implementations and pseudo-abstractions; the latter only yields taste arguments.
The process has to change too, or all of the above is empty talk
A few actions you can take immediately.
Set a cap on diff size per review. The rule of thumb is on the order of a few hundred lines; beyond that, defects found per line drop noticeably. AI speeds up output, so bigger diffs are almost inevitable—which makes this old rule more necessary to enforce, not something to relax because “it’s all AI-written anyway.”
Split review into two passes. The first pass reads only the intent, the changed interface signatures, and new dependencies, judging whether this should be done at all. The second pass looks at the implementation, judging whether it’s done right. Separating the two passes by some time is even better; when one person reads several hundred lines straight through, the second pass’s attention is fake.
Separate human review from model review. Let tools scan first for style, boilerplate issues, and obvious null-pointer risks, and auto-fix what can be fixed automatically. Spend human time only on semantics: is this behavior change what we want, and what happens after failure. Mix the two, and people get worn down by trivial comments first.
High-risk modules do not accept “looks fine.” For changes involving money, permissions, data migration, or concurrency, require the submitter to provide a test that reproduces the failure path. Being unable to write that test usually means the failure path was never considered, not that the test is hard to write.
flowchart TD
A[打开 diff] --> B[读 intent 三段]
B --> C{能说出验收方式}
C -->|否| D[退回补描述]
C -->|是| E[看接口签名与新增依赖]
E --> F{涉及钱 权限 并发 迁移}
F -->|是| G[逐行读实现 要求失败测试]
F -->|否| H[重点看失败路径]
H --> I[抽样读实现]
G --> J[合入]
I --> JIn some cases, the code still needs to be read line by line
The reverse also needs to be stated clearly, otherwise it is easy to slide into the wrong conclusion that “how it is written does not matter.”
For code that many people will repeatedly modify—such as shared libraries, infrastructure, and framework layers—readability weighs more than one-off business logic. In places involving security boundaries and permission checks, one extra branch is a vulnerability. When a team has many newcomers and spends far more time reading code than writing it, how the code is written is itself a collaboration cost. There is also a category that is easy to overlook: code that will be copied as an example. Model-generated code is especially likely to be copied because it looks like a standard answer.
In these cases, reading line by line is worth it. For most other business code, the return on reading line by line is lower than spending that time clarifying assumptions. This trade-off is not a permanent conclusion; it depends on your team size, module lifespan, and cost of incidents. Within the same team, the review standard for the payment path and the review standard for the operations backend should not be the same in the first place.
One more thing: review comments themselves should also be classified. For comments like “this could be more elegant,” if the submitter can clearly explain why the current approach was chosen, it should be allowed to stay; if they cannot, then it is not a style issue but a lack of intent. The cost of distinguishing the two is low, and the benefit is freeing review meetings from aesthetic debates.
Next time you open a diff with AI involvement, do not scroll through the code first. Ask the submitter one question: which assumption here, if wrong, would make the entire change pointless? The answer is usually not in the diff, and that is where review time should be spent.
Comments