A patch is reproducible only when it works from a recorded revision with declared inputs, rather than relying on files or settings left in the author's workspace. Review the exact candidate in a separate checkout, prepare its documented environment, and run the checks there. Preserve the original workspace while investigating any difference.
This matters for coding-agent changes because an agent can create a helper, run a generator, or change local configuration and then report a successful test without including everything another checkout needs. The same failure occurs with human-written patches. The useful question is whether the delivered change contains its own required inputs.
Freeze the candidate before rerunning it
Record the base commit, candidate commit or patch, dependency lockfiles, runtime version, and commands claimed as evidence. If the candidate is an uncommitted patch, inspect what it includes: a normal diff does not automatically capture untracked files. Do not call a patch complete because it contains the files you expected to change.
For an already committed candidate, a separate detached worktree is one option:
git worktree add --detach ../candidate-check <candidate-commit>
git -C ../candidate-check status --short
Replace the placeholders with inspected values and use an unused destination. Git's worktree manual describes separate working directories and indexes attached to one repository. It does not promise separate credentials, databases, caches, ports, or every piece of repository configuration.
If you received a patch instead of a commit, create the review checkout at the specified base and inspect the patch before applying it. Git apply provides a check mode for applicability. A patch applying cleanly establishes neither behavioral correctness nor completeness of its dependencies.
Look for inputs the diff did not carry
Consider a synthetic exporter. The patch imports generated/export_schema.py. Tests pass in the working directory because a previous command created that file. The file is ignored, and the candidate includes neither a generation step nor a tracked replacement.
| Observation | Likely question to investigate |
|---|---|
| Original checkout passes; clean checkout cannot import the helper | Is generation part of the declared setup, or is the delivery missing an input? |
| Both checkouts fail before loading project code | Is the documented runtime or dependency setup incomplete? |
| Unit tests pass; an integration check uses the author's database | Is the test configuration actually isolated? |
| A test passes only after another test ran | Does the suite depend on ordering or leaked state? |
These are constructed cases, not results from a real agent run. A clean checkout exposes one class of omission; it cannot decide the correct repair. If the helper is intentionally generated, document its generator, inputs, and execution order. If it should be tracked, review that choice and include it. Copying the missing file from the author's directory merely hides the question.
Inspect ignored files when needed, without printing secret contents. Identify relevant paths and their role. A report can say that a test used an undeclared local configuration without copying credentials into the review.
Reproduce one missing build input
We created a disposable Git repository with two tracked files, .gitignore and check.py. The check imported FIELD from generated/export_schema.py and printed it. The author’s tree already contained the helper. The ignore rule covered the generated directory.
| Checkout | Inputs on disk | Result |
|---|---|---|
| Author, candidate revision | Ignored helper present | Exit 0, customer_id |
| Detached worktree, same revision | Helper absent | Exit 1, ModuleNotFoundError |
| Fresh worktree, repaired revision | Tracked fields.txt and generate.py, then ran generator | Exit 0, customer_id |
The first two worktrees pointed at the same commit. git ls-files listed only the two tracked files. git check-ignore identified the missing helper as ignored. In the repair we tracked the field list and generator, created another worktree, then ran python3 generate.py followed by python3 check.py. Copying the old helper would have made the test pass without establishing how to produce it.
Prepare the environment from the repository contract
Follow the project's supported setup. Use its declared dependency versions, fixtures, build steps, and test command. Avoid taking an old virtual environment or build directory as the baseline for the reproduction.
A shared dependency download cache may be reasonable; a shared mutable output directory can contaminate the result. Distinguish the two. If setup requires a service, use the authorized test instance and state that dependency in the evidence. A separate checkout pointed at the same production account is not an isolated test environment.
Also inspect submodules, large-file assets, generated sources, and platform requirements when they are part of the repository. “Fresh checkout” describes source state. It does not mean every supported build input has appeared automatically.
Compare the candidate with the right baseline
Run the relevant check at the candidate revision. When the result is disputed, run the same check at the intended base using the same preparation contract. This distinguishes a candidate regression from a pre-existing setup failure.
Keep the failed reproduction. If a missing setup step is repaired, record what changed and rerun the affected check. A later pass does not erase the evidence that the original handoff was incomplete.
For a bug fix, a targeted regression should challenge the original behavior and pass with the candidate. For broader review, follow the AI-generated pull request review workflow: inspect the contract, the complete diff, and the boundaries the existing checks cannot disprove.
Hand off a result someone else can assess
A useful verification record identifies the candidate revision, setup commands, runtime, dependency state, actual check results, and omissions. Attach a bounded explanation of any original-versus-clean difference.
For the exporter example, the outcome could be: “The candidate was incomplete because its import depended on an ignored generated file. After adding the documented generation step and its inputs, the same targeted check passed in a fresh checkout.” That wording is appropriate only after those operations actually ran.
The worktree exercise tested a synthetic Python patch. Its acceptance record identifies the revision, the missing generated input and the commands that passed in the repaired fresh checkout.