Can AI Review Its Own Code?
A second opinion needs a second mind.

Here is something I have noticed talking to engineering teams over the past year: a growing number of them have adopted a workflow where GitHub Copilot or a similar tool writes a chunk of code, and then they ask the same tool, or a nearly identical one, to review it for bugs or security issues. On the surface this seems reasonable. The tool is good at code, so it should be good at reviewing code. But there is a subtle problem baked into this workflow that the efficiency gains can mask: the tool reviewing the code shares most of the same failure modes as the tool that wrote it.
This is not a hypothetical concern. Research from academic groups and security firms has consistently shown that AI code review tools miss vulnerabilities that the AI code generation tools are likely to introduce. The overlap is not coincidental. The same training data that shapes how an AI generates code also shapes how it evaluates code. If the training corpus contains a lot of examples of a particular vulnerability pattern being used in context, the model may both generate that pattern and fail to flag it in review, because both behaviors are consistent with what the training data showed.
I want to be careful not to overstate this. AI code review still catches a lot of real issues. Tools like GitHub's code scanning, Snyk, and similar products find genuine vulnerabilities that human reviewers miss, particularly in the category of well-known, well-documented vulnerability patterns that show up in training data precisely because they are common and consequential. The concern is specifically about the class of vulnerabilities that the AI is systematically less likely to generate and therefore systematically less likely to have been trained to catch.

In 2024, Stanford researchers published a study showing that AI-assisted code generation introduced security vulnerabilities at a measurable rate that was not reliably caught by AI-assisted code review using tools from the same provider. The vulnerabilities that slipped through were disproportionately in categories that were underrepresented in the security training data: novel vulnerability patterns, vulnerabilities specific to less common frameworks, and vulnerabilities that required understanding multi-file interactions rather than local code context.
This pattern is what you would predict from first principles. AI tools are good at pattern matching against their training distribution. They are less good at catching the things that are absent from their training distribution. If the AI-generated code introduces a vulnerability that is unusual or context-specific, and the reviewing AI was trained on similar data that also underrepresents that vulnerability class, the review is likely to miss it for the same reason the generation introduced it.
The more concerning version of this involves novel vulnerability patterns that did not exist in the training data because they did not exist as a known category when the training data was assembled. AI tools are adding new capabilities to codebases, new API integrations, new data flows, and new interaction patterns between systems. Some of those novel patterns will introduce vulnerability classes that do not have established names yet, that are not in the CVE database, and that therefore did not appear in the security training data that the reviewing tool was trained on. These are the vulnerabilities that neither the generation nor the review is well-positioned to catch.

The case for maintaining meaningful human code review in an AI-assisted workflow is not that humans are better than AI at catching everything. They are not. Humans miss obvious vulnerabilities all the time, particularly in the kind of line-by-line review that humans find tedious and AI finds trivial. The case is that humans and AI have different blind spots, and a review process that includes both is more likely to catch the full range of issues than a process that relies on AI alone.
Human reviewers who understand the system architecture, the threat model, the business context, and the history of similar code in the codebase are catching a different category of issue than the AI is catching. They are asking: does this code do what we intended it to do in the context of the full system? Does this logic correctly handle the edge cases we know exist in production data? Does this integration with the external API introduce risks that the documentation for that API suggests but does not make obvious? Those are questions that require the kind of contextual understanding that current AI tools handle inconsistently.
The practical workflow implication is not to avoid AI code review. It is to use AI code review for what it is good at, which includes catching well-known vulnerability patterns and stylistic inconsistencies quickly, and to maintain human review specifically for the things AI code review is less reliable on: architectural decisions, novel integration patterns, security-critical paths that do not follow established patterns, and code that the AI generated in areas where you have specific concerns about the training data coverage.

There is a governance question that follows from AI-assisted code review that organizations are still working out: when an AI-reviewed piece of code ships with a vulnerability, who is accountable? The developer who accepted the AI's review? The security team that approved the AI-assisted review workflow? The AI tool vendor whose product missed the vulnerability? In most current organizational structures, the answer defaults to the developer, which creates perverse incentives if developers are expected to do thorough independent review in addition to running AI tools rather than being able to rely on the AI tools they have been told to use.
Getting the accountability structure right requires being honest about what AI code review is and is not. It is a useful first-pass filter, not a substitute for expert security review on critical code paths. Organizations that have deployed AI code review tools as a replacement for human security review, rather than as a complement to it, have made a governance decision that may not align with their actual risk tolerance. Making that decision explicitly rather than by default is part of what good AI governance in software development looks like.
The organizations I see handling this well have done a few things. They have mapped which parts of their codebase are highest risk and have maintained or increased human review investment there even as AI tools have handled more of the lower-risk code review. They have been transparent with their engineering teams about what AI code review can and cannot catch, so developers do not use the AI's approval as a substitute for their own judgment on the things the AI is least reliable about. And they have built metrics around security outcomes, not just review process, so they can tell whether the shift to AI-assisted review has changed their actual vulnerability rate in production.
You might also like
View all
Could AI Be Our Last Invention?
It's closer to a plan than a myth.

When AI Outpaces Human Timelines
Progress may stop waiting for us.

The AI Researcher That Never Sleeps
Science just got a tireless colleague.