Agentic Pattern Libraryby Vikas Goyal
← All patterns
61

Observe-Then-Enforce Approvals

Also known as: shadow-mode approval policy, approvals as code, risk-tiered review policy

Write approval rules as code, tiered by risk, and run them in observe mode against real PRs before letting them block or approve anything.

TrackAI-native software delivery FamilyOperating model Maturity Emerging ChangesDecisionVerification
01

Problem

As AI review gets better, teams want to let it lighten human review on low-risk changes while keeping people firmly in charge of risky ones. Changing approval rules directly is dangerous: a rule that’s too loose lets bad changes merge with no one looking, and one that’s too strict slows every team. Opinions about which changes are safe rarely match what reviewers actually do, and mistakes only show up after something has shipped.

  • Different paths carry very different risk (docs versus auth or billing).
  • AI review verdicts can be swayed by text in the PR itself.
  • An AI approval may count as a real approval in branch rules.
  • Teams need evidence before trusting a looser rule.
02

Solution

Express approval requirements as a policy file in the repository. Each rule names a purpose, the paths it covers, and what it needs, such as two approvals, or a human who isn’t an author for auth, billing and CI. Changes to the review rules themselves need the strictest rule. Start the policy in observe mode: on every PR it records what it would have decided but approves and blocks nothing. After a week or two, compare its decisions with what reviewers actually did. Where it would have approved but reviewers asked for changes, add a human-required rule or fix the review checklist. Where a rule demanded two people who always approved at a glance, consider narrowing it. Only then switch to enforce, rerun the policy on open PRs, and make its check required. Teams further along let a classifier sort every change: mechanical, low blast-radius changes merge after automated checks, and everything else goes to a person. The classifier earns that right the same way, by running in observe mode first.

03

Diagram

Policy file all paths · 2 seats rule files · 2 seats auth · billing · CI Observe modelog "would decide" Real reviewswhat people did Compare1–2 weeks of PRs Enforcerequired check Adjust rulestighten · narrow clean mismatch

The policy runs in the shadow of real reviews first. Its mistakes are found and fixed before it can block or approve anything.

04

When to use

Use it when

  • AI review is in place and the team wants it to carry weight
  • Repos mix low-risk and high-risk paths
  • Approval rules are argued about rather than measured
  • Branch protection and required checks are available

Avoid it when

  • Teams without AI review or written review rules yet
  • Regulated paths where the human requirement is fixed by policy anyway
  • Repos with untrusted contributors, where PR text could sway AI verdicts
05

Trade-offs

Latency Observe period before any change in review speed
Cost AI reviews and classifiers run even in observe mode
Complexity Policy file, branch rules and required checks must agree
Reliability Rules are tested on real PRs before they bite

Gains

  • Approval rules based on evidence, not opinion
  • Human review focused on the paths that need it
  • Mistakes in the policy found before they cause harm

Costs

  • Needs an observe period and someone to analyze it
  • Policy, branch rules and auto-merge interact in subtle ways
  • Billed reviews can start just because the policy names them
06

Worked example

Scenario
The Linkwatch team wants a passing AI review to reduce routine PRs from two approvals to one, while auth and billing always need a non-author human.
  1. PolicyWrites three rules: everything needs 2 approvals; review rule files need 2; auth, billing and CI need 1 human who isn’t an author. Sets mode to observe.
  2. Two weeksThe policy logs decisions on 140 merged PRs. On 9 it would have approved after a passing AI review, but reviewers requested changes.
  3. AnalysisSix of the 9 touch database migrations. The team adds a migrations path to the human-required rule and adds a migration check to the review checklist.
  4. NarrowingDocs-only PRs always got two instant approvals. That rule is narrowed to one approval.
  5. EnforceRemoves observe mode, reruns the policy on open PRs, and asks an admin to make the approvals check required.
07

Failure modes

FailureSymptomMitigation
Skipping observePolicy blocks or waves through PRs on day oneAlways start in observe mode and review results before enforcing
AI approval as the only approvalBranch rules need one approval and the AI alone satisfies itRead policy and branch rules together; keep human-required paths without overrides
Auto-merge surprisePRs merge with no person having lookedDecide per path whether auto-merge is allowed and document it
Policy edits slip throughSomeone loosens the rules in an ordinary PRThe strictest rule covers the policy and review rule files