Blog · Comparison · 25 November 2026

Merge Queue, Post-Merge Tests or a Merge Check for Agents

When many coding agents change one codebase, their changes clash. The question is where you catch the clash. There are three places: in a merge queue that lets changes into the main branch one tested group at a time; after the merge, with tests that run on main and a way to fix or revert; or before an agent says it is done, while it is still running and can change its own work. This article compares the three, with what Anthropic and Cursor have published about doing this at scale, and says plainly what Forkit's merge check, the third kind, does and does not check.

Place 1: a merge queue

A merge queue serialises entry to the main branch. GitHub's docs describe the mechanism: "A merge queue creates temporary branches with a special prefix to validate pull request changes." Each queued pull request is combined with the latest base branch and the pull requests ahead of it, and the queue "will wait for required checks to be reported before it can proceed with merging." A pull request with failed checks or conflicts with the base "will be removed from the queue", and the branches behind it are rebuilt without it. GitHub allows up to 100 builds in flight and groups of 1 to 100 pull requests merged together.

Strength: main is never broken by a combination nobody tested. Text conflicts and semantic breakage (two changes that merge cleanly and fail together) are both caught, because the tests run on the combined code.

Weakness: it is a queue. Every change waits for the ones ahead, and a failure ejects a change after its author, human or agent, has moved on. At agent volumes the queue itself becomes the limit.

Anthropic hit that limit. In "Redesigning source control at Anthropic" (13 Oct 2026), it reports averaging "around 2,500 code changes merged per day" in May 2026 and "over 30,000 per day" by September, and says: "We haven't been able to effectively replicate the industry standard of a global repository lock on the merge queue."

Place 2: tests after the merge

Anthropic's answer was to let changes merge and invest in automated testing after the merge and before deploy. The post acknowledges that concurrent changes can then conflict, and says: "Claude can typically fix these conflicts faster than humans can even identify them." It mentions automated bisect and revert pipelines among its internal tools. It does not describe what happens step by step when a post-merge test fails.

Cursor reached a related conclusion from the other end. In "Scaling long-running autonomous coding" (14 Jan 2026), agents coordinating with locks would "hold locks for too long, or forget to release them entirely", and "Twenty agents would slow down to the effective throughput of two or three, with most time spent waiting." Cursor moved to optimistic concurrency: agents read freely, and "writes would fail if the state had changed since they last read it." It reports "Hundreds of workers run concurrently, pushing to the same branch with minimal conflicts", and dropped a dedicated integrator role because "Workers were already capable of handling conflicts themselves."

Strength: nothing waits. Throughput is limited by how fast you can test and repair; no lock holds it back.

Weakness: the conflict is found after the agents that caused it have finished. Someone, usually another agent, repairs it later with less context than the authors had. This works best with a large test suite, fast repair, and a team that accepts main being briefly broken.

Place 3: a merge check before an agent finishes

The third place is earlier: while the agents are still running. Each agent asks "would my change merge with my peers'?" before it stops, and an agent whose change would conflict is held and told where, so it can fix the clash while it still knows why it made its change.

This is cheap to compute. A preprint by Subramanian, Xu and Karthik (arXiv 2610.04779, 3 Oct 2026) notes that replaying a merge with git merge-tree took a median 0.02 seconds in their logs. The hard part is timing: agents finish at different moments, and the first to finish has nobody to compare with.

How Forkit's merge check works

