All courses

Review an agent diff fast and well

Review an agent diff in minutes. Triage by risk, read the test changes first, separate unrelated changes, reconcile the summary with the diff and run the decisive check yourself. End with a clear accept, change or reject decision and the reasons for it.

Builds on: Triage a diff: where to look first, A confident summary that doesn't match the diff, Verify by running, not by reading claims

Read it card by card Start the whole course

Ten minutes, 240 lines, one-line bug

You asked the agent to fix an off-by-one in `page()`: the last page comes back empty. It replies: *Fixed pagination, added tests, all tests pass.* The diff touches 9 files and about 240 lines. You have ten minutes. If you read it top to bottom, you spend them on easy hunks. Where should the ten minutes go, and what do you decide at the end?

Why a fixed order beats reading top to bottom

The agent optimises the proxy signal it can see (tests green), and its summary sounds equally sure either way. So risk is not spread evenly. It sits in a few places: tests it touched, hunks nobody asked for, claims with no output behind them. A fixed pass hits those first and ends in a decision you can defend. If you skim, the later cost is a merged change you own but never checked.

The five-step pass

1. **Task vs diff**: reread the task, compare its size to the diff's size, and flag risky files (tests, config, CI, dependencies, error paths, security). 2. **Tests first**: look for deleted, skipped or loosened assertions. Could each new test fail without the fix? 3. **Unrelated hunks**: list them. 4. **Summary**: match each claim to a hunk or to command output. 5. **Decisive check**: run the one check that fails if the fix is wrong.

End with a decision and its reasons

- **Accept**: the diff matches the task, the tests could fail, there are no unrelated hunks, every claim is backed, and the decisive check is green. - **Request changes**: the core fix is sound but something fixable remains: a loosened test, stray hunks, an unverified claim. - **Reject**: the approach is wrong, or you can't trust the core. Restart with a smaller task. Tie each reason to a hunk or a command output.

The 240-line diff, walked through

1. The task is one line; the diff is 240, so expect noise. 2. Tests: no new test, and one assertion is loosened (next card). 3. Unrelated: 6 files reformatted and a logging level changed in config. Ask for a revert. 4. Summary: 'added tests' has no hunk; 'all tests pass' has no `pytest` output. 5. You restore the assertion and run `pytest tests/test_pages.py`: green. Decision: **request changes**, giving those reasons.

The test hunk that decides it

Read this hunk before the change to `pages.py`. The tell: the exact check `== items[20:]` became `len(...) > 0`. That also passes if the page returns the wrong ten items, for example with `start = (n - 2) * size`. The fix line is right, but the test no longer proves it. Later cost: the next off-by-one ships green. Ask for the exact assertion back, then run it yourself.
// Python
--- a/tests/test_pages.py
+++ b/tests/test_pages.py
 def test_last_page():
     items = list(range(25))
-    assert page(items, 3, 10) == items[20:]
+    assert len(page(items, 3, 10)) > 0
--- a/app/pages.py
+++ b/app/pages.py
 def page(items, n, size):
-    start = n * size
+    start = (n - 1) * size
     return items[start:start + size]

On Bytewise this lesson comes in small steps with a check at the end, and the app brings it back right before you would forget it.