Sub topic 11
Limitations: why Copilot's review can be wrong
This chapter assumes you can open a pull request, read a diff, and write a short Markdown file. It also assumes you have already requested a Copilot review at least once. It explains where Copilot's review goes wrong and how to treat each kind of error. Chapter 12 covers how to fit these limits into a team process.
What kind of tool you are dealing with
Copilot code review uses a large language model. The model reads the diff and some surrounding context, then predicts review comments that look like what a careful reviewer would write. It does not execute your code. It does not run your test suite. It does not know what your team agreed on in last week's meeting.
That design explains most of the failures below. A prediction can be useful and still be wrong.
Copilot also leaves a review with the "Comment" status. It never approves a pull request and never requests changes. Its review does not count toward required approvals, so it cannot satisfy a branch protection rule on its own.
Failure mode 1: false positives
A false positive is a comment that flags a problem that does not exist. Typical causes:
- The model sees a pattern that is usually a bug, but your code handles it elsewhere. For example, it flags a missing null check when the caller already guarantees the value.
- The model lacks context outside the changed lines. A helper defined in another file may already validate the input.
- The model applies a general best practice that your project deliberately does not follow.
False positives cost reviewer time. They also train people to ignore comments, which makes real findings easier to miss.
Failure mode 2: false negatives
A false negative is a real problem that Copilot does not mention. A clean Copilot review does not mean the pull request is correct. Copilot is less reliable at:
- Logic errors that depend on business rules not written in the code.
- Concurrency problems, such as race conditions between two services.
- Performance regressions that only show up with production-sized data.
- Security flaws that depend on how several components interact.
- Missing changes, such as a migration or config update that should have been part of the pull request but is absent from the diff.
The last item is hard for any tool that reads only the diff. Nothing in the diff shows what is missing.
Failure mode 3: suggestions that look right but are not
Copilot often attaches a suggested change that you can commit with one click. The suggestion is generated text. It may fail to compile, break a test, change behavior subtly, or use a function that does not exist in your version of a library.
Here is an example. A reviewer comment suggests replacing a loop with a shorter expression:
def total_price(items):
total = 0
for item in items:
if item["qty"] > 0:
total += item["price"] * item["qty"]
return totalA plausible suggestion is:
def total_price(items):
return sum(item["price"] * item["qty"] for item in items)The suggestion is shorter, but it drops the qty > 0 check. Items with a negative quantity, such as refunds or bad data, would now reduce the total. The code is cleaner and behaves differently. Only someone who knows the rule can tell whether that matters.
Before you accept a suggestion, compare behavior and not only style. Then run the tests after you commit it.
Failure mode 4: non-determinism
Requesting a review twice on the same commit can produce different comments. The model samples its output, so wording, ordering, and even which issues are mentioned can vary. Re-requesting after you push new commits can also surface comments on code you did not change, because the second pass notices something the first one skipped.
This has practical consequences:
- Do not treat one review as a complete audit.
- Do not use Copilot's output as a pass/fail gate in automation.
- Do not assume a problem is fixed because the next review no longer mentions it. Verify the fix directly.
Failure mode 5: limited context
The model can only consider a limited amount of text at once. Large pull requests make this worse. Copilot may focus on part of the diff, skim the rest, or leave few comments on a big change. It may also miss how a change affects files that were not modified.
Smaller pull requests get better reviews, from Copilot and from humans. If a review of a large pull request looks thin, split the pull request and request review on each part.
Some file types and generated or very large files may also receive little or no attention. Check the current GitHub documentation for exclusions, since they change over time.
Failure mode 6: custom instructions that do not take effect
The instruction files from the earlier chapters steer reviews but do not control them. Common reasons guidance is ignored:
- The file is too long. GitHub's documentation has stated that Copilot code review reads only the first part of an instruction file (about 4,000 characters when this was written). Put the most important rules first, and confirm the current limit in the docs.
- The rules are vague. "Write high-quality comments" gives the model nothing concrete to act on.
- The rules ask for things outside what review can do, such as changing the review's format, linking to external sources, or running a tool.
- The rules contradict each other, for example a repository file saying one thing and a path-specific file saying another.
- The file is in the wrong place or has a wrong
applyTopattern, so it never applies to the files you intended.
Compare a weak and a stronger version:
# Review guidelines
- Be thorough and catch all bugs.
- Make sure the code is good.# Review guidelines
- Flag any SQL built with string concatenation or f-strings.
- Flag functions that catch a broad exception and then continue silently.
- Do not comment on formatting; the linter enforces it.The second version names observable patterns. The model can check each one against the diff. Even so, instructions raise the chance that Copilot checks something. They do not guarantee it.
Failure mode 7: confident tone
Copilot's comments are written in fluent, assured language whether or not they are right. Tone carries no information about accuracy. A wrong comment reads the same as a correct one.
Treat each comment as a hypothesis. Look for a concrete claim, such as "this will throw if the list is empty," and check it by reading the code or writing a quick test.
Triage: deciding what to do with each comment
A repeatable routine keeps you from either obeying or dismissing everything.
Some practical habits go with this routine:
- Read the whole comment, not only the suggested change.
- Reproduce the claimed problem when you can. A failing test beats an opinion.
- When you dismiss a comment, leave a one-line reason. It helps the next reader and tells you which rules to add to your instruction file.
- If the same false positive keeps appearing, add a specific rule to your custom instructions that tells Copilot not to flag that pattern.
Data and policy limits
Two further limits are not about accuracy.
- Availability depends on plan and settings. Features differ by Copilot plan, and organization owners can restrict them. If a teammate does not see the same options you do, check plan and policy first.
- Code leaves your machine. A review sends the diff and context to GitHub's service. Check your organization's data policies before enabling it on repositories with sensitive code.
Quick reference
| Limitation | What you see | What to do |
|---|---|---|
| False positive | A comment about a problem that does not exist | Verify, dismiss with a reason, add an exclusion rule if it repeats |
| False negative | A clean review of a flawed change | Keep human review and tests as the real checks |
| Faulty suggestion | A one-click change that alters behavior | Compare behavior, run tests after committing |
| Non-determinism | Different comments on the same commit | Do not gate merges on one run |
| Limited context | Thin review of a large pull request | Split the pull request |
| Ignored instructions | Rules never reflected in comments | Shorten the file, make rules concrete, check `applyTo` |
| Confident tone | Wrong comments that read as certain | Treat each comment as a hypothesis |
Summary of the working model
Copilot's review is a fast, cheap first pass that is sometimes wrong in both directions. It is good at spotting common patterns and small mistakes. It is poor at anything that depends on knowledge outside the diff. Use it to catch issues early, and keep tests and human review as the checks that decide whether a change merges.
Exercise
Copilot reviews your pull request and leaves no comments. A teammate says this means the code is safe to merge. Give two reasons the teammate's conclusion is not justified.
Show answer
First, Copilot can produce false negatives. It reads mostly the diff, so it can miss logic errors that depend on business rules, interactions with unchanged code, and changes that are absent from the pull request. Second, its output is non-deterministic and its review has the "Comment" status, so it is not an approval and does not count toward required reviews. A second run might even raise issues the first skipped. Tests and a human review are still needed.
Exercise
Your repository instruction file is long and starts with a list of formatting preferences. The security rules you care about are at the bottom. Copilot's reviews never mention those security rules. What is the likely cause, and what two changes would you make?
Show answer
Copilot code review reads only the first part of an instruction file (a limit of about 4,000 characters was documented when this chapter was written), so the rules at the bottom are probably never read. Move the most important security rules to the top and shorten the file. Also drop the formatting preferences, since a linter should enforce formatting, and rewrite the remaining rules as concrete patterns visible in a diff.
Exercise
Copilot suggests replacing a loop with a one-line sum(...) and offers a one-click commit. What should you check before committing, and what should you do afterward?
Show answer
Check whether the new code behaves the same as the old code, including edge cases and filters the loop applied, such as skipping items with a quantity of zero or less. After committing, run the tests, because a suggestion is generated text and can change behavior or fail to compile.