My AI agents do their work on branches, and one button merges it to main. For two weeks that button died half way more often than not. Now a read-only preflight checks first, names the blocker in one line, and the boring failures repair themselves.
My agents pick up tickets, work in their own branch and stop at verify (the ticket that worked itself). Then I press Merge: rebase onto main, run the tests, fast-forward, push, mark the ticket done, restart the dashboard. Between 27 September and 10 October I pressed it 65 times and 44 times it died half way. No branch to merge. Unsaved edits in the main folder. A clash with main. A red test. Or everything worked, and then a cleanup step after the push hung and the run said FAILED anyway. Every failure meant opening a log to find out which one it was.
Now the ticket drawer asks a read-only question before the button is live: GET /api/tickets/merge?id=. It checks that there is exactly one tix/<id>-* branch, that it has commits main lacks, that the ticket’s worktree is clean, whether unsaved edits in the main folder touch this ticket’s files, whether another merge is running, and whether the branch clashes with main. The clash check is git merge-tree --write-tree: a dry merge that writes nothing to any working folder. Each line comes back ok, warn or block, and every block carries its fix. A block greys out Approve, and the POST that really merges refuses the same thing, so the button is not the only guard.
components/TicketDrawer.tsx. Fix: Send it back so the agent rebases on main and resolves the clash. Approve stays disabled. (paraphrased; the check and fix text are verbatim from lib/merge-readiness.ts, the file name is an example)
The cheapest failure is the one that never reaches the button. A ticket now cannot move from wip to verify unless exactly one branch is ahead of main; --force still works, and it is logged. The merge script got four repairs. Unsaved edits in the main folder only block when they touch the ticket’s own files; the rest become a warning. A clash or a red test or type check sends the ticket back to spec for the worker, tagged golive-conflict or golive-red; a second bounce tags needs-jacob and takes the agent off it. A second press on a merged ticket is a no-op. Trouble after the push is a warning, not FAILED. And every stop prints a Fix line.
Since the fix shipped on 10 October at 21:14, the tally counts 4 presses · 4 merged · 0 failed. Four is a small sample. The ticket’s own done-when is under 1 in 10 presses fail, and I will only call it done when the tally says so over a few weeks. Forced moves past the verify gate are still possible; they are logged, not prevented.
Each card is one way the button used to die, and what it says now. Typographic cards built from the merge script and the board, not screenshots. Tap any image to enlarge it and read the exact prompt that drew it.




“Almost never fails” is a number now. A small read-only script, merge-tally, reads the merge logs, counts presses against clean merges, groups the failures by reason and logs why a restart failed. Before: 44 of 65 presses failed. Since the fix: 4 of 4 merged. The bar it has to clear: under 1 in 10.
Under a minute: the button that kept dying, the preflight that checks first, and the number that keeps it honest.
The dashboard is private, so this is the pattern, not the repo: a read-only preflight, the same refusal on the server, a gate before verify, a Fix line on every stop and a tally that reads your own logs. Everything in this episode is free and open — clone it, run it, make it yours.
# pattern soon. Try the dry merge now (writes nothing to your folder):
git merge-tree --write-tree --name-only --no-messages main my-branch
No GitHub? Comment PREFLIGHT on the post and the bot DMs you the link.
Tests, learning pages, projects: swept from five places, folded into one page, and the first count surprised me.