[KongchangAI]
· 3 min read· 1,963 words

Who Accepts AI-Written Code? A 25-Minute Deep Dive into Verification Loops and the New Code Review Paradigm

Who Accepts AI-Written Code? A 25-Minute Deep Dive into Verification Loops and the New Code Review Paradigm

In the age of AI-written code, engineering teams should build acceptance into a maintainable verification loop, not an after-the-fact step.

Based on Anthropic Claude Code team's official article on verification, the article proposes a three-stage verification framework: can the change work, will it keep working, and what to do after problems slip through. The author argues verification should happen at the "surface" users actually touch, using setup/drive/check three-stage skills with sandboxes to verify multiple flows in parallel; when agents lack account identities, verification degrades to low-confidence testing, requiring separate identities and credential management. The test pyramid is being replaced by hybrid end-to-end tests, supplemented by behavior-level fuzzing to cover unanticipated paths. After problems slip through, fix upstream, build reliability checklists, and maintain the verification layer like a system. Ultimately the engineer's role shifts from maintaining software to maintaining verification loops.

Verification Loops: Turning "Acceptance" into a Delegable Capability

According to Anthropic's article, the verification loop is the foundational building block that lets you delegate more work to Claude. The instructor cites Boris Cherny's earlier judgment: if you give Claude a path to verify its own work, the final output quality can improve by 2 to 3 times.

This means verification isn't an add-on step after writing code—it's infrastructure worth investing in separately. The instructor mentions that when consulting for various engineering teams, one of the first things he helps with is building verification environments, ensuring the environment is well-designed, and continuously tracking the performance of the verifier itself. Without this layer, you can only run one or two Claudes in parallel at a time—because every change has to be manually clicked through before you dare merge it.

His daily structure is a "builder ↔ review agent ↔ verifier" back-and-forth loop, up to three rounds. What most people are missing is precisely that verifier that can repeatedly converse with the builder.

Part 1: Does the Change Actually Work?

Verify at the "Surface," Not in Unit Tests

The instructor demonstrates end-to-end verification with an agent inside Slack: having the agent clone the application into a sandbox, install dependencies like Postgres and Redis, use a Playwright-like tool to click through pages like a real user, take screenshots, and finally send a screen recording back to Slack.

The key concept is "surface"—web pages, APIs, CLIs, mobile apps, wherever users actually touch the application. If you don't verify at the surface, the agent will default to the path of least resistance, such as running a unit test or calling an endpoint, then claim it's "verified." The Anthropic article likewise emphasizes that end-to-end testing is the most reliable form because it requires the change to be tested on the interface users actually touch.

like small UI defects

In the demo, the flow for creating an agent worked end to end, but the verifier also flagged six things that "felt off"—for example, clicking the cancel button doesn't clear the dialog box. This is exactly the value of end-to-end verification: a flow passing doesn't mean there are no defects.

The term "surface" borrows from the concept of surface testing in the UI testing field, referring to the entry layer users directly interact with—browser-rendered web pages, HTTP API endpoints, command-line interfaces, or mobile interfaces. Unlike unit tests that isolate individual functions, surface verification requires the system to run in its complete form and trigger behavior through the channels users actually use. This captures cross-component integration defects, rendering differences, and state management issues that are often masked by mocks in unit tests. The cost is heavier environment setup, requiring dependency services to be started and driven in a real browser, so it's often combined with sandboxes and record-and-replay.

The Three-Stage Verification Skill: setup, drive, check

The instructor's preferred verification skill structure has three stages:

  • Setup: Start the application and use shortcuts to bring the database to the initial state needed for verification. For example, verifying an "organization transfer" flow requires pre-creating two organizations and several users.
  • Drive: Operate on the surface users will touch, such as issuing a transfer request, logging out, logging in as another user, and accepting the request.
  • Check: Confirm that the drive stage didn't "cheat" (e.g., using JavaScript tools instead of real clicks), while also looking for small defects that remain after the flow passes.

The role of the sandbox here is parallelism: if a feature has 15 user paths, you can open 15 sandboxes to verify in parallel, then aggregate findings for the builder to fix. If you cram everything into one sandbox, databases and writes will conflict, and you can only run serially with repeated state resets—much slower.

A "verification skill" here refers to a structured capability that an agent can invoke, usually provided as a skill file or tool description. It breaks the verification process into reusable stages so the agent doesn't have to reason from scratch about how to test each time. Setup is responsible for creating a deterministic initial state, drive is responsible for executing user paths on the surface, and check is responsible for asserting results and detecting cheating in the drive stage. The skill file itself is a hybrid of prompts and scripts, and its correctness directly determines verification confidence, so it needs to be version-controlled, regression-tested, and stress-tested like code.

When the Agent Lacks an Identity, Verification Degrades

In reality, verification gets more complicated. For example, if the application integrates with Slack, users can reply to customer service messages via Slack, but if the agent doesn't have its own Slack account, it can't test this feature end to end and can only fall back to lower-cost unit or integration tests, with a corresponding drop in confidence. The instructor's approach is to register a separate account and separate workspace for the agent; the same applies to integrations like Calendly and Notion. The cost is managing these agent identities and considering where to store passwords—writing them into skill files is obviously not a good idea, and you may need a proxy solution above the sandbox.

Boris Cherny also said that verification can look different in each domain. Beyond keeping the "software factory" running smoothly, the instructor spends a lot of time each day ensuring the verification environment stays correctly configured as the application evolves.

Give the Agent a Private Cloud