From Forkit's engineering notes ("Would our work merge?", 23 Nov 2026):

  • What is compared. Each agent of a fan-out sends its change since the commit it started from, together with that base commit. The base is kept in .git/forkit-base from the first time Forkit sees the checkout, so committing does not hide work or move the base. Tracked edits, commits and new files are included; paths can be excluded.
  • How it decides. Forkit keeps each agent's latest change and compares it with each peer's latest the way git's merge decides: changes to the same or adjacent base lines conflict unless they are identical.
  • The answer. clean; conflicts, with the file, both line ranges and the peer; waiting_for, peers that have not sent a change yet; or different_base, peers on another commit, which are not compared.
  • When it runs. By hand with forkit check-merge (exit 0 clean, 1 conflict, 2 could not check). Automatically in the Stop hook for fan-out agents, which holds an agent that would conflict and tells it where and with whom. The hold also mentions that a peer may have sent a patch to apply with forkit apply.
  • Waiting for peers. An agent that finishes first waits for its peers to check in: 300 seconds by default, or auto, which waits while some peer that has not checked in has an open session active in the last 180 seconds. It re-checks every 15 seconds.
  • Hard caps. Whatever the wait and hold settings, an agent waits at most 840 seconds by default (FORKIT_MERGE_MAX, inside Claude Code's 900-second Stop hook limit) and is held at most 10 times (FORKIT_MERGE_MAX_HOLDS), so a stuck or hostile peer cannot keep it.

The wait was added after a failure. Before it, the first agent always left before anyone could compare with it, and the second was held alone with a conflict only the first could fix: four CooperBench runs in a row. With the wait, in our CooperBench runs on pairs of agents that must change the same lines, 3 of 4 merged, against 0 of 8 with CooperBench's own messaging. That was one run per pair, so it is a signal; a rate needs repeats.

How it was checked

The merge check gave the same verdict as git on all 26 merges CooperBench had recorded when the check was built, and on all 37 by the end of that week's runs. It is also tested against a peer that never starts, one busy forever without checking in, one gone quiet, the same conflict repeated, two diffs flipping back and forth, endless new conflicts, a stranger from another fan-out, and a hundred large diffs.

What it does not check

It compares text, the way git does. It does not run tests on the combined code. Two changes in different files that merge cleanly and break each other pass the check. A merge check of this kind catches what git merge would refuse, early; it does not replace tests.

There is also a class of conflict that has nothing to do with overlapping work. The Subramanian et al. preprint reports that 79 of 167 textual conflicts in their sample (47.3%) occurred "despite disjoint authored file sets", from differences in base and lineage. That is why Forkit's check reports different_base instead of comparing two changes made from different commits.

The three places in a table

Merge queue Tests after merge Merge check before finishing
When a clash is found Before entering main After entering main While agents still run
Catches semantic breakage Yes, tests run on the combination Yes, tests on main No, text only
Who fixes it The author, after ejection Another agent or person, later The authors, before they stop
Main can be broken No Briefly Not by this step
Scales with agents Limited by the queue Limited by testing and repair Each agent waits for its peers, capped (840 s by default)
Example GitHub merge queue Anthropic (Oct 2026), Cursor (Jan 2026) Forkit's merge check

Use more than one

The three do not exclude each other, and the strongest setup uses two.

  • A merge check plus tests after collecting. Agents fix their own text conflicts before stopping; the collected result is then tested as a whole. With Forkit, forkit fanout collect ID --merge merges the agents' branches one by one and leaves conflicting agents as branches; run your test suite on the result.
  • A merge check plus a merge queue. If agents' work goes through pull requests, a check before finishing means fewer pull requests are ejected from the queue for conflicts, so the queue spends its time on test failures.
  • Prevent first. All three are about catching clashes. Fewer happen when work is split by files and each file has one owner: in Forkit, a claim that overlaps another agent's is refused and names the holder. See how to run 50 coding agents without merge conflicts.

A merge check that also ran the tests on the combined code before an agent finishes would close the semantic gap. Forkit does not have one; today, tests run after collecting.

Related: Two Coding Agents, One Function, git worktrees vs file leases, stale approvals and how to check that parallel agents' work will merge.

Where Forkit fits

Forkit is the coordination system for agent teams: plans, handoffs, file claims and decisions, shared by every agent and the people behind them. It runs no agents. It is free to try at forkit-mcp.com. (Forkit's "factories", saved fan-outs, and the company Factory are not discussed in this article.)

Sources

Read on 25 Nov 2026: