Reviewing AI Agent Code Changes: Per-Hunk Review
Agents write code faster than you can read it. Review small diffs on isolated branches, read tests first, and accept, reject or comment hunk by hunk.
GuideUpdated 8 min read
On this page
Your agent finished in four minutes and left you a diff that will take forty to read. People on Hacker News say this plainly: code review was always a bottleneck and is more of one with agentic coding. The fix is not reading faster. It is making each diff smaller, isolating where it lands, and checking that the tests mean something.
Why review becomes the bottleneck with AI agents
An agent can touch a dozen files in the time it takes you to read one. The problems people report are specific:
- Tests that embed the bug. Commenters note that tests written by agents can encode the very bugs they should catch. A green run then proves little.
- Silent edits. One commenter listed failures with Windsurf (its changelog now says "Windsurf is now Devin Desktop"): code deleted without notice, duplicated code, and an "Accept changes" button that didn't work. We can't verify these, and they are one person's account. The lesson applies to any tool: don't let an in-editor accept button be your only record. Check the real git diff.
- Mixed-up changes. If two agents write into one checkout, you can't tell whose change is whose.
- Big tasks, big diffs. "Clean up the auth module" produces a diff nobody reads carefully. "Fix the flaky login test and explain the root cause" does not.
Each fix below targets one of these.
| Problem | Symptom | Fix |
|---|---|---|
| Weak tests | Green run, bug still there | Read test changes first; confirm they fail without the fix |
| Silent edits | Deleted or duplicated code | Review the real git diff, hunk by hunk |
| Shared checkout | Can't tell who changed what | One branch and worktree per agent |
| Oversized task | Diff too long to hold in your head | Split the task before starting |
Review agent changes with plain git
This works with Claude Code, Codex CLI, Gemini CLI or anything else that edits files in a repo.
Give each agent its own branch and worktree
A worktree is a second checkout of the same repo on its own branch. Agents can't overwrite each other, and your own files stay put.
git worktree add -b agent/fix-login-test ../myrepo-fix-login mainThis creates the branch agent/fix-login-test from main in a sibling folder. Start your agent in that folder. To clean up afterward (git refuses if the worktree has uncommitted changes):
git worktree remove ../myrepo-fix-login
git branch -d agent/fix-login-testgit branch -d refuses to delete an unmerged branch, so it won't throw work away. For more on running several agents this way, see Claude Code worktrees and running multiple Claude Code agents in parallel.
Read the size first, then the tests, then the code
From the main checkout, list what changed since the branch left main:
git diff --stat main...agent/fix-login-testThe three dots mean "changes on the branch since it diverged". Then read the test files before the source files (adjust the path to your project):
git diff main...agent/fix-login-test -- tests/Ask three questions of every test change:
- Does the test fail without the fix? A test that passes both before and after checks nothing.
- Did the agent edit an existing test to make it pass? Weakened assertions and deleted cases turn red to green cheaply.
- Does it assert behavior, or only repeat what the code does?
Go through the changes hunk by hunk
In the agent's worktree, if its changes are uncommitted:
git add -pGit shows one hunk at a time. Press y to stage, n to skip, s to split a large hunk, e to edit, q to quit. Anything you didn't stage is something you haven't accepted. New files the agent created are untracked, so git add -p won't show them until you run git add -N <file> (intent to add).
git restore -p .It asks about each hunk with the same keys. Commit what you staged, then merge the branch.
What plain git can't do
It has no place to send a comment back to the agent, and it doesn't remember which hunks you've seen if you stop halfway. Nothing stops you merging a branch you only skimmed.
Review agent changes hunk by hunk in Sledbot
Sledbot runs CLI coding agents in real terminals and, by default, starts each one in its own git worktree. The Work in a new worktree option on the New task page is on by default for git repos, with a branch field that starts with agent/…. Worktrees live at <repo>/.sledbot/worktrees/<branch with / replaced by ->. See starting agents for the full task page.
Open the review
Use any of these:
- Review changes in the agent session header, the details rail, the inspector or the terminal's More menu
- Agents > Review Changes
- Review on the agent's card on the Board
The inspector's Changes section already shows the branch, how far ahead or behind it is, and up to 12 changed files, so you can judge the size before you open anything.
The review header shows Review with the agent name, <branch> → <base> and a reviewed/total counter. The base is the sled.base label if set, otherwise the repo's default branch, otherwise main.
Accept, Reject or Comment on each hunk
| Action | Key | What it does |
|---|---|---|
| Accept | A | Stages this hunk in the worktree |
| Reject | R | Reverse-applies the hunk, restoring the original |
| Comment | C | Sends your comment, with file and line, to the agent's terminal |
Move to the next hunk with J (or F7) and back with K (or ⇧F7). Send a comment with ⌘↩ and cancel with Esc. Switch between Show Inline and Show Side by Side in the header, and use Next File to Review to skip ahead.
Comment is the one that saves time. Instead of rejecting a hunk and re-explaining the task, you point the agent at the exact file and line and let it fix its own work.
Merge or open a PR only after everything is reviewed
Merge and Open PR stay disabled until every hunk is reviewed ("Review every change first"). That is the hard stop plain git lacks.
- Merge asks "Merge
<branch>into<base>?". Uncommitted changes in the agent's worktree are committed first, then Sledbot runsgit merge --no-ff --no-editin the main checkout, which must be on the base branch. - Open PR commits, runs
git push -u origin <branch>andgh pr create --fill, then opens the URL. It needs the GitHub CLI (gh). See GitHub in Sledbot.
The full screen is described in Review an agent's changes.
Compare agents instead of trusting one
For a risky change, run the same task with 2 to 4 agents. Agents > Compare Agents… gives each its own worktree on a compare/<slug>-<agent>-<n> branch and opens them side by side. Review each when they finish. This needs a git repo.
Set limits before unattended work starts
A delegated job runs headless in its own copy of the project. Only Claude Code, Codex, Gemini CLI and OpenCode are supported. In the Delegate sheet, under Checks:
- Done when holds verify commands, frozen at submit.
- May change and Never touch take globs. Put
tests/**under Never touch to protect your existing tests. - Caps limit turns, minutes and dollars.
- Review budget limits what you must review: 1 to 50 items (default 8) and 100 to 20,000 lines (default 1,500).
When the job finishes, open its Changes tab, use Collect & review, then Integrate…. If any file conflicts with your edits, nothing is written, and files it overwrites are backed up first. Details: Delegated jobs and Night shift.
Sledbot does not review the code for you. It makes the reading smaller and harder to skip.
Which method to use
| Plain git | Sledbot review | |
|---|---|---|
| Isolated branch per agent | git worktree add by hand | Default for git repos |
| Hunk-by-hunk accept/reject | git add -p, git restore -p | Accept / Reject (A / R) |
| Feedback to the agent | Type it into the terminal | Comment (C) with file and line |
| Block merging unreviewed code | Your discipline | Merge and Open PR wait for all hunks |
| Cost | Free | Part of MacSuite |
Pick plain git if you run one agent at a time and are comfortable with git add -p. Pick Sledbot's review if you run several agents, or want a counter and a merge gate. Sledbot is part of MacSuite ($349 one-time, as of November 2026), with a 7-day trial per app.
Checklist before you merge
- The agent worked on its own branch, not your main checkout.
- You read the test changes first and each new test fails without the fix.
- No existing assertions were weakened or deleted.
- Every hunk was accepted, rejected or commented on.
git diff --statmatches what you expected the task to touch.
If it doesn't work
- Merge and Open PR are disabled. Some hunks are unreviewed. Check the
reviewed/totalcounter and use Next File to Review. - "Merge failed: The main checkout is on X, not
<base>." The merge runs in your main checkout. Switch it to the base branch and retry. - "Couldn't open a pull request: …" Open PR needs
gh, signed in. Use Connect GitHub from the Getting started card or the ⌘K palette. - "This agent hasn't changed anything compared with
<base>." Either nothing changed, or the base isn't the branch you expect. Check thesled.baselabel. - No worktree for a task. Worktrees need a git repo. The compare sheet says the space "isn't a git repository, so agents can't get separate worktrees."
- Unsure what the agent did between turns. In a git work tree, Sled Core snapshots the tree at each turn end into private refs. Only the command line reads them:
sled checkpoint lsandsled checkpoint diff. There is no checkpoint screen in the app.
If something still fails, contact support through the support page and include the exact message, the agent name and the steps you tried:
Subject: Sledbot review: Merge disabled / error
Sledbot version: <version>
macOS: <version>
What I did: opened Review changes on agent "<name>", reviewed all hunks
What happened: <exact error text or behavior>
Base branch: <branch> gh signed in: yes/noCommon questions
How big should a reviewable diff be?
There's no universal number. A useful test is whether you can explain every hunk without reading it twice. The job Review budget defaults (8 items, 1,500 lines) are a starting point, not a rule.
Does this work with Claude Code and Codex CLI?
Yes. Sledbot runs both in its terminals, and the review compares whatever the agent changed in its worktree against the base branch.
Should I let the agent write the tests?
It can draft them. Read them first, confirm they fail without the fix, and list your existing tests under Never touch when you delegate a job.
Can I review changes I already committed?
The review compares the agent's worktree against the base branch, so committed work on that branch shows up too. Plain git does the same with git diff main...<branch>.