I raced 20 AI agents for one kanban ticket, 50 times: how agentboard keeps exactly one winner
Twenty agents claimed the same ticket at once, fifty times. With a compare-and-set claim there was one winner every round; without it, all twenty won.
To stop multiple AI coding agents from grabbing the same kanban ticket, make claiming a compare-and-set: the agent only moves a ticket out of to-do if it's still sitting in to-do, and everyone else gets a 409. On 12 November 2026 I stress-tested that on agentboard 0.1.13, my self-hosted kanban board for agents, by firing 20 agents at the same ticket simultaneously across 50 rounds. Every single round produced one winner and 19 409s. Without the check, all 20 agents won.
The problem: two agents, one ticket, two pull requests
Usually an agent lists to-do, grabs the top item and moves it to in-progress. That works fine when you only run one agent. Run a few in parallel and two of them read the same queue in the same second, then both move the same ticket. Neither gets an error, both start coding, and an hour later you're staring at two pull requests for the same fix. I hit this exact mess on my own board while writing the post about the 198 tickets my agents closed in 25 days, and patched it by adding one field to the update call. Here's the concurrency test I should've run before trusting that fix.
The claim, as one HTTP call
An agent claims work with a single PATCH that states which column the ticket must currently sit in:
curl -X PATCH -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' \
$URL/api/tickets/42 \
-d '{"if_column":"to-do","column":"in-progress","assignee":"me","comment":"Picking this up."}'Moving the ticket, setting the assignee and posting the comment all land in one request. If somebody already moved it out of to-do, the board writes nothing and answers 409 with a plain error string: ticket #42 is in "in-progress", not "to-do". The CLI wraps the same check via kb set 42 --if-column to-do --column in-progress --assignee me. Running it twice back-to-back on a fresh board gave exit code 0 on the first call, then printed 409: ticket #71 is in "in-progress", not "to-do" and exited 1 on the second, so shell loops and agent tool calls can branch straight on the exit code.
Why the check can't be beaten: it's one synchronous function
At commit b5deb33 (tag v0.1.13), updateTicket in server.js reads the ticket, checks its column against if_column, and writes the new column, assignee and event rows inside one transaction. Because the server runs on node:sqlite with synchronous queries, there's zero await between the read and the write. Node executes one request handler at a time, so the next claim can't even start until the first commit finishes, sees in-progress, and bounces with a 409.
Since that guard runs in JavaScript rather than in SQL, it relies on agentboard's intended deployment: one server process owning one SQLite file. I haven't tested pointing two server processes at the same database file, and I wouldn't run it like that.
The test: 20 agents, 50 rounds
I spun up a blank board on Node 22.23.4, provisioned 20 agent accounts via POST /api/users with separate keys, and wrote a short script. Each round creates a ticket in to-do, fires 20 simultaneous claims via Promise.all (one per agent, each passing "if_column": "to-do" and its own comment), and reads the final ticket back.
| Claim style | Rounds | Results per round |
|---|---|---|
With if_column | 50 | 1 × 200, 19 × 409 |
Without if_column | 20 | 20 × 200 |
With the guard on, all 50 rounds behaved identically: one 200, nineteen 409s, and the assignee matched whoever got the 200. All 50 rounds (roughly a thousand claims plus creating and reading back tickets) finished in 1,260 milliseconds. The same agent won every round, which is just an artifact of the order my script dispatched requests; the board guarantees one winner, not a lottery.
Drop the guard, and a plain "move to in-progress" call lets all 20 agents get a 200 in all 20 rounds. Round one left the ticket with 20 "claimed by agent-N" comments and agent-20 as the final assignee, while every single agent walked away convinced it owned the task. That's the duplicate pull request bug reproduced in about a second.
What an agent does with a 409
Don't retry a 409 on a claim. Somebody else grabbed that ticket, so your agent should move on to the next one in the queue:
for id in $(kb ls --column to-do --assignee none | jq -r '.[].id'); do
kb set "$id" --if-column to-do --column in-progress --assignee me \
--comment "Picking this up" && break
doneI walked through the full loop, including handoff comments and PR links, in the guide to giving Claude Code a shared kanban board through the API, with the exact commands Claude Code ran.
Create and claim in one call
Compare-and-set covers tickets already waiting in to-do, but there's a second race when an agent opens a ticket for work it plans to start right away. Create it in to-do and update it a split second later, and a dispatcher watching that column can snatch it in between. That exact race gave me duplicate PRs on my real board. To close the gap, ticket creation accepts a column and assignee directly so the ticket never sits unclaimed. On the test board, kb new "Fix other thing" --column in-progress --assignee me returned the ticket already parked in in-progress under the creator's name.
What to copy if you build your own board
- Carry the expected state inside the claim request, and return 409 with the real state in the body.
- Keep the read and write in one synchronous block with no
awaitin between, or push the check into a SQLWHEREclause if you run multiple server processes. - Hammer it with real concurrent requests. Calling an endpoint twice sequentially tells you nothing about two agents colliding.
- Support creating tickets pre-assigned so self-filed work never passes through an open queue.
Run it yourself
agentboard is MIT-licensed and lives on GitHub. One command boots it:
docker run -d -p 3000:3000 -v agentboard:/data ghcr.io/backmeupplz/agentboardOpen the setup link from the container logs, add an agent under Settings, People, and hand it the URL and key. The race script is just a short Node file calling fetch against the API documented at GET /api on your instance. I ran all of this on 12 November 2026 against agentboard 0.1.13 on Node 22.23.4 on a single local machine, so treat the millisecond timing as a ballpark and the single-winner result as what counts.