When AI Generates 90% of the Code, Can Six Review Gates Cover the Core Risks?

    As AI coding agents begin writing roughly 90% of a project's code, traditional manual review processes quickly hit a bottleneck: humans can no longer keep up with the pace of machine output. This article explores a representative approach that breaks code review into multiple automated stages, where agents act as both producers and reviewers. The central insight is that the true protagonist of the system is not the code-writing agent, but the merge gates that enforce objective, automated validation before any code enters the main branch. The article details a three-agent collaboration model that turns a "standard answer" into executable fidelity tests, six validation gates that code must pass before merging, and the critical prerequisite of having a reliable verification baseline. It also covers common limitations, practical advice for moving validation before pull request creation, and the shifting role of engineers—from writing code to writing specs, tests, and defining quality gates.

    1. The Starting Point: 90% of Code Written by AI

    When an intelligent coding agent can automatically handle roughly 90% of the code writing in a project, traditional code review workflows immediately hit their limits: humans simply can’t keep pace with what machines produce. To maintain quality under these conditions, review can no longer rely on the manual mode of “read the diff and judge from experience.” Instead, it must be handed over to mechanisms that are equally automatable, scalable, and repeatable.

    One representative approach in the industry is to break review into multiple gates, allowing agents to serve as both producers and reviewers. It’s worth emphasizing that the true protagonist in this system is not the agent responsible for writing code, but the “merge gate” that intercepts all output before it reaches the merge point. Producers can be replaced or scaled up, but the design of the gates determines the quality floor of the entire system.

    2. The Real Protagonist Is the Merge Gate, Not the Coding Agent

    A common misconception is that quality is guaranteed as long as there is a sufficiently powerful model writing the code. In reality, it’s the opposite. Every generation carries uncertainty, and a standalone agent’s judgment can drift. Quality therefore cannot rest on “generating well” but must rest on “being reliably verifiable.”

    The significance of the merge gate is precisely to convert the subjective “looks correct” into the objective “passes the test.” A well-designed gate should force every piece of code entering the main branch to meet a set of automatically determinable hard conditions before it can merge; if any single condition fails, the code is sent back for rework. The approach below splits review into three groups of agents plus several gates. The overall structure is actually quite traditional—test-driven development plus code review—except that the reviewer is now a model.

    3. Three Agent Groups Working Together: Turning the “Standard Answer” into Executable Tests

    The most clever aspect of this system is that it first establishes a comparable baseline for “correctness,” then hardens that baseline into tests.

    The first group of agents is responsible for writing fidelity tests. Based on publicly available interface behavior descriptions, they translate the semantics a service should exhibit into executable assertions. Take the visibility timeout in a message queue service as an example: after a message is read by a consumer, it should not be visible to other consumers during the timeout window; once the timeout expires, the message should become visible again. The key to these tests is that they must first pass against a real cloud service, effectively “recording” the behavior of the real system as the standard answer for all subsequent comparisons.

    1. # Fidelity test example: message visibility timeout
    2. def test_message_visibility_timeout():
    3. queue = create_queue("demo")
    4. send_message(queue, "payload-1")
    5. # First receive: the message should be visible
    6. first = receive_message(queue)
    7. assert first.body == "payload-1"
    8. # Within the visibility timeout window: receiving again
    9. # should not return the same message
    10. second = receive_message(queue)
    11. assert second is None
    12. # After the visibility timeout: the message should be visible again
    13. sleep(visibility_timeout + buffer)
    14. again = receive_message(queue)
    15. assert again.body == "payload-1"

    The second group of agents takes these tests and runs them against the local emulator awaiting validation, identifies any discrepancies between the behavior and the standard answer, and opens a to-do issue for each discrepancy. The third group of agents adopts a convergence strategy of “one agent fixes only one issue,” keeping the scope of changes minimal and making it easy to locate and verify.

    4. Six Gates: Validation That Must Pass Before Merging

    Once fixes are complete, the code cannot be merged directly. It must pass through several gates. Each gate corresponds to an independent class of failure risk:

    • Compilation gate: Changes that fail to compile are intercepted immediately, ensuring the main branch is always buildable;
    • Code standard gate: Specifically checks whether style and conventions are consistent;
    • Security gate: Scans for potential security vulnerabilities and dangerous usage patterns;
    • Fidelity regression gate: Confirms that fixes have not increased the deviation from the standard answer;
    • Independent review gate: A sub-agent using a completely fresh context re-reviews the change diff, avoiding the blind spot where “the author is both the athlete and the referee”;
    • Final approval gate: If any of the above fails, the change is sent back for rework rather than allowed to pass with unresolved issues.

    In larger-scale deployments, hundreds of agents can work in parallel, processing hundreds of issues every day. What makes this scale feasible is not stronger individual agents, but the rigidity of the gates.

    5. Why This Model Works: A Reliable Verification Baseline

    It’s important to be clear-eyed about this: this model can run autonomously on one implicit but decisive premise—you hold an existing standard answer. When the object being validated is a local emulator of a cloud service, the real cloud service itself is that authoritative baseline. Whether behavior is correct is determined by running a comparison against it.

    The vast majority of business code doesn’t have this luxury. Requirements themselves are often ambiguous, and there is no “real-world version” to compare against line by line. This means: the fidelity testing approach can be borrowed as a concept, but the step of hardenizing the standard answer into tests is the critical investment that determines success or failure. Without this link, no amount of review gates amounts to anything more than self-validation against an incorrect baseline.

    6. Limitations Stated Openly

    What’s commendable about this kind of practice is that it explicitly lists what cannot be done rather than concealing it. Common shortcomings currently include: rate-limiting behavior has not yet been simulated, failure and exception scenarios are not yet covered, service differences across regions have not yet been replicated, and the code under test lacks sandbox isolation. These all serve as reminders that simulators and test baselines always have boundaries, and gates can only guarantee the dimensions they cover—risks outside their coverage still require manual fallback.

    7. Validate Before Submitting for Review

    A practice that can be directly adopted into daily development is: move most validation to before the pull request is created. Give the agent verification means it can genuinely execute—running tests, performing builds, or comparing UI screenshots against design specs one by one—and require it to present actual output rather than verbally claiming “it’s done.” Then, introduce a sub-agent with a fresh context to review the changes. These two practices can significantly reduce the risk of “looks complete but actually unverified.”

    8. The Shifting Role of Engineers

    What this truly demonstrates is not that engineers become redundant, but that: once there are reliable verification means, agents can independently deliver quite complex outcomes. Correspondingly, the core work of engineers shifts upward—from “writing code by hand” to “writing specs, writing tests, and setting gates,” that is, defining what counts as done correctly and what conditions must be met to allow passage. Whoever can design more rigorous gates and more trustworthy baselines holds the final authority over quality and delivery in an era where AI handles 90% of the code.