Tiered Code Review: AI-First with Human Escalation¶
Route review effort by risk: AI handles the first pass, non-critical code merges after AI-only review, and critical code escalates to human review.
The problem¶
AI-generated code is increasing PR volume. PRs are ~18% larger and change failure rates are up ~30% compared to human-only codebases. Review capacity limits how fast code ships, and uniform human depth does not scale.
Tiered code review treats review as a risk-routing problem: classify code by criticality, then match review effort to risk level.
How it works¶
flowchart TD
PR[Pull Request opened] --> AI[AI Review<br/>runs on all PRs]
AI --> classify{Risk classification}
classify -->|Non-critical| auto[AI-only review<br/>Tests, docs, config, styles]
classify -->|Core| hybrid[AI + Human review<br/>Business logic, APIs]
classify -->|Security-sensitive| human[Mandatory human review<br/>Auth, payments, crypto]
auto -->|Pass| merge[Merge]
hybrid -->|Human approves| merge
human -->|Human approves| merge
Three tiers, each with a different review bar:
| Tier | Code types | Review requirement | Merge gate |
|---|---|---|---|
| Automated | Tests, docs, config, CSS, migrations | AI review only | AI passes, CI green |
| AI + Human | Business logic, API contracts, data models | AI first pass + human approval | CODEOWNERS approval |
| Human-only | Auth, payments, cryptography, PII handling | Mandatory human review | Security team approval |
Real-world implementations¶
The OpenAI Codex team runs AI review via GitHub webhook when a PR moves from draft to review. Their custom model achieves ~90% accuracy. Non-critical code merges after AI-only review; core agent code and open source components require human review.
GitHub Copilot code review passed 60M+ reviews and can be enabled on all PRs at org or repo level. It surfaces actionable feedback in 71% of reviews and stays silent on the remaining 29%.
Claude Code provides automated security review via CLI and GitHub Actions. Anthropic uses it internally as a CI gate, catching RCE and SSRF vulnerabilities before merge.
Implementing with GitHub native tools¶
GitHub does not offer path-based review routing natively. Approximate tiered review by layering three existing mechanisms:
1. Enable automatic AI review¶
Configure Copilot automatic code review at the repository or org level. This covers the AI-first pass on all PRs.
2. Define CODEOWNERS for critical paths¶
# .github/CODEOWNERS
# Tier 3: Security-sensitive — requires security team
/src/auth/ @security-team
/src/payments/ @security-team
/src/crypto/ @security-team
# Tier 2: Core business logic — requires domain owner
/src/api/ @backend-team
/src/models/ @backend-team
/src/services/ @backend-team
# Tier 1: Non-critical — no CODEOWNERS entry
# Tests, docs, config get AI review only
3. Set branch protection rules¶
Require CODEOWNERS approval in branch protection. PRs that touch only Tier 1 paths (no CODEOWNERS match) need only AI review and passing CI. PRs touching Tier 2 or 3 paths require the designated human reviewers.
Severity-driven merge gates¶
Within each tier, classify AI findings by severity to prevent critical issues from drowning under cosmetic noise:
| Severity | Effect | Example |
|---|---|---|
| Action Required | Blocks merge | SQL injection, auth bypass, data loss risk |
| Recommended | Advisory, mergeable | Missing error handling, suboptimal algorithm |
| Minor Suggestion | Optional | Naming improvements, style preferences |
This severity-driven pattern keeps the merge gate meaningful. Only Action Required findings on critical paths block the pipeline.
Classification framework¶
Deciding what counts as "critical" is the hardest part. Four heuristics:
- Security boundary: code handling authentication, authorization, encryption, or PII requires human review. This is where the security review gap in AI-authored PRs is widest.
- Financial impact: code processing payments, billing, or subscriptions requires human review.
- Blast radius: bugs that affect all users rather than one feature. Higher blast radius demands human review.
- Reversibility: changes that corrupt persistent state rather than rolling back in minutes need human review.
Non-critical is everything else: tests, docs, configuration, CSS, build scripts, and reversible migrations.
Example¶
A monorepo with src/auth/, src/api/, and tests/ directories uses all three tiers in a single GitHub Actions workflow:
# .github/workflows/tiered-review.yml
name: Tiered Review Gate
on:
pull_request:
types: [opened, synchronize, ready_for_review]
jobs:
classify:
runs-on: ubuntu-latest
outputs:
tier: ${{ steps.classify.outputs.tier }}
steps:
- uses: actions/checkout@v4
- id: classify
run: |
FILES=$(gh pr diff ${{ github.event.pull_request.number }} --name-only)
if echo "$FILES" | grep -qE '^src/(auth|payments|crypto)/'; then
echo "tier=3" >> "$GITHUB_OUTPUT"
elif echo "$FILES" | grep -qE '^src/(api|models|services)/'; then
echo "tier=2" >> "$GITHUB_OUTPUT"
else
echo "tier=1" >> "$GITHUB_OUTPUT"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ai-review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run AI review
run: |
# Copilot automatic review is configured at repo level;
# this step runs supplementary checks (linting, security scan)
npm run lint
npm run security:scan
gate:
needs: [classify, ai-review]
runs-on: ubuntu-latest
steps:
- name: Enforce tier gate
run: |
TIER=${{ needs.classify.outputs.tier }}
if [ "$TIER" -ge 2 ]; then
echo "Tier $TIER — CODEOWNERS approval required before merge"
else
echo "Tier 1 — AI review and CI sufficient"
fi
Pair this with the CODEOWNERS file from the implementation section above. Tier 1 PRs (tests, docs, config) merge after AI review and green CI. Tier 2 and 3 PRs wait for the designated human reviewers defined in CODEOWNERS.
When this backfires¶
Tiered review depends entirely on correct classification. Three conditions cause it to fail:
- Misclassified security code: a database migration that adds a PII column, a config change that broadens CORS policy, or a utility function called from an auth path. None of these match a CODEOWNERS pattern for
/src/auth/, so they route to Tier 1 and merge without human review. - Cross-cutting changes: a refactor touching both
tests/(Tier 1) andsrc/api/(Tier 2) in one PR. If classification logic checks the first matching tier, the PR may under-escalate. - AI confidence drift: AI reviewers trained on earlier code patterns silently degrade on novel architectural styles. Without periodic accuracy audits, the Tier 1 gate erodes while appearing functional.
Tiered review reduces the volume reaching human reviewers. It does not replace threat modeling, dependency scanning, or human judgment on the paths that matter.
FAQ¶
How do I approximate tiered review with GitHub's native tools?
GitHub has no path-based review routing, so layer three existing mechanisms. Enable Copilot automatic code review at repository or org level for the AI-first pass. Define CODEOWNERS entries for critical paths. Then require CODEOWNERS approval in branch protection. PRs touching only paths with no CODEOWNERS match need just AI review and green CI.
What actually makes a change "critical"?
Four heuristics decide. Security boundary: authentication, authorization, encryption, or PII handling. Financial impact: payments, billing, or subscriptions. Blast radius: bugs that hit all users rather than one feature. Reversibility: changes that corrupt persistent state instead of rolling back in minutes. Everything else — tests, docs, configuration, CSS, build scripts, reversible migrations — is non-critical.
How does tiered review fail quietly?
Through misclassification. A migration adding a PII column, a config change broadening CORS policy, or a utility function called from an auth path matches no CODEOWNERS pattern, so it routes to the automated tier and merges without human review. Cross-cutting PRs can under-escalate, and AI reviewers silently degrade on novel architectural styles unless accuracy is audited periodically.
Key Takeaways¶
- Tiered review is a risk-routing problem — classify code by criticality, then match review depth to risk
- AI review runs on everything; human review is reserved for costly or irreversible mistakes
- Layer CODEOWNERS + branch protection + automatic AI review to approximate tiered review on GitHub today
- Severity-driven merge gates prevent critical findings from drowning in noise
Related¶
- Signal Over Volume in AI Review
- Tunable Review Effort — per-PR effort routing as the operator-set counterpart to these review tiers
- Agentic Code Review Architecture
- Committee Review Pattern
- Human-AI Review Synergy
- Risk-Based Shipping
- Agent PR Volume vs. Value
- CRA-Only Review and the Merge Rate Gap
- Diff-Based Review Over Output Review