跳到正文
DEV Community· AlgoGrid Labs·· 5 小時前AI 評分52

PR 初步審查智能體如何判斷哪些發現重要

A first-pass PR review agent that knows which findings matter

AI 導讀

AlgoGrid Labs 介紹一套 PR 初步審查智能體的設定方法,按團隊規則判斷哪些發現會阻擋合併,並據此要求修改或批准。規則把發現分為 Major、Minor 和 ignore,並要求智能體參照工單驗收條件、在相關程式碼行留言;智能體不會合併 PR,最後由人工覆核。

正文

Most AI code review tools fail the same way: they comment on everything. Twenty remarks on a pull request, three of them useful, and after a week the team stops reading any of them.

The fix isn't a smarter model. It's telling the reviewer, in writing, what your team actually cares about.

Split findings into two piles

Before the agent reads a single diff, write down two lists:

  • Major: things that should block a merge. A query missing the tenant filter. A route without its permission check. A change to an API another service depends on. A secret in the diff.
  • Minor: things worth a note but never a blocker. Naming, a missing test, a small duplication.

Then a third, short list: ignore. Anything your linter or formatter already catches. If the agent repeats what ESLint says, it's noise.

The verdict follows mechanically: changes requested if there's at least one major finding, approved otherwise. No vibes.

Give it the story, not just the diff

A diff shows what changed. It can't show whether the change does what was asked. Feed the reviewer the ticket's acceptance criteria too. Some of the most useful findings are "the story asks for X, this PR only does half of it".

Comment on lines, not in essays

Each finding goes inline, on the line it's about, with one sentence on why it matters. A wall of text at the top of the PR gets skimmed; a comment on line 42 gets fixed.

A person still decides

The agent requests changes or approves. It never merges. Your reviewer reads its verdict, overrules it when it's wrong, and spends their time on design instead of spotting the missing filter.

Tune it on real pull requests

The first week, the rules will be off. Keep a list of every finding a reviewer dismissed and why, and fold that back into the rules file. Two or three rounds of that and the noise drops sharply.

What it costs to run

You pay your model provider per review. The size of the diff drives most of it, so the agent should skip lockfiles, generated code and snapshots before it reads anything.


Where does your team's review time actually go: catching real problems, or arguing about style?

We set this up for teams at AlgoGrid Labs, along with ticket-to-PR pipelines and QA evidence videos.

來源:DEV Community · dev.to