Trust Boundaries for AI Agents in CI/CD
Which agent actions can run alone, which need a reviewer and which must be impossible, and how to enforce each zone with GitHub environments, CODEOWNERS and OPA.
By VVVHQ Team ·
AI agents now write code, generate tests, bump dependencies and propose infrastructure changes, and some of them open pull requests with no person at the keyboard. Their work also gets turned away more often. LinearB's 2026 Software Engineering Benchmarks Report, drawn from 8.1 million pull requests, found that AI pull requests were merged within 30 days 32.7% of the time, against 84.4% for pull requests written without AI. Reviewers are already filtering a lot of agent output. The question for a platform team is which agent actions can skip review, which must go through it, and which the agent should have no way to attempt.
Three zones of trust
A trust boundary says what an agent can do on its own, what needs a person to confirm, and what is off-limits. It does the job of an IAM policy for an automated contributor instead of a cloud resource.
Teams without one tend to fail in one of two directions. With too much access, the agent pushes to main, merges its own pull requests or edits production configuration, and one wrong terraform destroy becomes an incident. With too little, every lint fix waits for three approvals and the agent becomes a slower way to do the same work.
What the agent can do alone
Changes with a small blast radius that are easy to revert:
- Lint and formatting fixes.
- New tests. Extra coverage does not change production behaviour.
- Documentation: READMEs, comments, changelog entries.
- Patch-level dependency bumps with CI passing.
- Fixes for warnings that existing static analysis tools already raise.
If CI passes and the diff stays inside these categories, auto-merge is reasonable.
What needs a person
Changes with real risk go to a reviewer who knows that part of the system:
- Anything that changes application behaviour.
- Merges into protected branches, even with green CI.
- Major dependency upgrades.
- Configuration: environment variables, feature flags, instance sizes.
- Database migrations, which are hard to undo in practice.
- Changes to the CI/CD pipeline itself. An agent that can edit the pipeline can grant itself more access.
The agent prepares the change and explains it, and a person decides.
What must be impossible
Some actions should be blocked by the permissions the agent runs with, so that a written policy is never the only thing in the way:
- Production deployments that skip the approval gate.
- Reading secrets, credentials or API keys.
- Destructive infrastructure commands such as
terraform destroyorkubectl delete namespace. - Bypassing branch protection.
- Changing audit logs or security controls.
- Approving its own pull requests.
If the agent could do any of these with the access it has today, the boundary is only a request.
Enforcing the boundary in GitHub
Give the agent its own identity, a GitHub App or a dedicated bot account, with permission to push branches and open pull requests and nothing more. Branch protection on main then holds every agent change for review, and GitHub does not let the author of a pull request approve it.
Deployments run from a separate workflow that starts only after a reviewed merge:
# .github/workflows/deploy.yml
name: deploy
on:
push:
branches: [main]
jobs:
staging:
runs-on: ubuntu-latest
environment: staging
steps:
- uses: actions/checkout@v4
- run: ./deploy.sh staging
production:
needs: staging
runs-on: ubuntu-latest
environment: production # required reviewers, self-review blocked
steps:
- uses: actions/checkout@v4
- run: ./deploy.sh production
Configure the production environment with required reviewers and turn on "Prevent self-reviews", so the person who triggered the run cannot approve it. Keep production credentials as environment secrets. A job receives them only once it has passed that environment's protection rules, so they never reach a run a reviewer has not approved.
CODEOWNERS routes each change to the right reviewers:
# .github/CODEOWNERS
* @platform-team
/terraform/ @infrastructure-leads
/.github/workflows/ @security-team
/.github/CODEOWNERS @security-team
/src/auth/ @security-team
With "Require review from Code Owners" turned on in branch protection, an agent pull request that touches terraform/ waits for an infrastructure lead. The CODEOWNERS file is listed in itself, so an agent cannot pick its own reviewers by editing it.
Policy as code with OPA
Agents that act outside pull requests, for example by running Terraform or calling internal APIs, need a check before each action. Open Policy Agent can make that decision. In OPA 1.0 syntax:
package agent.policy
default allow := false
# Patch-level dependency bumps with passing CI may proceed
allow if {
input.action == "dependency_bump"
input.bump_type == "patch"
input.ci_status == "passing"
}
# Each refusal is logged with a reason
deny contains "agents never read secrets" if {
input.action == "read_secret"
}
deny contains "plans that destroy resources need a person" if {
input.action == "terraform_apply"
input.has_destroys
}
Anything that no rule allows is refused, and the deny messages give the log a reason for each refusal. The policies live in Git, so changing a boundary goes through the same review as any other change.
An audit trail for every agent action
Every agent action, allowed or refused, should leave a record that cannot be edited afterwards:
- What the agent did or tried to do.
- What triggered it: the prompt, the issue or the schedule.
- The full diff.
- Who approved it, where approval was needed.
- Which policy checks refused it.
After an incident the first question is what the agent did and who let it. These records are how you answer it.
Sizing the blast radius
Each decision comes down to one question: if the agent gets this wrong, how bad is it?
| Action | Blast radius | Trust level | |---|---|---| | Fix a typo in a README | Close to zero | Autonomous | | Refactor a utility function | Low, tests catch most mistakes | Confirmation | | Change authentication middleware | High, security impact | Confirmation plus security review | | Delete a production database | Severe | Forbidden |
Scope matters as much as the action. An agent working in one service is safer than one with access to a whole monorepo, and an agent that can only open pull requests is safer than one that can merge them.
How teams swing between too open and too closed
A cycle we see often: a team adopts a coding agent and gives it broad access, a bad change slips through and causes an incident, the team locks everything down and the agent stops being useful, and then access creeps back without written rules until the next incident.
The cycle ends when the boundaries are treated as infrastructure: written as code, kept in version control and enforced by GitHub, the cloud provider and the policy engine. Teams do not manage IAM through verbal agreements, and agent permissions deserve the same care.
We build multi-LLM workflows for code review and issue tracking with access controls and an audit trail, and on an industrial IoT platform we measured what each AI pull-request review cost and moved the review to on-demand. For boundaries like these in your own pipeline, contact us and we will say where we would draw them.