This is the last of three posts on governing an AI delivery pipeline. The first covers the rules GitHub now enforces, and the second the threat model behind them. This one is about the afternoon they went live, and the three bugs hiding in the rules themselves.
How a risky change merges now
For the riskiest changes (anything touching the agents’ own rules, the data on the phone, or permissions), the flow ends with me. The review agent reads the change and, if it finds no blockers, turns on GitHub’s auto-merge, pinned to the exact commit it reviewed. Then it asks me. I tap Approve in the GitHub app on my phone, and the change merges itself.
The pin is the whole promise. When I approve, I’m approving something the reviewer already read.
Bug one: a merge that would never happen
The pull request that added these rules went through review first, like any other. The review agent sent it back with one blocker.
- ReviewerBlocker: if turning on auto-merge fails, nobody is told. The review bot doesn't have the permission auto-merge needs, and the repo has auto-merge switched off until the rules are applied. The owner approves, nothing merges, and no run ever starts to notice.
- Build agentFixed: the step that turns on auto-merge now uses the builder bot, which has the permission. The script waits until GitHub shows auto-merge as on, and if it never does, the owner is asked to merge by hand instead.
- ReviewerFixed. Owner decides.
That would have been a quiet failure. Every risky change would sit approved and unmerged, and I’d have assumed the agents were slow.
Bug two: a commit nobody reviewed
The rules went live, and the first risky change merged itself on my approval, as designed. Then the agents opened the next one: the governance page that lists every control and its evidence. The review passed with two wording nits. A build agent fixed them and pushed one more commit.
Auto-merge stayed on.
Step through it to see why that matters.
After the review
Everything lines up
- ReviewedA
- Pull request is atA
- Auto-mergeOn
The reviewer read commit A, found only two wording nits, and turned on auto-merge pinned to A. Now it waits for me.
Then
One more commit
- ReviewedA
- Pull request is atB
- Auto-mergeStill on
A build agent fixes the nits and pushes commit B. Nobody has reviewed B.
If I had tapped Approve
B merges, unreviewed
- ReviewedA
- MergedB
- Reviewed byNobody
GitHub checks the pinned commit only when auto-merge is turned on. A later push from anyone with write access doesn't switch it off. So my approval would have merged code the reviewer never read.
Now
A push turns it off
- Pull request is atB
- Auto-mergeOff
- NextNew review
A small workflow watches for pushes. It turns auto-merge off, takes the pull request out of my queue, and says it needs a new review.
Here it was a two-line wording fix, and I’d have been approving what was on my screen anyway. But the promise was that I only ever approve reviewed code, and a push after review broke it without any warning.
The pattern:
a check that runs once, when something is switched on, isn’t the same as a check that holds. If the thing it guards can change afterward, something has to watch for the change.
Bug three: the fix needed fixing
That new workflow went through review too, and the reviewer found a problem in it. Here’s a simplified version of the step it flagged. Can you spot it before the reviewer did?
Tap the line that lets an unreviewed commit sneak through.
Line 3 shrugs off every error, so the step reports success and posts 'Auto-merge is off' even when it isn't. A permission change or a GitHub outage would look exactly like success, and the unreviewed commit could still ride the old auto-merge in. Now the step only shrugs when auto-merge was already off. Otherwise it fails loudly.
if ! disable_auto_merge "$PR"; then
if [ "$AUTO_MERGE_WAS_ON" = "true" ]; then
echo "Couldn't turn auto-merge off" >&2
exit 1
fi
fiI’d let the step shrug off an error because auto-merge might already be off, which is a perfectly normal case. The reviewer’s note was blunt: “a failed disable is reported as success.” It was right.
Both pull requests merged that afternoon, each on my approval.
What I took from it
- Review the controls, not just the code. All three bugs were in the governance work itself: a merge that would never fire, a check that only ran once, and an error treated as success. None of them would have shown up in a test of the app.
- The rules apply to me too. The governance work went through the same review as every agent’s change. That’s where the review paid off.
- Write down what you find. The gap is now a row on the governance page with the workflow that closes it, so the monthly process review checks it’s still there.
My favorite part is still the last one. The review bot caught a bug in the code that guards its own reviews.