Sub topic 4
Reading Copilot's review comments
This chapter assumes you can open a pull request on GitHub, understand a diff, and have already requested a Copilot review as described in the previous chapter. It covers what a Copilot review contains, how to judge each comment, and the mistakes readers commonly make.
What a Copilot review looks like
When Copilot finishes, it posts a review on the pull request with the status "Comment". It never uses "Approve" or "Request changes". For that reason, Copilot's review does not count toward required approvals and cannot block a merge.
A review has two parts:
- Overview. A short summary at the top of the Conversation tab. It says in general terms what Copilot looked at and how many comments it left.
- Inline comments. Notes attached to specific lines in the Files changed tab. Each one names a concern and often includes a suggested change.
Copilot may also report that it reviewed a file and found nothing to say. A review with no inline comments means it found nothing it chose to flag. It does not mean the code is correct.
Anatomy of an inline comment
Most inline comments have the same shape:
- A statement of the problem, tied to the lines it is attached to.
- A reason, such as a possible bug, a security risk, or a missing check.
- Sometimes a suggested change, shown as a diff you can commit directly.
Read the explanation before the suggestion. The explanation tells you what Copilot believes is wrong. The suggestion is only one way to fix it, and it may not be the best one.
Judging each comment
Treat every comment as a claim to check. A practical routine:
- Open the lines the comment points to and read the surrounding code, not just the highlighted lines.
- Decide whether the stated problem is real in this context.
- If it is real, decide whether the suggested fix is correct and fits your codebase.
- If it is not real, note why so a human reviewer does not repeat the question.
You can sort comments into rough categories to decide how much attention they need:
| Category | Example | Typical action |
|---|---|---|
| Correctness | Off-by-one error in a loop | Verify, then fix |
| Security | SQL built by string concatenation | Verify, then fix with high priority |
| Missing tests | New public function with no test | Add a test or explain why not |
| Style | Naming or formatting | Usually ignore if a linter handles it |
| Incorrect or irrelevant | Complains about code that is not in the diff | Dismiss |
Copilot is more reliable on local issues visible in the changed lines than on problems that depend on code elsewhere in the repository.
A worked example
Suppose a pull request adds this function:
import sqlite3
def find_user(conn: sqlite3.Connection, name: str):
query = "SELECT id, email FROM users WHERE name = '" + name + "'"
return conn.execute(query).fetchone()Copilot might leave an inline comment on the query line saying that building SQL with string concatenation allows SQL injection, and suggest a parameterized query:
import sqlite3
def find_user(conn: sqlite3.Connection, name: str):
query = "SELECT id, email FROM users WHERE name = ?"
return conn.execute(query, (name,)).fetchone()This comment is correct. The claim is real, the reason is specific, and the fix matches how sqlite3 takes parameters. You would still run the tests, because the function now relies on the driver's placeholder syntax. Other drivers use %s or named parameters, so the same suggestion could be wrong in a project that uses a different database library.
Common errors when reading reviews
- Treating silence as approval. No comments only means nothing was flagged. A human still has to review.
- Accepting suggestions without reading them. Apply a change only after you understand it.
- Fixing style comments your linter already covers. This adds noise to the history.
- Ignoring a comment because the suggested fix is poor. The underlying concern can still be valid. Fix it your own way.
- Expecting identical results on each run. Copilot's output is not deterministic, so a second review of the same code can raise different points.
The next chapter covers how to apply and dismiss suggestions.
Exercise
A Copilot review on your pull request has the status "Comment" and no inline comments. Can you merge without a human review if your repository requires one approval? Explain.
Show answer
No. Copilot's review has the status "Comment" and does not count as an approval, so the required human approval is still missing. Having no inline comments also does not prove the code is correct. It only means Copilot did not flag anything.
Exercise
Copilot comments that a query is built by string concatenation and suggests a fix using %s placeholders. Your project uses sqlite3. What should you do?
Show answer
Accept that the concern is valid, but do not apply the suggestion unchanged. sqlite3 uses ? placeholders, so use ? with a parameter tuple, then run the tests.