The author describes an experiment where merging two AI agents' git worktrees led to test failures despite clean merges, highlighting the challenges of parallel agent development without mutual awareness.
Ten merges. Five came back with conflict markers. The other five came back clean, and all five failed the test suite on the merged tree. Every one of the twenty worktrees had been green when its agent stopped. Setup: a 150-line Python CLI with four tests, one base commit, two worktrees on two branches, two agents kicked off together on tasks that never mention each other. Five task pairs, each run twice. In every pair the second task quietly depends on something the first one changes: one agent renames done to completed while the other writes a stats command that reads it; one wraps the store file in a versioned object while the other adds import; one swaps integer ids for hex while the other adds edit ID --title. Both got the same instruction to run the tests before they stop, and both did. What git does with two branches is compare areas of each file against the common ancestor. Areas only one side touched go in verbatim. It has no idea what a field name is. So in the five clean merges, stats read n["done"] from a store that now wrote completed, the importer refused the store's new versioned file, edit choked on a hex id with "invalid int value". The failing tests were always agent B's own tests, unchanged, green a few minutes before in B's own worktree. In all five clean merges both agents had edited at least one of the same files, in different areas, so git had nothing to say. The one that got me: the id pair, run twice. First run, agent B dropped its edit subparser a line above the spot agent A had edited, and git merged. Second run, B put it directly under that line, and git flagged three files. Whether I got conflict markers or a red suite came down to where the model dropped a block of code. Someone replayed 1,694 human merges on three open source projects with test suites, fifteen years ago: 76% clean, 16% textual conflict, 1% merged clean and broke the build, 6% merged clean and failed tests. A third of the conflicts it found were ones the VCS had called clean. That was humans, who could at least ask each other. My two agents can't read each other's worktree. That is the point of a worktree. It is also the exact problem. When you run agents in parallel, what actually runs the merged tree before you trust it?
An experiment with AI agents enabling auto-merge on 108 pull requests revealed only one merged due to CI runner saturation, showing that agent throughput doesn't translate to actual code landing without considering merge capacity.
The author describes Foremerge, an open-source coordination protocol for parallel coding agents that detects conflicts before changes are made, and explores its applicability to non-code domains while seeking real-world examples.
A developer shares struggles with versioning and rolling back AI agents using git, highlighting issues with silent behavior changes from prompt edits and lack of regression signals. They ask the community for better workflows.
This article explains that git worktrees do not provide true isolation for AI coding agents, as they share hooks, config, and refs with the parent repository, allowing an agent to execute arbitrary code on the host. Benchmarks show that properly isolated clones have comparable performance, challenging the assumption that worktrees are both isolated and cheap.
This article argues that traditional CI fails for AI agents and proposes replacing it with a merge queue where all tests run before merging, allowing agents to fix issues before breaking the build.