Dev.to AI πŸ€– Ai πŸ‘ 0 πŸ“– 5 min read

We gave the same ticket to two Claude Code agents 30 times. They agreed every time. Git conflicted 23 times.

Our last test put two agents in one folder and watched edits go missing. The advice at the end was one worktree per agent. This test follows that advice and looks at what worktrees do not cover: two people hand their age

Our last test put two agents in one folder and watched edits go missing. The advice at the end was one worktree per agent. This test follows that advice and looks at what worktrees do not cover: two people hand their agents the same ticket, and neither agent knows the other exists. On 4 December 2026 we did that 30 times. Our AI agent sessions ran the test under a founder's direction.

The setup

A throwaway repository. src/price.js:

export const TAX_RATE = 0.10;

export function total(cents) {
  return Math.round(cents * (1 + TAX_RATE));
}

One test file that checks total(1000) is 1100, and node --test to run it.

For each trial we made a fresh copy, added two git worktrees on two branches, and started one claude -p session in each at the same moment. Both got the same prompt, word for word:

Ticket ORD-41: add a function formatPrice(cents) to src/price.js that returns the amount as a string like $12.34. Add tests for it in test/price.test.js, run the tests, then commit with the message 'ORD-41 formatPrice'. Reply with the commit hash only.

Claude Code 2.1.335, both sessions on Sonnet 5.5, edits, git and node allowed without asking, our own settings and MCP servers kept out. Twenty trials.

Then ten trials of a second ticket, picked because it leaves a decision open. For this one total also adds a flat SHIPPING of 500 cents.

Ticket ORD-42: orders over $100 ship free. Change total(cents) in src/price.js to do that, update the tests in test/price.test.js, run them, then commit with the message 'ORD-42 free shipping'. Reply with the commit hash only.

Over $100 before tax or after? Does exactly $100 count? The ticket does not say.

After each trial we ran the tests on both branches, merged the first branch into main, then the second, and ran the tests on main. We also called each branch's function on a fixed list of inputs, including a negative amount, a fraction of a cent, a string and null, and compared the answers.

Sixty sessions, no disagreement

ORD-41, 20 trials ORD-42, 10 trials
Both agents committed, tests passing on their branch 20 10
Same answer from both on every input we tried 20 10
Source file identical, byte for byte 9 2
Test file identical, byte for byte 14 0
Second merge conflicted 13 10
Second merge went through 7 0

The agents never disagreed about what the code should do.

On formatPrice, 38 of the 40 sessions wrote one of two versions, and those two differ only in whether two values get a variable of their own. On the shipping ticket all 20 sessions made the same call: the $100 is measured before tax, and exactly $100 still pays shipping. Nobody told them that.

In one trial the two sessions produced the same commit, with the same hash. Same files, same message, same second. Git's answer to the second merge was "Already up to date."

Git conflicted on two answers that agree

23 of the 30 second merges conflicted. This is a typical one:

<<<<<<< HEAD
  const dollars = Math.floor(abs / 100);
  const rem = String(abs % 100).padStart(2, "0");
  return `${sign}$${dollars}.${rem}`;
=======
  return `${sign}$${Math.floor(abs / 100)}.${String(abs % 100).padStart(2, "0")}`;
>>>>>>> agent-b

Both sides return the same string for every input we tried. Somebody still has to open the file and choose.

The shipping ticket conflicted ten times out of ten, always in the test file and twice in the source as well. One of those conflicts was the same test written twice under two names: "exactly $100 still pays shipping" on one side and "orders of exactly $100 still pay shipping" on the other.

Seven merges went through. One of them broke main.

In six of the seven, the two agents had written the same thing character for character, and git folds identical changes into one. The only trace that the ticket was done twice is two commits with the same message.

The seventh is the one to worry about. 39 of the 40 sessions added formatPrice below total. One added it above. Its partner added it below. Git saw two additions in two different places and merged them:

Auto-merging src/price.js
Merge made by the 'ort' strategy.

Main now declared the function twice, once above total and once below it. Running the tests gave:

SyntaxError: Identifier 'formatPrice' has already been declared

Both branches had passed their own tests. The merge reported no conflict. Main could not be loaded at all.

That is one trial in 30, and we would not put a rate on it from this. It is the same shape as the break in our post about seven green pull requests: git checks whether lines overlap, and the language checks the whole file.

What the second agent cost

A session took about 31 seconds and about 6.6 cents at list price for the first ticket. The numbers are small because the ticket is small. The ratio is what carries over: every trial paid for the work twice, and then 23 times out of 30 a person had to settle a conflict between two answers that agree.

58 of the 60 replies were a bare commit hash, and the other two added one short line before it. No session mentioned another agent, because none could see one. Each was alone in its worktree, which is what a worktree is for.

What we take from it

  • Worktrees stop agents overwriting each other. They do nothing about two agents doing the same job.
  • A merge conflict between agent branches does not mean the agents disagreed. Here either side was right, 23 times out of 23. Compare behaviour before spending time on the choice.
  • A merge with no conflict is not a tested merge. Run the tests on main after it, or merge the batch locally first.
  • The fix is upstream of git. Before an agent starts, something it can read has to say the ticket is taken: an assignee on the ticket, a branch name it checks for with git ls-remote, a line in a shared file.

The limits: one tiny repository, one model, two small tickets, both sessions started in the same instant with the same words. Two people would word a ticket differently, and a bigger ticket leaves more room to differ. We would expect less agreement there and did not test it.

Ways to split work so agents do not land on the same files are in our guide, How to stop AI coding agents editing the same files.

Disclosure

We build KoalaFix, a tool for coordinating a team's AI coding agents, so we have an interest in this topic. Weigh what we say with that in mind.

This post was drafted with AI assistance and checked by a founder.

πŸ“° Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.