AI-Orchestrated Code Review System at Scale
cloudflare · Tech · 2026 · source Agentic: yes · promotional bias: med · source-backed · extracted with prompt 0.5.4 (schema v2)
Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.
Problem
Domain: Engineering code review and CI/CD quality gates
Cloudflare needed to reduce code-review bottlenecks across thousands of repositories without flooding engineers with noisy or unsafe AI comments.
Constraints:
- hours-long median first-review wait
- thousands of repositories
- CI/CD critical path
- security-sensitive code
- LLM provider and runtime failures
- cost control
Architecture
Cloudflare built a CI-native code-review orchestrator around OpenCode: a coordinator classifies merge-request risk, launches specialized reviewers, collects structured XML findings and JSONL logs, then applies approval rules with human break-glass escape.
Diagram confidence: explicit (topology described by the source).
flowchart LR ci-review-trigger["CI review trigger"] opencode-coordinator["OpenCode coordinator"] risk-tier-classifier["Risk-tier classifier"] reviewer-sessions["Reviewer sessions"] structured-findings["Structured findings"] jsonl-event-logs["JSONL event logs"] coordinator-decision["Coordinator decision"] human-break-glass-override["Human break-glass override"] ci-review-trigger --> opencode-coordinator opencode-coordinator --> risk-tier-classifier risk-tier-classifier --> reviewer-sessions opencode-coordinator --> reviewer-sessions reviewer-sessions --> structured-findings structured-findings --> coordinator-decision jsonl-event-logs --> coordinator-decision coordinator-decision --> human-break-glass-override
Components
| Component | Role | Interacts with |
|---|---|---|
CI review trigger |
Starts AI review from the merge-request pipeline. | OpenCode coordinator |
OpenCode coordinator |
Classifies risk, spawns reviewer sessions, gathers findings, and decides approval posture. | Risk-tier classifier, Reviewer sessions, Structured findings |
Risk-tier classifier |
Chooses review depth so small changes do not burn maximum model capacity. | OpenCode coordinator, Reviewer sessions |
Reviewer sessions |
Run specialized security, performance, code quality, documentation, release, and compliance reviews. | Structured findings |
Structured findings |
Returns XML findings from reviewers without constraining their internal tools. | Coordinator decision |
JSONL event logs |
Persist crash-tolerant debug and review events. | Coordinator decision |
Coordinator decision |
Produces approve, approve-with-comments, or block decisions with a bias toward approval. | Human break-glass override |
Human break-glass override |
Lets human reviewers force approval when needed. | Coordinator decision |
Data flow
Merge requests enter a coordinator that classifies risk, launches up to seven specialized reviewers, accepts structured XML findings, and produces a review decision.
Why this architecture
The orchestration, filtering, and human escape hatch exist because naive LLM review flooded engineers with vague or hallucinated comments.
break glass, the system forces an approval regardless of what the AI found.”article, statedModels used: OpenCode-backed coding agents · coordinator agent · specialized reviewer agents
Scale
- The system completed 131,246 review runs across 48,095 merge requests in 5,169 repositories.“the system completed 131,246 review runs across 48,095 merge requests in 5,169 repositories.”article, stated
- Cloudflare completed 131,246 AI review runs across 48,095 merge requests in 5,169 repositories.“the system completed 131,246 review runs across 48,095 merge requests in 5,169 repositories.”article, stated
- The system produced 159,103 total findings across reviews.“The system produced 159,103 total findings across all reviews, broken down as follows:”article, stated
- The original bottleneck included hours-long median first-review wait times across thousands of repositories.“Across our internal projects, the median wait time for a first review was often measured in hours.”article, stated
Alternatives considered (roads not taken)
Always run every specialized reviewer
Rejected because: Cloudflare uses risk tiers because a one-line typo fix does not justify seven expensive agents.
auth/, crypto/, or file paths that sound even remotely security-related always trigger a full review”article, statedStrictly block on uncertain findings
Rejected because: The coordinator biases toward approval with comments rather than blocking when evidence is weak.
approved_with_comments rather than a block.”article, statedPassing massive merge-request prompts as command-line arguments
Rejected because: Cloudflare passed prompts through stdin to avoid process argument limits on large merge requests.
stdin rather than as a command-line argument, because if you have ever tried to pass a massive merge request description full of logs as a command-line argument”article, statedOrdinary JSON blobs for crash-time logs
Rejected because: Cloudflare used JSONL event logging because early exits can lose ordinary JSON debug logs.
Patterns
multi-agent-orchestration (orchestration)
A coordinator launches specialized review agents in parallel and consolidates their findings into one structured review.
structured-output-contract (reliability)
Sub-reviewers return structured XML findings, while the coordinator deduplicates, filters, assigns severity, and posts a single review comment.
cost-aware-routing (operations)
The system classifies merge requests by risk tier so trivial changes do not consume the same agent budget as security-sensitive or large changes.
human-in-the-loop-gate (safety)
A human reviewer can force approval with a break-glass comment for hotfixes or AI/provider failures, and the override is tracked in telemetry.
break glass, the system forces an approval regardless of what the AI found.”article, statedTradeoffs
How many reviewers to run per merge request.
Chose risk-tiered reviewer depth over always running the full specialist set.
Rationale: Security-sensitive or large diffs get full review, while small low-risk changes avoid unnecessary latency and token cost.
auth/, crypto/, or file paths that sound even remotely security-related always trigger a full review”article, statedHow aggressive the bot should be when findings are uncertain.
Chose bias toward approval and signal over noise over blocking every warning or producing many speculative comments.
Rationale: The system sits in the shipping path, so it keeps findings low-volume and blocks only serious problems or safety risks.
approved_with_comments rather than a block.”article, statedHow to preserve debugability during early process exits
Chose JSONL event logging over one large JSON blob written at process shutdown.
Rationale: Append-friendly JSONL survives the failures that are most likely to need debugging.
Gotchas (what bit them)
Naive LLM code review produced noisy and hallucinated comments.
Root cause: Feeding raw diffs into a generic model lacked repository context, task specialization, and filtering.
Resolution: Use specialized reviewers plus a coordinator that deduplicates, judges severity, and filters speculative findings.
Large merge-request prompts hit process argument limits.
Root cause: Passing a massive merge-request description as a command-line argument can trigger Linux ARG_MAX limits.
Resolution: Spawn OpenCode as a child process and pass the coordinator prompt through stdin.
stdin rather than as a command-line argument, because if you have ever tried to pass a massive merge request description full of logs as a command-line argument”article, statedCrash-time debug logs are easiest to lose with ordinary JSON blobs.
Root cause: A process that exits early may never close and write a valid JSON array.
Resolution: Use JSONL so every output line is independently parseable and useful for partial failure debugging.
Evaluation
Cloudflare reports production telemetry over the first month across review runs, merge requests, repositories, duration, cost, overrides, and findings.
Metrics: 131,246 review runs · 48,095 merge requests · 5,169 repositories · median review time 3 minutes 39 seconds · 288 break-glass overrides, 0.6% of merge requests · average review cost $1.19 · 159,103 findings
Outcomes
- Cloudflare's AI review system gives most engineers a first review within minutes.
- The system reports low manual override usage and deliberately low findings per review to preserve signal.
Cloudflare engineering blog; production telemetry is detailed but self-reported.