跳到正文
DEV Community· Mikalai Karytka·· 1 小時前AI 評分58

經 83 次盲評審查後,作者刪除 AI 程式碼審查工具最昂貴的模式

I Deleted My AI Code Reviewer's Most Expensive Mode After 83 Blind-Judged Runs

AI 導讀

作者在 83 次審查的盲測後,刪除了 AI 程式碼審查插件最昂貴的 full 模式。46 個盲評評審的結果顯示,full 的安全漏洞檢出量只比 hybrid 多 0.5,未達預設至少多 3 個的保留門檻。quick 加入測試審查員後,在 5 個已知漏洞中找到 4 個,成本為舊 PR 審查的 59%。

正文

My code reviewer's new quick mode found nothing in six runs on two pull requests. Both PRs changed only tests, and I had told its finder that tests were out of scope. That came out of 83 review runs over one evening and night, checked by 46 blind judges. So did this: the most expensive mode, the one I kept "for security audits", found 0.5 more security bugs than the cheaper one, well inside the noise. I deleted it.

Scorecard of round 7 with two rounds of blind Opus judges, four contenders: /code-review with checklist, quick, hybrid and full. Pull requests, known bugs found of 5: 4.0, quick 1.0 before and 4.0 after the test fix, full 1.8. Real bugs that break or cost on one module: 23.5, 20.8, 24.2, 21.5; on four modules: 34.5, 37.2, 48.0, 50.5. Security bugs on a sampled 83K-line repository: 6.5, 18.2, 20.5, 21.0. Cost per run on four modules: $2.17, $4.38, $9.50, $12.80

TL;DR

  • Pull requests: quick missed every bug in PRs that only change tests. With a test reviewer for such PRs it found 4 of 5 known bugs, against 1.8 for my old PR review, at 59% of its cost.
  • /code-review with a checklist was the best PR reviewer in the test, but made 2.2 false claims per five PRs, against zero for my reviewer.
  • Project size: on one module quick ties hybrid; on four modules hybrid finds about 11 more real bugs.
  • Security: full led hybrid by 0.5 bugs (the rule needed 3), and the attack-surface pass found nothing no other reviewer found. Full is deleted, the pass is an option.
  • Running reviews overnight: turn off MCP servers, trust the folders first, keep the lid open.

In my last post Claude Code's /code-review with a 30-line checklist tied my multi-agent reviewer on small projects and fell far behind on an 83K-line monorepo. A hybrid of the two kept about 95% of the bugs for 75% of the price. I turned that result into review modes and wrote down, before any run, the rules that would set their defaults.

Three modes, three questions

My reviewer is a Claude Code plugin. It cuts a backend into modules of up to 10,000 lines and reviews them in parallel, with a verifier that tries to refute every finding. The modes decide who reviews a module:

Mode Per module Project-wide
quick one finder (8 angles and the checklist, like /code-review), the verifier nothing
hybrid the finder, a test reviewer, the verifier an architect, a security pass over the attack surface
full separate code, security, performance and test reviewers, the verifier the same as hybrid

auto was meant to pick quick for a pull request or one module and hybrid for more. full stayed for audits, because in the last round its security reviewers found a few security bugs the hybrid missed.

The three questions and their rules:

  1. Is quick good enough as the default for pull requests? Yes, if it catches no fewer known bugs than my old PR review minus one, stays within the noise band on real bugs, and costs at most half.
  2. Where should auto switch from quick to hybrid? Where quick falls out of the noise band of hybrid.
  3. Is full worth keeping? Only if its real security bugs beat hybrid's by more than the band, at least 3.

How I judged

The same method as last time, with more runs:

  • Every review ran on Sonnet, from a fresh checkout at a fixed commit, most variants three times.
  • Two rounds of Opus judges got all lists of a step under random letters, in one shape (file, line, summary, details). They clustered findings into distinct issues and marked each one real, partly or false from the code.
  • The main count is real WILL_BREAK + WILL_COST issues: things that break or cost money in production.
  • The noise band is the larger of the run-to-run spread and the judge-to-judge spread, at least 4.

The whole monorepo produced over 4,000 findings across ten lists. Judging all of them twice would have taken about 50 judges, so I judged a fixed sample of 9 of its 25 path groups, about 36% of the findings. Every list and both judge rounds saw the same paths.

Question 1: pull requests

Pull requests need ground truth, so I used history. I took five old changes from two small services, three in Go and two in Rust, where a later commit fixed a bug the change had introduced. Each change became a branch against its parent, in a local repository holding only those two commits, so no reviewer could see the fix. An Opus matcher then got the fix diff and the blind lists, and named the finding that describes the known bug.

Four contenders, three runs each (two for the fix):

Contender Known bugs found, of 5 Real bugs that break or cost False Cost per 5 PRs
/code-review high + checklist 4.0 10.3 2.2 $2.05
My old PR review (specialists) 1.8 7.8 0 $3.37
quick 1.0 6.0 0 $0.90
quick + test fix (2 runs) 4.0 7.5 0 $1.99

