Can Six Review Gates Mitigate Risks When AI Writes 90% of Code?

    As AI-assisted coding tools push the code generation ratio to nearly 90%, the focus shifts from whether models can write code to whether teams can prove its correctness before merging. This article analyzes a cloud provider's practice of using parallel agents for code fixes and dissects a six-gate review system designed to automate verification. It explores what these gates cover, their limitations without real-world reference systems, and engineering principles for managing AI-generated code risks.

    When AI coding tools push the code generation ratio to nearly 90%, the real question for development teams is no longer “can the model write code,” but “can we prove it is correct before merging?” A public practice from a cloud provider offers a compelling case study: using hundreds of agents in parallel to fix inconsistencies in a local cloud service simulator, processing a massive volume of issue tickets daily. The team emphasized that code was almost neither hand-written nor reviewed line-by-line by humans. Supporting this model is not a more aggressive generation capability, but a review gate system built around verification and merging.

    This structure appears traditional on the surface: test-driven development plus code review. The change is that the entities executing tests, discovering issues, submitting fixes, and reviewing diffs are now largely models. Whether this approach is viable depends on a crucial premise: the existence of an executable, comparable standard answer. Starting from the six review gates, this article analyzes what core code review risks they can cover and where engineering standards must step in.

    1. The Protagonist is the Merge Gate, Not the Generation Agent

    In most people’s intuition, the agent writing the code is the core. However, in high-proportion AI generation scenarios, generation is just the entry point; merging is where risks converge. Whether a change can enter the main branch depends on simultaneously meeting conditions like functional correctness, successful compilation, standard compliance, security, and no fidelity regression. The merge gate is therefore not a “final formality check,” but an acceptance bus that ties together specifications, tests, implementation, and regression.

    In the public practice, the agents are roughly divided into three groups. The first group writes “fidelity tests” based on public API descriptions—for example, verifying that in a message queue, once a message is read, other consumers cannot see it again before the visibility timeout. These tests are first run in the real cloud environment, essentially recording true behavior. The second group runs these tests against the local simulator, finds inconsistencies, and submits issue tickets. The third group submits fixes following an atomic principle: “one agent fixes one issue.”

    After a fix is completed, it must pass the merge gate: compilation failures are intercepted immediately. Other agents separately check for code style, security risks, and fidelity regressions. If any check fails, it is returned for rework.

    The takeaway from this workflow is that agents can scale the production of changes, but changes must be verified at scale. Without merge gates, more generation only leads to greater review debt. With executable gates, generation can be transformed into deliverable increments.

    2. What the Six Review Gates Actually Block

    The “six gates” should not be understood as a fixed standard, but rather a combination of gates covering implementation-layer risks. A reasonable breakdown is as follows:

    1. Executable Verification Gate: Requires the agent to not just claim completion, but to demonstrate actual output from tests, builds, API calls, or UI screenshot comparisons. Verification evidence should be reproducible, including commands, logs, failed use cases, and fix records. It primarily intercepts functional errors and “self-justified completion.”

    2. Independent Context Diff Review Gate: A reviewing agent using a completely fresh context examines the code diff, preventing the generator from using its own context to justify itself. It primarily intercepts issues like local correctness but global inconsistency, missed boundary conditions, and hidden side effects.

    3. Compile and Static Analysis Gate: Compilation failures, type mismatches, missing dependencies, obvious null pointers, and resource leaks should be machine-intercepted before merging. It is low-cost, highly deterministic, and forms the base layer of the gate system.

    4. Standards and Maintainability Gate: Checks whether naming, layering, code duplication, exception handling, logging, and comments comply with team conventions. High-proportion AI generation easily leads to style drift and duplicate implementations; the standards gate controls long-term maintenance costs.

    5. Security Check Gate: Covers injection risks, sensitive information leaks, permission bypasses, unsafe deserialization, and dependency vulnerabilities. The security gate cannot rely solely on model review; it should combine deterministic scanning rules with manual review for high-risk changes.

    6. Fidelity and Regression Gate: For scenarios with a reference system, it verifies whether behavior matches the real environment and whether existing capabilities have regressed. It primarily intercepts the regression risk of “fixing one issue, breaking two behaviors.”

    The merge gate is the convergence point for these checks. Its basic logic can be expressed in pseudocode:

    1. deliver(change):
    2. evidence = run_tests_build_and_compare(change)
    3. assert evidence.all_passed
    4. review = fresh_context_review(diff(change))
    5. gates = [
    6. compile_gate(change),
    7. style_gate(change),
    8. security_gate(change),
    9. fidelity_gate(change, evidence)
    10. ]
    11. if review.approved and all(g.passed for g in gates):
    12. merge(change)
    13. else:
    14. return_to_repair(change, failed_reasons)

    The key point of this pseudocode is not a specific tool, but the principle of “evidence before merging, failure traceability, and fix tracking.” Agents can fix issues, but they cannot bypass the gates.

    3. Why This Model Works: A Reliable Reference System

    The most valuable takeaway from this practice is the existence of a relatively reliable standard answer: the real cloud environment. Tests are first run in the real environment to record behavior, then checked against the simulator. Whether the behavior is correct is known simply by running it. For tasks like simulators that “replicate existing systems,” the reference is clear, the acceptance criteria are executable, and agents can independently iterate on a large volume of issue tickets.

    This also explains why “90% of code generated by AI” does not mean “engineers are useless.” The engineer’s work shifts upstream to writing specifications, writing tests, setting gates, and defining what it means to be “correct.” When acceptance criteria can be executed by machines, agents can handle quite complex deliveries. When acceptance criteria are vague, more generation only leads to more rework.

    However, most business code does not have this luxury. Requirements themselves may be ambiguous, user goals change, and there is no “real-world version” to compare against item by item. In these cases, the six gates can block implementation-layer errors, but they may not block “building the wrong thing.” Therefore, the core risks of code review exist on at least two levels: whether the implementation is correct, and whether the requirements were correctly understood. The former is suitable for gate automation, while the latter still requires specification reviews, acceptance samples, and business judgment.

    4. Explicit Limitations: Incomplete Simulation and Lack of Isolation

    Public materials also list limitations: rate limiting, fault injection, and service differences across regions are not fully simulated, and code execution lacks sandbox isolation. Industry analysis similarly points out that the coverage boundary of a simulator directly impacts the credibility of fidelity tests. In other words, no matter how strict the gates are, they can only prove correctness within the scope of test coverage.

    This offers three reminders for general teams:

    • When the reference system is incomplete, gates must mark confidence boundaries. What has been verified, what relies on assumptions, and what only holds true under specific regions or loads should be explicitly recorded in the change description.
    • The security gate must include execution isolation. When agents execute code, install dependencies, and access networks without a sandbox, risks spread from the code layer to the execution environment. Gate design should incorporate execution isolation, least privilege, and credential management as prerequisites.
    • The regression gate must cover non-functional attributes. Rate limiting, timeouts, fault recovery, and regional differences are often not covered by unit tests. They require supplementary contract tests, fault drills, and canary observations.

    5. Risk Coverage Boundaries and Engineering Suggestions

    The six gates can effectively cover compilation errors, obvious functional defects, style drift, common security issues, and known behavior regressions. However, they can only provide partial evidence for requirement misunderstandings, architectural trade-offs, complex concurrency, and cross-system contracts. To make this system truly controllable, it is recommended to follow four principles.

    First, shift-left review, evidence first. Before anyone reviews, have the agent run tests, builds, or screenshot comparisons and display the output, rather than just saying “completed.” Second, independent reviewers. Generation and review should use different contexts to reduce self-confirmation bias. Third, atomic fixes. One agent handles only one issue, making changes small, rollbacks easy, and reviews focused. Fourth, tiered gates. Low-risk changes go through an automated fast track, while high-risk changes require additional manual review and canary verification.

    The conclusion is that the six review gates are not a universal insurance policy, but they shift agent delivery from “trust generation” to “verify before merge.” In the era of high-proportion AI generation, the core capability of code review is no longer reading every line of code, but designing executable specifications, observable evidence, and rollbackable gates. Engineers are not replaced; they have simply transitioned from being the ones who write the code to the ones who define correctness, set the gates, and decide when it is safe to merge.