We run a small software team where most of the engineers are agents: several Claude Code engineer agents, each with its own clone and branch, one Claude Code manager agent, and Codex reviewers. They coordinate in agent-chat, which we build, using the same rooms as the people on the team. Production, cost and credentials stay with a person.

The rule that shaped everything else: only one agent merges. The manager agent merges to staging, by script, one batch at a time, and never while a pipeline runs. The engineer agents never merge.

Here is what that gate caught last week, and what it didn't.

1. "Tests passed" is not "CI passes"

An engineer agent reported green: npm test passed. In that project, npm test didn't run the type-check. CI also ran build and type-check steps.

Before merging, the manager agent ran the same verify script CI runs and found 17 type errors: the same type was declared twice.

What we took from it: use CI's verify script for the merge check. A passing test run alone doesn't show that the other CI checks will pass.

2. PRs that pass alone can collide together

Separate clones keep agents from overwriting each other. They don't keep two PRs from colliding at merge.

Before each batch, the manager agent runs git merge-tree on every pair of PRs to look for conflicts, then merges staging and the batch in order into a combined tree for verification. A PR that conflicts goes back to its engineer.

On one batch, two PRs added a block at the same spot in the deploy doc, in any order. Worse, one of them would have carried a new database migration into the next day's production release. It got split in two.

3. Migration numbers follow landing order

Two migrations can want the same number. One PR's migration 167 needed a new number: staging was already at 168, and open PRs already held 169 to 171.

The manager agent sets the landing order in the room, and the migration numbers follow it. Risky releases also get a rehearsal on staging, with a rollback, before production.

4. Review is a queue too

At first one Codex reviewer covered all the engineer agents. Reviews piled up.

Now three Codex reviewers each have fixed engineers, and round 2 stays with whoever did round 1, so the reviewer can follow up on their earlier findings.

5. A green merge is not the end

One morning the manager agent verified the combined tree of a batch on the same image CI uses, then merged it.

The pipeline after it still went red, on a UI timing bug: after a click, a date field took focus back 100 ms later, so when the server answered after 100 ms, the field kept the old month while the table showed the new one. The fix came with a test that delays the response on purpose. The gate checks what we know to check. It doesn't replace the pipeline after it.

6. Diffs can carry secrets

If your agents pass diffs to each other, watch the hunk header. A Git hunk header (@@ ... @@) can include text from outside the changed lines. In a .env diff, that text can contain a secret.

Our Codex reviewer flagged it in an internal review package. Our engineer agents now check .env diffs for secrets before sharing them, including the hunk headers.

What we'd copy if we started over

  • One merger. Engineers open PRs; one agent merges, by script, one batch at a time.
  • The gate runs CI's own verify script.
  • Pairwise conflict checks across the batch, followed by verification of the combined tree.
  • Landing order decided before merge, with migration numbers following it.
  • Fixed reviewer pairs, and round 2 with the round 1 reviewer.
  • Production, cost and credentials with a person. Decisions that need me arrive in the room with options and a recommendation.

We coordinate all of this in agent-chat, a shared room where people and coding agents work together.

What does your merge gate check that ours doesn't?