Pull requests: known bugs found out of 5, mean of the runs. /code-review with checklist 4.0, quick with the test fix 4.0, the old specialist review 1.8, quick 1.0. Cost per five PRs: $2.05, $1.99, $3.37, $0.90

The blind spot

The quick finder returned zero findings on both Rust PRs, in every run. Its own coverage note said why: the new end-to-end test file was "out of scope". I had written that line on purpose. In the hybrid, a separate test reviewer reads the tests, so the finder skips them to avoid duplicate work. Quick has no test reviewer. A PR that changes only tests got no review at all, and both known bugs on the Rust side lived in test code.

The fix is one rule: when a PR changes test files, quick adds the test reviewer. Later that night I ran the fixed quick twice on all five PRs. It found 4 of 5 known bugs, more than twice my old PR review.

The rule said no

Quick without the fix failed the rule on real bugs, 4.3 behind the best with a band of 4. Quick with the fix passed on known bugs and on real bugs, and failed on cost: $1.99 is 59% of my old review, and the rule said 50%.

I wrote the cost limit to stop a cheap mode that finds less. Here the cheaper mode found more. I made the fixed quick the PR default anyway. That's exactly the kind of exception the rule was meant to prevent, so all the numbers are in the table above.

The uncomfortable part

/code-review with the checklist was the best PR reviewer in this test. It found as many known bugs as the fixed quick and the most real bugs overall, at 61% of my old review's price. Its weakness is precision: 2.2 false findings per five PRs, against zero for every variant of my reviewer, which runs a verifier. On a single PR, the built-in command plus a checklist is hard to beat.

Question 2: where quick stops being enough

The same NestJS monorepo as last time, on the same commit, at three sizes. The last round's lists ran again under the new judges as anchors.

