v1.92.0 ·
A failed start cleans up after itself
On 2026-10-10 the autopilot tried to start two backlog items and failed on both. The items had been
written by an agent, and neither had a promoted_to: line. aidlc start had already made each
worktree, its branch and its registry entry before it tried to link the item, and the link refused.
The autopilot parked both items, which was right. What it left on disk was not. Once the
missing line was added and the start ran again, the retry failed with "instance already registered in this
repository". Getting back to a clean state took git worktree remove, git branch -D and
aidlc doctor, once per item. A recovery chore like that is exactly what the autopilot is supposed
to take off my hands.
What changed
Two things, and either would have fixed that day.
An item with no promoted_to: line now gets one. The line is added at the end of the item's
frontmatter, and every other line is left as it was.
And a start that fails part way now removes what it made. If the link fails, aidlc start removes
the worktree, the branch, the registry entry and the instance folder, puts the item back the way it
found it, and exits with the error:
Error: could not start demo: linking roadmap item 20261010-demo.md failed: ...
Run the same command after fixing the cause and it works. The same cleanup now runs when the registry write loses a race after the worktree was made, which used to leave the worktree behind too.
Why both
The first fix covers the case I hit. The second covers the ones I have not hit yet. A full disk or a permissions error during the move cannot be checked ahead of time, and without the cleanup each of them would bring back the same hand recovery.
The cleanup deletes things, so it only removes what that one run made. It records each thing as it is created, and the steps that create them already refuse to reuse a branch, folder or registry entry that exists. A test starts with another session's registry entry already in place and checks that it survives untouched. If something cannot be removed, the start says what is left and still reports the original error, because that error is the one you can act on.
What it does not do
A start can still exit with an error after it succeeds. That happens when a blocking
on-instance-start action fails. By then the instance is complete and the action has run, so
undoing it is a different decision, and I left it alone. It also does not clean up leftovers from
starts that failed before this release. aidlc doctor still handles those.
The new tests make each failure for real, against real git, rather than mocking it. Three of them failed against the old code before they passed against the new.