Agent-to-human handoff: taking over a half-finished branch
Stefan-Iulian Tesoi · · 6 min read

Start from what the agent wrote down, not from the branch: what it tried, what it verified, and where it stopped and why. If there is no such note, treat the branch as unverified, rerun the tests, re-read the acceptance criteria, and only then decide whether continuing it is cheaper than restarting from the work item.
An agent-to-human handoff happens more often than teams plan for. A coding agent hits a usage limit, a permission it lacks or a question the item never answered, and stops with a branch half built. Somebody else, usually the person who reviews its work, has to decide what that branch is worth.
What makes an agent-to-human handoff hard?
The branch looks more finished than it is. The commits are tidy and the messages confident, and nothing on the branch says which parts were checked and which were only written.
A colleague leaving work half done would say so in a sentence: the migration is done, the endpoint is not tested, do not trust the fixture. An agent stopped by a usage limit, a closed terminal or a cancelled run says nothing, unless the workflow made it write that sentence before it stopped. The person taking over has the diff and has to reconstruct the intent from it.
The branch can also hold work that is not its own. We ran four agents in parallel on one machine, each in its own worktree. Every worktree of a repository shares one stash, because the git worktree documentation makes every ref under refs/ shared, and one agent popped another agent's stash entry. The branch that came back held a second item's work under the first item's name, and none of its commits said so.
A team that has to take over AI pull request branches every week has a different problem: its items are too large to finish in one run, or its agents stop without notes. Both are fixed in the item and the workflow, not in the takeover.
The note an agent should leave when it stops
Four facts, written where the next person will look rather than in a chat transcript that closes with the session. A handoff note that covers them turns an afternoon of reading into ten minutes:
- The goal it was working towards, in the item's words, and which acceptance criteria it believes are met.
- What it verified and how: the commands it ran and their exit codes, not "tests pass".
- What it tried that failed, so the next person does not try it again.
- Where it stopped and why: the file, the step, and the question or limit that stopped it.
Handoff notes belong on the work item, or in the description of a draft pull request opened as soon as the branch exists. An agent that stops and says so when it is stuck has written most of this already. In Laimonade an agent raises that stop with report_blocker, which puts the impediment on the item where a person sees it without being asked.
The evidence part is the same as for finished work. What a coding agent should return with a submission is what it should leave behind when it stops short of one.
Continue or restart: how do you decide?
Restart when re-running the item would cost less than understanding the branch. Agent work is cheap to generate and expensive to audit, which reverses the usual instinct to save what was written.
| Situation | Better choice |
|---|---|
| Note exists, tests pass, the stop was mechanical | Continue, or resume the session |
| Note exists, the stop was an open question | Answer it on the item, then continue |
| No note, small diff inside the item's paths | Read it, rerun the checks, continue |
| No note, large diff or files outside the item's paths | Restart from the item |
| The acceptance criteria changed since it started | Restart from the item |
A rerun of a well-specified item costs under an hour of agent time and a few minutes of yours. Reading an unexplained branch of several hundred lines costs a person an afternoon.
Whether to resume coding agent session state or start a fresh one depends on why it stopped. Claude Code's --resume flag reopens a past session by its ID or name, with the context it had. The context comes back with the agent's assumptions, though, including any wrong one, so after a stop on a question a fresh session started from the item and the note is often the better choice.
Re-establishing what is actually verified
Rerun everything yourself, and trust nothing you did not see exit 0. A takeover is a review with less information than usual, so it needs more checking, not less.
- Check out the branch in its own worktree rather than your working copy.
- Diff it against its base, and list every file outside the paths the item names.
- Look for work that never reached a commit: uncommitted changes in the agent's worktree, and stash entries.
- Run each acceptance criterion's command and record the exit code.
- Read each commit message against its diff, and check that it cites the item.
Only after the criteria have been run does anything on the branch count as verified. Before that, the branch is a draft written by someone who can no longer be asked.
Who owns the item after the handoff?
The person who took it over, and the item should say so. Reassign it, write a line on it recording the handoff and why, and link the new commits to it so the history stays in one place.
Ownership does not change how the work is accepted. In Laimonade the review checks the acceptance criteria against the commits linked to the item, whoever wrote them. A coding agent can carry an item as far as In Review and has no tool to mark it done. Laimon, the product owner agent, can close routine items, and each closure is stamped as its own.
Frequently asked questions
Should the agent's commits be kept or squashed after a takeover?
Keep them until review, and squash at merge only if the team squashes everything anyway. Separate commits show which parts the agent wrote and which the person changed, and that is what the reviewer needs to know. Record the handoff in the pull request description so the authorship stays honest after any squash.
Can a second agent pick up where the first stopped?
Yes, if the note is on the item. A second agent reads the item and the handoff note rather than the first agent's context, which is usually an advantage: it starts without the first agent's wrong assumptions. Give it the branch to continue only when the note says what was verified; otherwise give it the item and a clean start.
How long should an abandoned agent branch be kept?
Until its item is done or archived, then delete it. Push it, or open it as a draft pull request, as soon as work stops, because a branch that lives only in a local worktree disappears when the worktree is removed. We once kept an evaluation's uncommitted work only as a diff file saved before its worktree was deleted.