Topic 2 of 5 · 4 min read
Answering review feedback on agent-written code
Goal: Respond to a review thread on code your agent wrote by owning each point and resolving it with a fix or a reasoned reply.
If your agent wrote it, you own it: answer every review comment with a fix, evidence or a reasoned "no", never with "the AI did that". The reviewer is reviewing you, and you are accountable for what you open for review.
Check yourself · 1 of 3
A reviewer questions a function your agent wrote, and you do not know why it works that way. What is the best first step?
Why it matters
Reviewers have a hard time with agent-written pull requests. They cannot ask the author what they were thinking, and the human who opened it may not know either. If the reply is "Claude wrote that", the reviewer learns that nobody understood the change, and trust falls fast. If the reply is "good catch, fixed in this commit, and I added a test", the review is cheap for everyone.
How to answer a thread
- Read the code again yourself first. Do not paste the comment to the agent and paste the answer back. Decide whether the reviewer is right.
- Pick one of three replies. Fix: change it and say which commit. Evidence: show a test, a log or a doc that proves the code is right. Decline: explain the trade-off and offer an alternative or a follow-up ticket.
- Ask the agent to fix, then check its work. Give it the comment, the file and the test to add. Read the new diff; agents often fix the quoted line and nothing else.
- Fix the pattern. If a comment says "this lacks a null check", look for the same flaw elsewhere in the change before you reply.
- Resolve with a note. Close a thread with one line saying what changed. Leave it open when you disagree and wait for the reviewer.
- Keep the pull request on topic. Do not let the agent add unrelated changes while it addresses comments.
Before and after
Weak reply:
The AI generated this and the tests pass, so I think it's fine.
Better reply:
Fair point:
parse_amountaccepted negative values. Fixed ina3f9c1with a check and two tests (-5,-0.01). I also found the same gap inparse_discountand fixed it there.
The second reply shows ownership, evidence and a wider search.
What goes wrong
- Blaming the tool. It shifts the problem to the reviewer instead of solving it.
- Defending by reflex. Treating a question as an attack; a question usually means the code was unclear, which is itself a fix.
- Blind relay. Pasting comments to an agent and approving whatever returns. The second diff needs review too.
- Silent changes. Fixing without saying so, so the reviewer has to re-read everything.
Examples
Declining with evidence
Reviewer: "Why not use a transaction here?" Reply: "The two writes touch different databases, so one transaction cannot cover them. I added a compensating delete on failure and a test for it (test_refund_rollback). Happy to move this to a saga in a follow-up if you want; I opened #482."
The relay trap
An agent fixes a comment about a missing null check on line 40. The human approves the new commit unread. Line 58 has the same flaw and ships. The fix is to search for the pattern, not only the quoted line.
Key points
- You are accountable for agent-written code you open for review; never answer with "the AI did it".
- Read the code and decide for yourself before you ask an agent to change it.
- Reply to each thread with a fix, evidence or a reasoned decline, and say which one.
- Check the agent's fix, because it often repairs only the quoted line.
- Look for the same flaw elsewhere in the change before you answer.
Common mistakes
- Replying "the AI wrote this" instead of owning the change.
- Pasting reviewer comments to an agent and pushing the result without reading it.
- Fixing only the quoted line and missing the same flaw nearby.
- Resolving threads without saying what changed, or arguing before reading the point.
Check yourself · 2 of 3
Which reply to a review thread is the strongest?
Check yourself · 3 of 3
After an agent fixes the line a reviewer quoted, what should you do before replying?
Practice items, not counted towards your mastery.
Start here
- Google Engineering Practices: code review (opens in a new tab)ArticleFree
The reviewer and author guides, written for teams that review every change.
- How to write code review comments (Google Engineering Practices) (opens in a new tab)ArticleFree
Kind, specific comments that explain why and leave the decision to the author.
- How to handle reviewer comments (Google Engineering Practices) (opens in a new tab)ArticleFree
How an author answers feedback, resolves disagreement and avoids taking it personally.