Scope Modules quick hybrid /code-review + checklist (last round's run) Band
One app, 6.7K lines 1 20.8 ($1.38) 24.2 ($2.91) 23.5 ($1.17) 4
A bigger app, 15.7K 4 37.2 ($4.38) 48.0 ($9.50) 34.5 ($2.17) 5
Whole monorepo, sampled 23 67.8 ($17.74) 80.5 ($35.62) 16.5 ($4.10) 17

Real bugs that break or cost, mean over runs and both judge rounds. Costs are for the whole run; on the monorepo the bugs count only the sampled paths.

Quick against hybrid at three sizes, real bugs that break or cost: one app 20.8 against 24.2, a bigger app 37.2 against 48.0, the sampled whole monorepo 67.8 against 80.5, with the noise band of each step

On one module, quick is within the noise of hybrid and of /code-review, at about half of hybrid's price. On four modules hybrid found 10.8 more real bugs with a band of 5, so its test reviewer and architect already pay for themselves there. auto stays as it was: quick for one module or a PR, hybrid from two.

On the whole monorepo, quick's three runs found 59, 70 and 74 real bugs. That spread of 15 is why the band there is 17. One run of an LLM reviewer is still a sample, even with 23 parallel finders.

Is it just the partitioning?

A reader asked under the last post: what if you cut the monorepo into the same modules and ran /code-review once per module path? That keeps the cheap one-pass recipe and gives every module its own budget of eight angles and six candidates each.

Quick without the verifier is close to that experiment. It runs one finder per module, with the same recipe and the same checklist, and nothing filters its findings. On the sampled monorepo:

Setup Real bugs that break or cost Cost per run
One /code-review run over everything 16.5 $4.10
One finder per module, no verifier 76.5 $9.43
One finder per module, with the verifier 67.8 $17.74
Hybrid 80.5 $35.62

With a band of 17, partitioning alone closes most of the gap at this size. On four modules it doesn't: 37 to 39 against hybrid's 48, with a band of 5.

I don't expect the plain command per path to match my finder, though. Pointed at one path, /code-review sees that module on its own. A bug that crosses a module boundary stays invisible, and code that looks wrong in isolation is often fine once you see its caller, which turns into false findings. My finders get each module's dependencies and dependents from the import graph as leads, and hybrid adds an architect for issues between modules. That's my expectation, not a measurement. A clean run of the real command per module path is next on my list.

Turning off the verifier

Quick has an option to skip the verifier, for a cheap first look. I expected more false findings and fewer real ones. Instead:

Scope quick quick, no verifier False: with / without
One app 20.8 ($1.38) 20.0 ($0.67) 3.8 / 4.0
A bigger app 37.2 ($4.38) 38.8 ($2.46) 4.0 / 4.5
Whole monorepo, sampled 67.8 ($17.74) 76.5 ($9.43) 4.0 / 6.0

What the verifier refutes grows from one module to several, then stays flat. My modules are capped at 10,000 lines, so a bigger scope means more modules, not bigger ones:

Scope Refuted by the verifier, quick Refuted, hybrid
One module 4 to 10% 7%
Four modules 11 to 17% 6 to 11%
23 modules 11 to 18% 9 to 11%

Those are shares of all candidates, per run. Refuted findings never reach the judges, so I can't say how many of them were really wrong. The runs without the verifier answer it indirectly: the verifier didn't buy much here. It removed a few false findings, and on the bigger scopes some real ones too, for half the cost of the run. Without the verifier the monorepo had a single run, so I'm not drawing a big conclusion yet. The option stays, and the verifier stays on by default until I have more runs.

Question 3: is full worth keeping?

Security issues among the real bugs, tagged blind by an Opus tagger with a written definition:

quick hybrid full
Sampled monorepo, security bugs 18.2 20.5 21.0
Rust proxy, whole repo, all real bugs 2.5 4.0
Rust proxy, security bugs 0.0 0.7

Full was ahead by 0.5 on the monorepo and 0.7 on the proxy. The rule needed 3. In the previous round full looked clearly better on security, but back then the hybrid had no project-wide security pass and no dependency findings. With both added, the gap closed.

Security bugs on the sampled monorepo: quick 18.2, hybrid 20.5, full 21.0; the rule needed full to lead hybrid by at least 3

I also checked what the project-wide pass over the attack surface added. I traced every real security bug back to the agent that reported it. Every real security bug the pass reported was also in some other list, in both judge rounds, on both projects. It cost $0.50 to $3 per run.

Two decisions followed:

  • full is gone. Its separate security and performance reviewers didn't earn their price. Old runs stay readable.
  • The attack-surface pass is an option (--global-security). By default hybrid runs that pass only when the secret scanner or the package checks flag something, and only to judge those leads.

Running 83 reviews overnight

The runs took an evening and a night, each in its own terminal window, staggered by start time to fill each 5-hour usage window. Four things I'd tell anyone doing the same with Claude Code:

  • Turn off MCP servers. Every session starts all your MCP servers and loads their tool lists. My first batch, with them on, took the 5-hour window from 26% to 89% for about $36 of review work. An empty config fixes it:
echo '{ "mcpServers": {} }' > no-mcp.json
claude --mcp-config no-mcp.json --strict-mcp-config --model sonnet \
  "/code-review high --max-findings all feature"

--mcp-config takes several files, so the next word becomes one of them. With the prompt right after it, Claude Code looked for an MCP config file named after my prompt and stopped. Put another flag in between.

  • Trust the folders first. Every new git repository asks the folder trust question once. My fifteen fresh PR clones sat at that dialog until I looked. Git worktrees of a trusted repository don't ask.
  • Tell the session it's unattended. A CLAUDE.local.md in each run folder said: take the recommended option at every question, never fix, never publish.
  • Don't close the laptop. caffeinate keeps a Mac awake with the lid open. With the lid closed it sleeps anyway. I closed it once by habit; the running reviews survived because they had finished, the queued ones because they were still waiting.

Blind judging at scale

This round took 46 judges on Opus, plus five matchers for the known bugs and two taggers for security. Each seed got the same 23 groups of at most 170 findings, under different random letters. Three things I learned:

  • Clean the lists before they go out. Some reviewers wrote absolute paths into their findings, and a path like …/runs/<round>/<case>/<tool>/file.go names the tool. 16 of about 3,100 findings per seed did that. My preparation script now strips everything up to the repository root and scans the blind files for tool names before any judge sees them.
  • Style still leaks. The /code-review lists quoted rules from CLAUDE.local.md, a file that isn't in the repository the judges read. Five verdicts remarked on it. That doesn't name the tool, but it hints that one list had extra instructions.
  • Judges drift between rounds. The round-6 lists, judged again this round, got 2 to 5 more real bugs each, all in the same direction. Comparisons inside a round hold, but numbers from different rounds don't compare directly, so every round needs anchors judged again.

On the monorepo I judged a fixed sample of paths instead of everything. The groups depend only on the paths, not on the letters, so both seeds and every list saw the same 36% of the code.

What changed in my reviewer

Before After
Three modes, full for audits quick and hybrid; full deleted
Quick skipped test files Quick adds the test reviewer when a PR changes tests
Hybrid always ran the attack-surface pass It's --global-security; by default the pass only judges scanner leads
PR review used the specialists PR review uses quick

Limits

  • Five pull requests from two small services. Known bugs make a hard test, but five is few. One matcher per case, not two.
  • One codebase for the size ladder. NestJS at three sizes, judged on a 36% sample at the largest step.
  • I built the reviewer, wrote the rules, the judge protocol and the fix, and the fix ran after I had seen the blind spot. The judges never saw which list was which, but the style of a list may still give it away.
  • The judges are models. Opus with the code and a protocol. One known bug's mechanism was judged only partly true by both judge rounds; partial matches count half.
  • Sonnet everywhere. Costs are API list prices; on a subscription they turn into usage limits.

Takeaways

My opinion after this round:

  • For a single pull request, a good checklist and one careful pass beat a pipeline of specialists.
  • From two modules up, splitting the code into modules still wins, and a test reviewer and an architect pay for themselves.
  • A reviewer that never looks at the tests can't catch a bug in them. Check what your reviewer leaves out by design.
  • Expensive specialists need to prove themselves. Mine didn't, so they're gone.
  • Write the rule before the run, and say so when you break it.
  • One run is a sample. Three runs of the same mode found 59, 70 and 74 real bugs.

Which part of your code does your AI reviewer skip by design?

來源:DEV Community · dev.to