Once the verification environment is set up, you can do bolder things. The instructor gave the Slack agent the ability to spawn derivative sandboxes and fork itself, and before a major promotion had it "bug bash" the entire application: at least 100 flows, about 30 sub-sandboxes, ultimately producing an HTML report grouped by severity. The actual result was zero critical issues, 4 high, 23 medium, and 41 low.

whereby the main argument

On cost, the instructor says that because he uses models that are good at computer use and reasonably priced, the API cost for this kind of large-scale parallel verification is around $10 to $20. He also cites a sandbox vendor's "sandboxes are dead" article: you should build a private cloud for agents so they can take on bigger work. His own approach is to give agents independent Cloudflare and AWS accounts (with budget caps), so they can create buckets, deploy Lambdas, rent GPUs, and even stress-test his own services.

Part 2: Will It Keep Working?

The Test Pyramid Is Being Rewritten

Verifying once only proves the feature works "today"; it doesn't prove it will still work next month when another PR touches the same code. The traditional approach is the test pyramid: lots of unit tests, fewer integration tests, even fewer end-to-end tests, with maintenance costs rising as you go up. Hard-coded Playwright end-to-end tests will produce false positives as soon as the page layout changes.

The shift now is to use hybrid end-to-end tests with both agentic and deterministic elements, and let agents maintain them. The instructor mentions that some people in the community have even deleted all their unit tests, one reason being that unit tests lock in poor-quality code and make it hard to change. He himself deleted about 400,000 to 500,000 lines of unit tests and replaced them with about 400 to 500 end-to-end tests—while reminding readers to read the relevant discussions first and not copy blindly.

to maintain our end-to-end tests.

The library he uses allows deterministic steps and agent steps to be mixed: an agent opens the billing settings page, another agent (which can use a different model) asserts the flow passes, then it returns to deterministic behavior. Agent steps can be cached to avoid repeatedly consuming tokens, and a system 1 model can be used to determine which end-to-end tests a given PR's changed blocks will affect, so they can be run selectively.

The test pyramid is a classic layered model proposed by Mike Cohn: a large base of fast unit tests, a smaller middle layer of integration tests, and a small top layer of end-to-end tests. Its economic assumption is that end-to-end tests have the highest authoring and maintenance costs, so there should be as few as possible. Agents change this cost structure—they can understand natural-language steps and automatically repair selector drift, greatly reducing the marginal maintenance cost of end-to-end tests. As a result, some teams are shifting their testing focus upward, replacing massive fragile unit tests with a small number of high-confidence end-to-end flows, leading to discussions of a so-called "inverted pyramid" or "test diamond." This shift is still controversial, and the key depends on the stability and speed of end-to-end tests.

Fuzzing: Testing Paths You Didn't Think Of

End-to-end tests in code can only cover flows you thought of. The instructor's supplement is to have a Claude-driven fuzzer read real user behavior analytics from PostHog, deviate slightly from normal paths, simulate unexpected operations, and see where things break; what can be automatically fixed gets fixed and merged, with a daily summary sent to him.

Fuzzing originally refers to feeding random or semi-random data to a program to trigger crashes and exceptions. Classic tools include AFL and libFuzzer, mostly used for parsers and security-sensitive code. Here the instructor extends it to the user behavior layer: Claude reads real behavior analytics collected by PostHog and makes small perturbations around normal paths, simulating misclicks, out-of-order operations, and unexpected inputs. Compared with traditional byte-level fuzzing, behavior-level fuzzing is closer to actual product usage and mostly finds flow and state defects rather than memory errors. The challenge is determining what counts as "bad"—this requires assertions and screen recording playback, otherwise the noise is too high.

Part 3: After Problems Slip Through

A real case: a user reported that course videos occasionally crashed on Safari. The reason was that the verification skill only said "use Playwright," which defaulted to Chromium, while Safari runs on WebKit and handles video slightly differently. The fix wasn't just fixing the bug—the agent ran Playwright WebKit and found a batch of issues exposed for the first time; then the verification skill was changed to: changes involving the video player must be verified with both Chromium and WebKit.

using Playwright Chromium

The larger version given in the Anthropic article is a "reliability checklist": 39 check items compiled from past incidents, which Claude reads the diff to determine whether they're triggered, and only runs extra verification when there's a match. For example, a past change to how sessions were stored broke claude --resume; since then, any change touching session storage automatically verifies the restore functionality.

The instructor emphasizes that the verification layer should be treated as seriously as any other system: maintain a baseline set of 20 to 30 PRs and run a regression after changing verification skills; regularly stress-test the skills themselves; check for contradictory instructions in skills; and incorporate support tickets into improvement criteria.

The Engineer's Role Is Becoming "Maintaining the Loop"

This framework ultimately points to a role shift: no longer waking up every day thinking "I maintain software," but "I maintain the loops that maintain the software for me." Engineers no longer read diffs line by line; instead, they build verification systems and environments that check, stress-test, and fuzz around the clock, while they review screen recordings, HTML reports, and evidence, intervening only when the agent is uncertain or there are multiple correct solutions. Once a bug reaches users, they go back and tighten the entire loop.

You may not have noticed that the barrier on this path isn't model capability but the engineering quality of verification infrastructure—identity management, sandbox images, baseline sets, checklist trigger rules—each of which requires continuous maintenance. The more AI writes, the more valuable the acceptance system becomes.

#AI code verification#Code Review#verification loop#end-to-end testing#Claude Code#test pyramid#fuzzing#sandbox#agent identity
Share:

Related articles