I woke up this morning, opened my coordinator pane, and saw the same status line I had seen the night before. Not similar. Identical. Nothing in the queue had moved in six hours.
Everything was still running. No crashes, no OOMs, no errors in any log. The agents were all healthy. They were just — politely — waiting for each other, forever.
A couple of days ago I wrote about running six Claude Code agents in parallel on Freebo using git worktrees and lock files. The TL;DR of that post: every PR gets its own worktree, every merge grabs a pr-N-*.lock file, and a coordinator agent assigns work so the lanes don’t trample each other. It has run for weeks without incident.
This is the first incident.
What a lock looks like in this system
The locks are just files. When a lane is doing work that shouldn’t collide with another, it touches ~/.local/state/freebo-gate-queue/pr-0-<lane>.lock and the other lanes check for its presence before they go. Ten lines of bash and flock running in a loop. It’s the kind of thing you sketch on a napkin and then never touch again because it works.
The coordinator has its own lock, pr-0-coord.lock. It uses it when it’s directing traffic — scheduling the next PR, routing a hand-off between agents, telling a lane which branch to sync from. Nobody runs under coord’s lock except coord.
There’s also a queue script, after-idle.sh, that holds a long list of PRs waiting for a slot and releases them one at a time as locks clear. On a normal day it ticks through a batch of five or six in an hour. On Dec 3 at 23:10 UTC it ticked once, picked up a batch of ten, and then stopped.
The circular wait
Here is the shape of the stall, reconstructed from the state files the next morning:

Coord was holding pr-0-coord.lock through a loop that reads a “hold file” I had added a few weeks earlier: ~/.local/state/freebo-gate-queue/hold-coord. The loop is a sort of soft pause — while the hold file exists, coord sits on its lock and does nothing. The idea was that another agent could create the hold file when it needed coord to wait for a confirmation.
That night, coord had created the hold file itself. It was waiting for the refunds lane to confirm that a local data repair had finished before it released the queue.
The refunds lane had, in fact, finished. The repair completed at 23:09:55Z, sixteen seconds before the stall started. But the message coord had sent to refunds included a condition: “the lanes start once every pr-*.lock is free.” Refunds, being a dutiful agent, was waiting for every lock to clear before confirming.
One of those locks was pr-0-coord.lock. Which was being held by coord. Which was waiting for the confirmation.
My fault: I told o-refunds to wait for every pr-*.lock to be free while my pr-0-coord hold waited on its confirmation.
— The coord agent, in its own words
Both agents were behaving correctly. The code was correct. The instructions coord had sent to the lane were the bug — and the instructions were sent in English, not in code. That’s a new category of failure I didn’t have a mental model for.
What eventually broke it
Nothing I did. I was asleep.
Around 05:07Z I had another agent, running out of the ops pane, notice the stall and ping coord with a full state dump — every PID, every held lock, every waiting PR number, and a suggestion (“rm the hold-coord file, the repair is actually done”). Coord read it, agreed, removed the hold file, and the queue drained in under a minute.
The entire resolution is this message, which arrived in my inbox at 05:15Z while I was in bed:

I want to be careful about how I describe this, because it’s easy to slide into “look at my AI fixing itself.” That’s not quite what happened. One agent noticed the stall because I had a diagnostic script watching for pane idle time. Another agent read the diagnosis and made the correct call. The coordination between them was flat, not emergent — one agent told another agent what the state was, and the second one acted on it. The thing that was missing was a watcher that would have done this at 23:20Z instead of at 05:07Z.
Timeline
- 23:09ZRepair finishesThe local data repair the refunds lane was doing completed. Platform fee ledger reconciled. This is the moment the deadlock could have been avoided.
- 23:10ZQueue stallsafter-idle.sh picks up a batch of ten PRs and stops. Both coord and refunds enter wait states. Nothing in any log looks wrong.
- 05:07ZOps agent noticesA helper agent in a separate pane sees the pane has been idle for 5.5+ hours and dumps the full lock state to coord.
- 05:15ZCoord releases itselfRemoves the hold-coord file, confirms the repair, posts a note to its own working log, and arms a stall watcher.
- 06:30ZQueue drainedAll ten PRs ran, three merged, one needed a mid-session merge from origin/main. Normal Thursday.
The pattern I missed
Here is what I’d write on a napkin now:
The fix at the system level is the smaller one: a stall watcher that trips when any lane idles for more than 40 minutes dumps the full lock state to coord and asks it to decide. That’s a 20-line script and it is now armed.
The fix at the design level is the bigger one, and I haven’t fully written it yet. My hunch is that the coordinator should never hold its own lock while waiting on an agent — it should hand that waiting to a watcher and release the lock, so agents downstream can use it to signal. Lock-holder-waits-for-release is the pattern that eats you.
What this changed in how I think
Before this I’d been treating the multi-agent setup like concurrent processes. Mutex, resource, acquire, release — the vocabulary of a 1980s textbook. That vocabulary mostly held up. Where it broke is that these agents also talk to each other in plain language, and the content of those messages is part of the dependency graph. You can’t lint it, you can’t type-check it, and if one agent instructs another to wait on a condition that includes the first agent’s own state, you get a real deadlock from a correct-looking English sentence.
I’m not going to pretend I’ve got that solved. But I’m going to stop being surprised that it can happen.
The stall watcher is running now. If this post goes up and the next one doesn’t, you’ll know why.