A small software team let AI coding agents build most of its changes. Each change was its own run: an agent started from the main branch as it was at that moment, made the change, opened a pull request, passed review and merged.

One day twelve of those changes landed on the same file. Git never reported a conflict. Every review passed. And at eight in the evening the page still did not show what had been asked for that morning.

Key facts

  • 12 merged changes to one 2,590-line file in 20 hours, from 04:57 to 00:58 the next night.
  • 16 merges on that page’s folder in two days. On the file: 3,427 lines added and 842 removed, in 33 commits.
  • No merge conflicted. Yet five finished changes for the page were still waiting outside it at 20:13, and old wording stood in eight places.
  • One evening change, open about 16 hours, folded in those five and landed the day’s work at once: +595 / −238.
  • The fix was a rule, not a tool: one open change per page.

What happened

The page was a settings page that shows plans and buttons: which plan you are on, what you could move to, and a button for each. The person who owns the page was steering it all day, one ask at a time. A wording fix here, a new button there, a rule for which card shows to whom.

Each ask became its own job, and each job became its own change. Every job started from whatever main was when it began. So by mid-morning several agents were working at the same time on the same file, each from its own picture of the page.

The component behind the page is 2,590 lines long today. Over two days its changes added 3,427 lines and removed 842.

Look at the file as it stood after the seventh merge, at 20:13. Five changes the owner had asked for were built between 06:27 and 10:26: a new sentence for one kind of customer, a new step for another, a card hidden for a third. None of them was on the page. Each sat in its own open change, built on its own older copy of the file. The sale wording the owner had changed that day still stood, in its old form, in eight places.

So the fix was to stop patching. One change that had been open since 06:27 took in those five, caught up with main three times, and merged at 22:25 to land “all the work” at once: 595 lines added and 238 removed. Four more changes followed it before 01:00.

The twelve merges

Lines are what each merge changed in that one file. “Started from” is the moment of main that the change was first built on.

ChangeMergedStarted from main as ofLines
Change 104:5702:43+1,681 / −0
Change 205:2904:57+30 / −15
Change 306:1405:29+69 / −11
Change 407:0006:14+124 / −40
Change 507:5907:00+71 / −23
Change 613:1812:04+6 / −1
Change 720:13five days earlier+6 / −1
Change 822:2506:14+595 / −238
Change 922:5122:25+15 / −2
Change 1023:0822:51+3 / −0
Change 1100:0923:17+258 / −48
Change 1200:5800:09+119 / −8

Change 7 started from a main five days old. Six changes to the same file merged while it was open. Change 8 was built on main as of 06:14 and merged at 22:25; four changes to the file merged while it was open.

Why git and review did not catch it

Every diff was right against its own base. That is what review checks, and it was true each time.

A clean merge proves less than it seems. It proves that two changes did not touch the same lines. It does not prove that the second author had seen the first. An agent that rebuilt a card from its older picture of the page wrote a correct-looking card, and git merged it. When two changes rewrite the same card in different ways, a clean merge can quietly drop what the first one added. Nobody gets a warning.

Pulling main into a branch before merge does not fix this either. It fixes conflicts, not the agent’s picture of the page. The agent had already decided what the page should look like, hours earlier.

And review reads the diff, not the screen. Nobody compared the merged page with everything the owner had asked for that day.

How to see it in your own repo

Two commands show whether one file is getting this treatment:

# every merge into main that touched the file in the last day
git log origin/main --merges --first-parent --since='1 day ago' \
  --format='%h %ad %s' --date=format:'%H:%M' -- path/to/file

# lines added and removed on that file over the same day
git log origin/main --no-merges --numstat --format= --since='1 day ago' \
  -- path/to/file | awk '{a+=$1; d+=$2} END {print "+" a, "-" d}'

More than two or three merges on one file in a day, from several authors or agent runs, is the signal. Lines removed that are close to lines added is a second one: work is being redone.

What to do

  • One open change per page or file while someone is steering it. A new change for that file starts only after the open one merges.
  • Further asks go into the open change. Not into a new branch next to it.
  • Batch small asks. Three asks made minutes apart become one task, not three agents.
  • Rebase and look at the real screen before merge. Not the diff: the page, as a user will see it.
  • Do a last look at the end of the day. Put the screen next to the list of everything asked that day, and tick each item off.

None of these needs a tool.

What it cost

Nothing broke for users in a way that showed up as an error. The cost was a day of the owner re-checking the page and re-asking for things already approved. Work finished by mid-morning reached the page only at 22:25. One evening change had to carry five others and catch up with main three times to make the page match the day’s asks.

The fix was a rule, adopted that night: one open change per page. It is the same lesson as giving a worker the right context. An agent works from the picture it starts with, so make sure there is only one picture.

Common questions

Would a merge queue have caught it?

No. A merge queue orders merges and re-runs checks. It does not know that a change was built on an older picture of the page, or that work for the same page is still waiting in other branches.

Is this only a problem with AI coding agents?

No. People do it too. Agents only make it happen faster, because starting another change costs almost nothing.

Does this mean one change at a time for the whole repo?

No. The rule is per page or file, and only while someone is actively steering it. Other parts of the code can move in parallel.

Melta is free; get it on the App Store or Google Play.