deanphillips.dev

Building with AI · October 2026

From trust to enforcement: governing an AI delivery pipeline

My AI pipeline tests whether SDLC best practices still have to be followed by hand. Its agents started out merging their own changes. Then I held them to the standard a sensitive-data app would need. Here's what that took, in two days.

SeriesOverview + 2 parts
  1. Overview From trust to enforcement
  2. Part 1 A threat model for the pipeline
  3. Part 2 Finding a hole in its own rules

On October 21 I turned off my own safety hook and pushed a commit straight to main. GitHub refused it: “Changes must be made through a pull request.”

I’ve worked in plenty of repos where pushing to main was off the table. This was the first time RepBunny’s repo said it to me, and I was delighted. Two days earlier, every rule in my AI delivery pipeline was something the agents were asked to follow. Now GitHub was enforcing them, on me included.

This is the first of three posts on how that happened: the controls, the threat model behind them, and the hole in them the pipeline found the afternoon they went live. The pipeline builds RepBunny, a strength training app I work on around a full-time job, and the AI delivery team series covers how it works day to day.

Where it started

The whole pipeline is an experiment that challenges one assumption: that SDLC best practices (reviews, protected branches, independent checks, an audit trail) have to be followed by hand. They belong on every application, even one with almost no data risk. The usual reason small projects skip them is the manual effort, and I wanted to see whether AI agents could carry that effort instead.

RepBunny is a good test because the stakes are low. It keeps every workout on the phone it was logged on, with no accounts and no servers holding anyone’s data. So the first version leaned on trust: agents merged their own pull requests once a full end-to-end test gate passed, a review agent read the risky ones, and I stood between main and every store release. A bad merge could break the app, but it couldn’t reach anyone’s data, and it couldn’t reach the store without me.

On October 20 I took the next step and asked whether the pipeline would hold up for an app that did handle sensitive data. I went through it the way an outside auditor would, and found five places where it relied on trust instead of enforcement. Flip the switch to see where each one ended up.

  • The test gateTrustedThe agent that wrote the change ran the tests, then merged its own pull request. Nothing independent checked that claim.FixedBuild, docs, and security checks run on GitHub's own runners on every pull request, and an independent end-to-end run gates every store release.
  • The rulesTrustedPrivate repo on GitHub's free plan, so no branch protection. Every rule was an instruction an agent could ignore.FixedA ruleset on main requires a pull request, an approval, and green CI. Nobody is on a bypass list.
  • Who did whatTrustedOf 199 pull requests in 30 days, 180 were opened by my account. The rest were Dependabot. The history couldn't tell my work from an agent's.FixedA Builder bot opens the pull requests and a Reviewer bot posts the reviews, each under its own name.
  • The guardrailsTrustedA skill, a workflow, or the risk check could be edited by the same agents it was meant to limit.FixedThose files are code-owned, so a change to any of them waits for my approval in GitHub.
  • SecurityTrustedNo security scanning, and no written threat model.FixedSecret scanning, static analysis, a dependency audit, and a workflow linter on every pull request, plus a written threat model.
Five gaps, two days apart.

The decisions

I upgraded to GitHub Pro, which is what makes branch rules possible on a private repo. Every change, mine included, now goes through a pull request. The rules have no bypass list, so getting around them means switching them off, and the written break-glass procedure for a real emergency leaves a record when that happens.

I only want to approve the changes that matter, so I kept the risk tiers the review agent already used. Tier 3 is anything touching the guardrails, the data schema, permissions, native config, or a new network call. Only tier 3 waits for me. Everything else merges on green CI plus the review agent’s approval.

What shipped

1,275commits scanned for leaked secrets. Zero found
5real workflow problems the new scanner found on day one
0bypass actors on main, including me

Independent CI on every pull request. Build, docs checks, and a security job run on GitHub’s own runners. That’s evidence the agent didn’t produce. The security job runs a secret scanner, a static analyzer for code and workflows, a dependency audit, and a workflow linter. Every tool is pinned to an exact version, and the downloaded ones are checked against their published checksums.

The scanner earned its place right away. Its first real run found four places where a workflow dropped a value straight into a shell script, the classic injection pattern. It also found a release workflow handing every repo secret to a job that needed nine. While I was in there, I pinned the one third-party action that touches release credentials to an exact commit instead of a tag its owner could move. All of that is fixed now.

The token that couldn’t fail

I wanted two bots with their own names, a Builder and a Reviewer, opening the pull requests and posting the reviews, so the history could finally tell my work from an agent’s. The plan was simple: each agent mints a short-lived token for its bot and uses it.

Then a test went suspiciously well. My agents run in cloud sessions, and from one of them a fake token worked just as happily as a real one.

It turns out those sessions reach GitHub through a proxy that swaps any token they send for the session’s own. A bot token minted inside a session does nothing at all. So the bot actions moved into two small GitHub workflows. They hold the app keys, mint a token that lasts an hour, and only run trusted code from main.

The rules, live

The last piece was a ruleset on main: pull request required, one approval, code owner review for tier 3 paths, the CI check required, squash merges only, no force pushes. That’s what turned away my direct push.

BuildAn agent writes the change and runs the full test suite.
OpenThe Builder bot opens the pull request.
CheckCI and the security scan run on GitHub, not in the agent session.
ReviewThe Reviewer bot reads the diff. On tier 3 it turns on auto-merge and asks me.
ApproveI approve on my phone. It merges itself.
A tier 3 change now. The approval at the end is mine, in the GitHub app.

Three trade-offs, written down

Three controls aren’t as strong as they could be yet. Each is written down as an accepted risk, with what still holds and a trigger to revisit.

End-to-end tests run independently only at release time. Running the full suite on every pull request would take about 8,000 to 10,000 CI minutes a month, far past what Pro includes, so it would need a dedicated runner that the app doesn’t earn enough to pay for yet. Agents still run the suite before merging, and a clean independent run gates every store release. A bug an agent misses can sit on main until release, but it can’t reach anyone’s phone.

The review agent runs where the agents it reviews run. It works in the same kind of cloud session as the build agents, so its approval is a record, not proof: any session could start the workflow that posts it. Fully separating them means running the review inside GitHub Actions on a pay-per-use API key. Until that’s worth paying for, the changes that matter, tier 3, also wait for my approval.

A session could post my approval. GitHub checks that a tier 3 approval comes from my account, not who tapped the button. The agent sessions hold a credential for that account, and for the cloud ones a proxy sets it, so I can’t take it away. Only the agents’ own rules say never to approve. What still holds: every tier 3 change gets a review first, the reviewer never approves tier 3, each approval sits in the review history with a timestamp, and a pause switch stops every run. If one ever shows up that I didn’t give, that’s the trigger to revisit.

When to revisit:

all three are in the threat model, each with what still holds and the trigger to revisit. For the first two, the trigger is the app earning enough to pay for a fix. For the third, it’s the cloud platform letting a session use its own token.

What else broke

The next post is the threat model behind all this, starting with what happened when I tried to hack my own pipeline with a support email.