DEV Community

Debashish Ghosal
Debashish Ghosal

Posted on

Three Agents, One Repo: The Coordination Problem Nobody Designed For

Three Agents, One Repo: The Coordination Problem Nobody Designed For

One coding agent is a productivity tool. Two agents in the same repository is a sociology experiment. Three is a coordination problem that most teams solve for the first time in production, on a Friday.

The infrastructure conversation covers fleet orchestration and control planes. It skips the boring, decisive question: what happens when two agents touch the same file at the same time, and who resolves what they did to each other?

The Three Collisions

The mechanical collision is the friendly one. Two agents edit the same lines, git refuses to merge, and the failure is loud. Everyone notices. This is the good case, because the system said no.

The semantic collision is the dangerous one. Agent A changes the meaning of a function's return value. Agent B, working from the old contract, builds a feature that reads it. The merge is clean. The tests each wrote still pass in isolation. The system now believes two incompatible things, and nothing failed anywhere.

The duplicate collision is the expensive one. Two agents, given overlapping tickets, build the same feature twice with different names. Both PRs look competent. One of them is pure waste, and until someone notices, both are load.

None of these are exotic. They are the exact failure modes human teams have, at a speed that breaks the human mechanisms we built to catch them.

The Human Mechanism We Forgot to Port

Human teams coordinate through standups, hallway conversations, and ownership maps. "I'm touching the auth module, don't start there." It is informal, inefficient, and it works.

Agents attend no standup. They hold no grudges, share no memory, and read no hallway. The coordination layer has to become explicit, which means it has to become infrastructure:

A claim queue. Work is assigned or claimed, and a claim is visible. No two agents start the same ticket because the ticket said who started it. This is a work queue, not a scheduler, and it can be a spreadsheet before it is a platform.

An ownership map. Which files, modules, and decisions belong to which stream of work. Agents respect boundaries they are told about. They cannot respect boundaries nobody wrote down.

A merge gate between agents. Agent PRs that touch adjacent areas wait for the earlier one to land. Serializing the hot paths costs throughput and buys correctness, which is a trade humans already make every day.

A human integration owner. When agent PRs collide, a person who owns the integration decides. Not because humans are faster. Because someone has to be accountable for the seam, and accountability does not delegate to a process.

💡 Pro-tip: the semantic collision is the one to design against first. The mechanical one announces itself. The semantic one ships clean, passes its own tests, and gets discovered by a customer. A shared contract check between agents working in the same area is worth more than any lock.

Where This Breaks Down

Two or three agents on one repo is not a fleet, and the interesting failures will not always reproduce on demand. Solo developers with a single agent can skip all of this. The problem arrives the first time someone parallelizes "funnel all the open tickets to the agents" without anyone asking which tickets share a codepath.

There is also a real risk of over-engineering: most teams need a claim queue and a merge order, not a control plane, on day one.

But the direction of travel is obvious. The team now includes non-human contributors, and every org-design problem humans ever had, multiplied by speed and stripped of social instinct, is coming to a repository near you.

How many agents touch your repo before the first collision, and who resolved it? Was it loud, or was it clean?


References

  1. The fleet-level version of this problem, and why agent fleets need a control plane: Kubernetes for Agents
  2. The gatekeeper pattern for what agents may do when they get there: I Stopped Trusting AI Agents With Tools. So I Built a Gatekeeper.

Top comments (3)

Collapse
 
innokentyb profile image
Kent Bodrov •

The semantic collision is the one a clean merge can hide. A useful gate could bind each dependent change to a version of the shared contract, then run an integration scenario against the combined result after the first change lands. File ownership helps avoid simultaneous edits, but it won’t detect a consumer built against an old assumption. How do you decide which cross-agent contracts deserve that extra check?

Collapse
 
jacksonxly profile image
Jackson Ly •

Two implementer agents shared one worktree in one of my sessions, and git had nothing to flag. The orchestrating agent gave them file sets it called disjoint, with the rule "stage only your own paths". But the index is shared, so a plain git commit from either would have swept in the other's staged work. The orchestrator caught one fully staged just as the second started, and had both name their paths on the commit. Later it changed a brief and sent one of them into two files it had just declared off limits. That agent applied the edits but refused to commit them, since the commit would have carried unreviewed work.

Collapse
 
johnclentoira profile image
john Clent Oira •

Great breakdown, Debashish! Imagine three agents independently updating checkout, order processing, and payment validation, with each passing its own tests but introducing incompatible assumptions when merged. Would you rely on shared contract tests and dependency-aware scheduling, or introduce a central coordinator to catch these conflicts? I'm curious how you'd scale that approach to 20+ agents without creating a new bottleneck.