Learning center

Check a coding agent's handoff before you review its change

Compare the agent's summary with the repository and the command results before you read the code. Four checks take a few minutes: the diff against the stated scope, the commands against their exit codes, the tests against the old code, and the list of what was not run.

A summary is a claim#

"Fixed the export limit, added a test, all tests pass" contains four claims. Each has a record that can disagree:

ClaimRecordWhat disagreement looks like
Fixed the export limitgit diff --stat BASE HEADFiles outside the export changed
Added a testThe test on the old codeIt passes before the fix too
All tests passThe command, its count and exit codeA filter selected none of them
Nothing else was neededSkips, ignores and configuration in the diffA failing test became a skip

A person's handoff makes the same claims. With an agent, the prose is often more fluent than the evidence behind it, so the records matter more.

The four checks#

git diff --stat BASE HEAD
git diff BASE HEAD -- '*test*' '*spec*' | grep -nE '^\+.*(skip|todo|only|xfail|fixme|retries)'
git diff --name-only BASE HEAD -- '*lock*' '*.config.*' '.github/'

Matches are a reason to read that line. A skip may be correct and explained, and an empty result does not clear the change: a weakened assertion contains none of those words. To see weakened assertions, read the removed lines in test files with git diff BASE HEAD -- '*test*' | grep '^-'.

Then run the new test against the old code:

git worktree add ../before BASE
git -C ../before checkout HEAD_SHA -- tests/export.test.ts

Run the test in ../before. It should fail, and for the stated reason. A missing import is also a failure, and it proves nothing about the defect. If the test passes there, it does not test the fix. The regression test guide covers what to do next.

Ask for a receipt in the handoff#

Give this to whoever or whatever prepares the change:

  1. Base and head commit.
  2. Each command, verbatim, with its exit code and the number of tests it ran.
  3. Files changed outside the task, with the reason.
  4. Assumptions made where the task was unclear.
  5. What was not run, and why.

An agent can produce a list like this without having run anything, so sample it. Rerun one command from item 2 and compare the count. If that count differs, treat the other lines as unverified.

Decide#

Result of the checksNext decision
Scope matches, test fails before and passes afterReview the code
Extra filesAsk for them to be split or explained first
Test passes on the old codeReturn it. The fix is untested, whether or not it is right
A count cannot be reproducedRun the whole suite yourself before reading further

Worked example#

This example is fictional. An agent reports "12 tests pass". Its command used a name filter, and the runner printed 12 skipped and exited 0. The diff is in scope. The new test, run on the base, fails with the wrong row count, which matches the claim. So the fix is likely right and the pass count was wrong. Ben runs the full suite, finds one failure in a neighboring module, and returns the change with that single result.

Filters deserve their own check, which the collection's first guide describes. Finding by finding, see fixing findings with a coding agent.

One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. Eligibility and fair-use terms.

Start free with GitHub

Related reading