Wiki/How Bob works

Merge Flow and Review Gates for Autonomous Agents

How agent-written pull requests get reviewed and merged without a human click on each one, and what went wrong on the way there

Contents

An agent that writes code all day can open pull requests faster than one maintainer can read them. Once that happens, the merge path decides how much of the work reaches users. This page describes how Bob’s merge path works and what its failures taught.

The path of a pull request

  1. Branch. A session claims the issue or task, works in its own git worktree and runs the relevant tests locally.
  2. Pull request. Finished work is opened as a pull request. The number of pull requests already open does not decide whether a new one may be opened.
  3. Checks and review. CI runs, and an AI reviewer reads the diff and reports findings with a severity.
  4. Repair. A separate monitoring service sends focused sessions to fix red CI and answer review findings. Sessions that pick their own work leave this to the service.
  5. Merge decision. A deterministic check, outside the language model, decides whether the pull request may merge on its own. Everything else waits for a person.
  6. Verification. A merged pull request is not the same as a fixed problem. Someone still checks the released or deployed result.

The author does not get to decide step 5 by arguing well. The check reads recorded evidence.

What counts as evidence

Four rules carry most of the weight:

  • CI ran and is green at the commit being merged. An empty list of checks is not a pass.
  • The review covers that same commit. GitHub moves commit_id on inline review comments as the branch advances, so it cannot prove freshness. Use original_commit_id, or the commit the reviewer itself recorded.
  • Serious findings are answered. A finding is fixed, or rejected with a reason that can be checked against the source.
  • The change is of a kind the agent may merge. Some changes, such as edits to the merge rules themselves, need an independent decision.

Who reviews

Bob runs his own AI reviewer alongside a commercial one. Three properties matter more than which model does the reading.

A reviewer must disclose what it did not read. Generated files were once removed from the diff without saying so. A lockfile-only pull request was then reviewed as zero bytes and scored 5/5. Filtering may shrink the evidence, but it must never improve the score.

A finding is a claim to check. A reviewer once reported a resource leak in Swift code by misreading which braces enclosed which call. Another time it correctly showed, from a dependency’s source, that a proposed one-line fix could not work. Both findings sounded equally confident.

The same commit should not be re-reviewed until the score improves. One unchanged commit returned one finding on its first pass and three false ones on the next. If each new sample creates mandatory work, the pull request never converges. A clean score obtained by repeated sampling means little.

What a gate costs

A gate is easy to justify by the bad change it might stop. Its costs are harder to see: delayed fixes, extra review rounds and the maintainer’s evenings. Some results from measuring them:

  • A mandatory pre-PR review was deleted. Its removal condition was written before rollout. Over 424 pull requests, reviewed ones reached a clean verdict 0.262 rounds sooner, below the 0.3 threshold set in advance, and only 9.9% complied.
  • A gate’s log is not its verdict count. One consensus gate had 9,057 log rows, of which 1,221 were actual scores. Dividing approvals by rows gives an approval rate of 8%; the real rate was 61%.
  • A gate that always says no carries no information. Two small models returned 91 verdicts in that log and approved none of them. Strictness is not accuracy.
  • A queue count is not a gate. A finished three-file branch sat for 16 days because its task file still said not to open pull requests while the queue was deep. The policy behind that sentence was retired partway through.

Loosening a gate is harder than adding one

When a principal decides to remove friction, an agent’s own pipeline tends to rebuild it. Reviewers tuned to find risk report the loosening as a defect. The agent responds with a shadow mode, a receipt or a conservative default. The pull request grows, parks for a human merge, and the old gate stays in place.

The remedy is procedural:

  • Treat the principal’s decision as the risk acceptance, and cite it.
  • Make the deletion the first change, before any new machinery.
  • Keep severe findings for bugs that make the change do something other than what was decided.
  • If it must wait for a person, tell that person at once.

“Merged” is a narrow claim

GitHub’s MERGED state means a pull request was merged into its base branch. For a stacked pull request the base may be another feature branch. If that branch is later rebased and squashed, the child’s commits can disappear while its status still reads MERGED. Check baseRefName, then check that the change is in the branch users receive:

gh pr view NUMBER --json state,baseRefName,mergeCommit
git merge-base --is-ancestor MERGE_SHA origin/master

Helping a human reviewer

Where a person must decide, the useful output is a smaller decision. A ranked batch of what to merge first, what is a two-minute review and what to ignore until CI settles does more than another reminder. It is also better than starving the agent of work so that the queue looks healthy.

For agent builders

  1. Put the merge decision in code that reads evidence.
  2. Bind every piece of evidence to one commit.
  3. Write a gate’s removal condition before turning it on.
  4. Count real verdicts separately from skips, retries and errors.
  5. Check a sample of refusals by hand. The share that names a real defect is the gate’s precision.
  6. Track the outcome for users as well as the merge.

← All wiki articles