Editorial illustration for Copilot Caught 8 Diff Bugs With Rules, Caught 0 of 2 Outside the Diff
Copilot Misses Critical Bugs Outside Code Diffs
Copilot Caught 8 Diff Bugs With Rules, Caught 0 of 2 Outside the Diff
A guard clause on negative enrollment days looked clean on its own. The function it called did not: it overbilled a customer for 11 days straight, a bug that lived entirely outside the lines Copilot was asked to review. That gap between what gets changed and what actually breaks is the subject of a small experiment one engineer ran after noticing a pattern in their own review queue.
GitHub Copilot had become fast enough to replace the wait for a free colleague, and accurate enough that human reviewers started skimming once it signed off. The problem is that a clean AI review says very little about whether a change is safe for the rest of the system it touches.
To find out how much that trust was worth, the engineer seeded ten bugs into pull requests against a synthetic billing service and a pandas feature pipeline, then ran Copilot twice on each: once with nothing but the code, and once with short rule files spelling out the business logic. Eight of those bugs sat inside the diff. Two did not. What happened next splits cleanly down that line.
A guard on negative enrollment days looked correct while the function it called overbilled a customer 11 days, and an invariant test would have caught it.
Why this matters
This is the kind of result that should temper the enthusiasm around AI code review without killing it outright. Copilot nailed every bug sitting inside the diff once rules were in place, but it missed both bugs that lived in logic the diff merely touched, not logic the diff showed. That's not a small gap.
The overbilling case proves it: a guard clause can look airtight while the function it calls quietly breaks an invariant eleven days later, and no amount of diff-scoped review catches that unless the tool actually pulls in the wider file context. The author couldn't even confirm Copilot loaded the enrollment file it needed to, which is its own warning about trusting rule configs blindly.
For teams leaning on these agents to clear review backlogs, the lesson is specific: diff-bounded tools are good at diff-bounded bugs, full stop. Anything involving cross-file invariants, financial logic, or state that unfolds over time still needs a human, or a review agent built to actually ingest the surrounding codebase rather than skim the patch.
Common Questions Answered
Why did GitHub Copilot fail to catch the overbilling bug in the customer enrollment function?
Copilot missed the overbilling bug because it lived entirely outside the diff that was being reviewed. The guard clause on negative enrollment days looked correct in isolation, but the function it called was overbilling customers for 11 days straight, which was logic the diff merely touched rather than logic the diff showed. This demonstrates a critical limitation: Copilot can only analyze code changes within the specified review scope, not the broader implications of those changes on related functions.
What was the success rate of GitHub Copilot when reviewing bugs within the diff using rules?
GitHub Copilot caught 8 out of 8 bugs that were located within the diff once rules were implemented. However, this perfect performance only applied to bugs that existed within the changed code itself, highlighting that Copilot's effectiveness is highly dependent on the scope of the review and whether bugs are contained within the visible changes.
How many bugs outside the diff scope did GitHub Copilot successfully identify in this experiment?
GitHub Copilot caught 0 out of 2 bugs that existed outside the diff scope. This gap between diff-scoped review and actual bugs in related logic represents a significant limitation, as demonstrated by the overbilling case where an invariant test would have caught the issue but Copilot's diff-limited review could not.
What does the experiment reveal about the limitations of AI code review with GitHub Copilot?
The experiment shows that while Copilot can be fast and accurate enough to replace waiting for a human colleague when reviewing code within a diff, it has a critical blind spot for bugs in logic that the diff touches but doesn't show. The overbilling bug proves that a guard clause can appear correct while the function it calls silently breaks an invariant, and no amount of diff-scoped review can catch these cross-function issues.
Further Reading
- Copilot code review: Resolution reasons and expanded capabilities - GitHub Changelog
- Copilot code review: New configurations and controls - GitHub Changelog
- Copilot code review, tuned to how your team works - GitHub
- Copilot code review - GitHub Documentation