Sub topic 15
Deciding to Accept, Revise, or Reject
What this chapter assumes
You have used an AI coding assistant and read Git diffs. You can run unit tests. You have also met the earlier steps of this process: checking the change against the requirement, reading the diff, verifying dependencies, reviewing security, and collecting evidence from tests and static analysis.
This chapter covers the last step. You have a pile of evidence, and you must turn it into one of three outcomes: accept, revise, or reject.
The three outcomes
Every AI-generated change ends in one of these outcomes. Pick one on purpose, and do not drift into one because you are tired.
| Outcome | What it means | Typical trigger |
|---|---|---|
| Accept | The change goes in as it is, or with trivial edits you make yourself. | Meets the requirement, checks pass, no unresolved concerns. |
| Revise | The approach is sound, but specific defects need fixing before it goes in. | Missed edge case, weak tests, style mismatch, a small security flaw. |
| Reject | You discard the change and start again, often with a better prompt or a different method. | Wrong design, solves a different problem, invented APIs throughout. |
Revise is the most common outcome. Accept should be earned by evidence. Reject is cheap with AI output, because regenerating costs seconds. Reviewers often hold on to a bad change because they have already spent time reading it. That is the sunk-cost trap, and it is more costly here than with human code.
Deciding by evidence, not impression
Code that reads well is not evidence. Plausible code is what an AI assistant produces by default. Base the decision on things you observed.
Ask these questions in order:
- Does it solve the stated requirement? If not, nothing else matters. This is a reject or a major revise.
- Is anything blocking? Blocking problems are a hallucinated package or API, a security flaw, data loss risk, or failing tests. One blocking problem rules out an immediate accept.
- Is the evidence sufficient? Tests that pass prove something only if they exercise the risky behavior. If no test covers the edge cases you found, you have no evidence yet.
- Can you explain every line? If you cannot say why a line is there, you do not understand the change well enough to own it.
- Is the fix cheaper than a rewrite? If repairing the defects needs more effort than regenerating or writing it yourself, reject.
The fourth question is the one people skip. After you accept, you are the author of record. Your name will be on the commit, and you will be the one paged when it fails.
A decision flow
The diagram shows how the questions combine. Blocking problems and understanding are checked before polish.
Note the loop at the bottom. A revised change goes back through review. Do not assume a fix worked because you asked for it. Assistants often fix the named problem and break something nearby.
Accepting part of a change
Accept and reject are not all-or-nothing. A diff may contain a good new function and an unrelated rewrite of a helper you did not ask about. Stage only what you reviewed.
# See which files changed and how much
git diff --stat
# Stage hunk by hunk; answer y (stage), n (skip), s (split), e (edit)
git add -p
# Check exactly what is about to be committed
git diff --cached
# Discard the unreviewed remainder in one file you decided to reject
git restore path/to/unwanted_change.pygit add -p forces a decision on each hunk, which is what review needs. Use s to split a large hunk into smaller ones. Use e to edit a hunk when most of it is right. Run git diff --cached afterward, because it shows what will be committed and not what is merely in your working tree.
The command git restore throws away uncommitted edits in that file, and Git cannot bring them back. Run it only when you are sure. If you might want the code later, run git stash first or commit it to a scratch branch.
Revising: giving feedback the assistant can act on
When you choose revise, you can fix the problem yourself or send it back to the assistant. Fix it yourself when the change is a line or two. Send it back when the fix is mechanical but wide.
Vague feedback ("make it more robust") produces vague changes. Good feedback names the defect, the evidence, and the expected behavior:
- Defect:
averagedivides bylen(values). - Evidence:
average([])raisesZeroDivisionError. - Expected behavior: raise
ValueError("values must not be empty")and add a test that pins it.
Ask for the smallest change that fixes the defect, and say what must not change. Then re-read the new diff in full. A revision can quietly alter code you already approved.
Here is the shape of a finished revision. The original function had no guard, and the requirement never mentioned empty input. The revision adds the guard and tests that outlast the review:
import pytest
def average(values):
if not values:
raise ValueError("values must not be empty")
return sum(values) / len(values)
def test_average_of_numbers():
assert average([2, 4, 6]) == 4
def test_average_of_empty_list_raises():
with pytest.raises(ValueError):
average([])The decision here is accept after one revise cycle. The blocking problem was found, fixed, and covered by a test. You can explain every line.
Rejecting: when to throw it away
Reject when the problem is the foundation and not the details. Common signs:
- The change solves a different problem than the one you stated.
- It invents several APIs or packages, which suggests the assistant had no grounding in your actual libraries.
- It adds a new architecture, framework, or abstraction you did not request.
- Fixing it would touch most of its lines.
- Each revision round introduces new defects at the same rate as it removes old ones.
Rejecting is not the end of the work. Work out why the attempt failed, because the cause is often the prompt. Ask whether you gave enough context, such as the existing function signatures, the library version, or the constraint that ruled out a rewrite. Then regenerate with a narrower task, or write it by hand. Also consider splitting the task. A change that is too large to review is a common reason for rejection, and the fix is smaller requests.
Using a second AI pass in the decision
A second AI review can raise questions you missed, such as an unhandled error path or a risky call. Treat its output as a list of leads to check yourself. It is not a verdict. A reviewer model shares blind spots with the generator, and it can also report problems that do not exist. If it says "no issues found," you have learned nothing certain. The decision still depends on tests you ran, tools you ran, and lines you read.
Recording the decision
Leave a trace for the next person. Write a commit message that says what the change does and mentions anything notable about how you reviewed it. For example, note that you added tests for the empty-input case. If your team requires disclosure of AI assistance, follow that policy. In a pull request, summarize which parts you accepted, revised, or dropped. This helps later debugging, because a future reader can see which behavior was verified and which was not.
Common errors in the decision itself
- Accepting because the tests pass. The tests may be the assistant's own, written to match its code, and may never touch the risky input.
- Accepting because the diff is short. Short diffs can hide dangerous one-line changes, such as a loosened permission check.
- Revising endlessly. Set a limit. After two or three rounds without convergence, reject and rethink the request.
- Rejecting the whole change for one flaw. If only a single hunk is bad, stage the rest and drop that hunk.
- Skipping the second look after a revision. The revised diff is a new change and needs review.
Exercise
An assistant adds a fetch_report function. Your review finds that it imports a package that does not exist on the package index, and it calls two methods that your HTTP client library does not have. The rest of the function is about 15 lines. What outcome do you choose, and why?
Show answer
Reject, or at most a full rewrite by you. Invented packages and methods mean the assistant had no grounding in your actual dependencies, so the logic built on them cannot be trusted line by line. Fixing it would touch most of the function, which costs more than regenerating with context (the client library name, version, and real method signatures) or writing it by hand. Both problems are blocking.
Exercise
You run git diff on an AI change and find two hunks. Hunk 1 adds the requested average guard and tests. Hunk 2 reformats an unrelated module. Which commands let you accept only hunk 1 and discard hunk 2, and what should you check before committing?
Show answer
Run git add -p, answer y for hunk 1 and n for hunk 2. Then run git diff --cached to confirm only hunk 1 is staged. Discard the unwanted edit with git restore on that file (after a git stash if you might want it later). Also run the tests on the staged state before committing.