更多智能体,更少盲点:揭秘 GitHub Copilot 代码评审
原题More agents, fewer blind spots: Inside GitHub Copilot code review
推荐理由评审负责人可把新增缺陷覆盖、评论噪声和等待时间并列,按改动风险决定什么时候值得提高 Copilot 的审查档位。
读前速览
GitHub 将 Copilot 代码评审重构为 Lite、Balanced、Max 三个档位,通过采用互补模型和聚合策略的多个独立评审器,在控制成本和延迟的同时提高了漏洞检测率。
采用互补模型的多个独立评审器,在代码评审中的表现优于单个强大的模型
使用 ReviewBench 基准测试时,组合 GPT-6.1 Sol 和 Claude Opus 5.5,在每个 PR 成本为 $3 的情况下,关键漏洞召回率达到 66.2%;相比之下,单模型为 61.3%。这表明不同模型各有盲点和优势。
投票和智能体式聚合策略能有效整合多个评审器的发现
投票会对发现去重,并根据评审器之间的一致程度过滤低置信度问题;智能体式聚合则使用能力较强的模型协调各项发现、移除误报并完善结果。投票速度更快,而聚合能产出质量更高的发现。
三个分档的评审配置可针对不同使用场景平衡成本、速度和质量
Lite(中位成本 $0.19,召回率 57%,精确率 69%)适用于频繁迭代时的评审;Balanced($1.18,召回率 61%,精确率 75%)提供折中方案;Max($7.90,召回率 67%,精确率 73%)适用于合并前的全面评审,每次评审平均发现 2.01 个问题。
针对 1.4 million 个拉取请求的线上实验验证了不同分档配置
这些配置基于 ReviewBench 开发,并通过内部和外部流量的线上实验进行验证;实验衡量了精确率、召回率、严重程度和用户响应率,以确保方案在实际应用中有效。
完整摘要
本文介绍了 GitHub 如何重构 Copilot 代码评审:不再依赖单个强大的模型,而是使用多个采用互补模型的独立评审器,并通过投票和智能体式聚合整合它们的发现,从而减少误报并提高漏洞检测率。新方案包含三个档位:Lite(4× GPT-5.6 Luna,采用投票)、Balanced(3× GPT-6.1 Sol,采用智能体式聚合)和 Max(4× GPT-6.1 Sol、2× Claude Opus 5.5、2× GPT-6 Astra,并采用聚合)。针对 1.4 million 个拉取请求的线上实验显示,Max 的召回率为 67%、精确率为 73%,中位成本为 $7.90;Lite 的召回率为 57%、精确率为 69%,中位成本为 $0.19。文章表明,组合多个模型优于单模型方案,并提供了一个平衡评审质量、成本和延迟的框架。
目录 · 11 节
智能体每天都在编写更多代码,而每个拉取请求在合并前仍需经过审查。面对不断增长的代码量,人工审查者无法逐行阅读,因此团队开始借助 AI。Agents are writing more of our code every day, and every pull request still needs a review before it merges. Human reviewers can’t read every line of that growing volume, so teams are using AI to help.
不过,AI 审查员必须达到很高的标准。如果它漏掉了真正的 bug,就没人会相信它保持沉默;如果它把这些 bug 淹没在误报中,也没人会看它的评论。An AI reviewer has to clear a hard bar, though. If it misses real bugs, nobody trusts its silence. If it buries those bugs in false alarms, nobody reads its comments.
要同时做好这两点,就得找出可采取行动的 bug、尽量减少误报,并控制延迟和成本。我们发现,在价格固定的情况下,多个规模较小、彼此独立且采用互补模型的审查者,往往比单个由更强模型驱动的审查者表现更好。我们借鉴这一思路,重新打造了 Copilot 代码审查的 Lite 和 Balanced 档位,并推出了全新的 Max 档位,以满足对最重要的拉取请求进行审查的需求。这篇文章将解释这一做法为何有效、我们如何将多个审查者的发现整合成一份审查结果,以及我们如何运用这一思路重新打造 Copilot 代码审查的各个档位。Getting both right means finding actionable bugs, keeping false positives low, and holding latency and cost in check. At a fixed price, we’ve found that several smaller, independent reviewers using complementary models often outperform a single reviewer powered by a stronger model. We used that idea to rebuild Copilot code review’s Lite and Balanced tiers and to launch a new Max tier for your highest-stakes pull requests. This post explains why that works, how we turn many reviewers’ findings into one review, and how we used the idea to rebuild Copilot code review’s tiers.
为什么这样有效?一个简单的例子Why does this work? A simple example
考虑一个具有固定提示词、模型和工具集的审查智能体。假设它有 60% 的概率发现拉取请求中的某个特定 bug。它可能在一次审查中发现这个 bug,却在下一次审查中漏掉它。Consider a review agent with a fixed prompt, model, and set of tools. Suppose it has a 60% chance of flagging a particular bug in a pull request. It might catch that bug on one pass and miss it on the next.
如果我们让该审查器独立并行地运行两次,至少有一次发现漏洞的概率会升至 84%,成本则会翻倍。独立运行三次时,这一概率会升至 94%,成本则会变为三倍。If we run that reviewer twice, independently and in parallel, the probability that at least one run finds the bug rises to 84%, while the cost doubles. With three independent runs, the probability rises to 94%, while the cost triples.
更一般地,如果每位审查者发现某个特定缺陷的概率为 p,那么 n 位相互独立的审查者中至少有一位发现该缺陷的概率为 1 − (1 − p)^n。在我们的例子中,p = 0.6。关键在于,只需要一位审查者发现这个缺陷。More generally, if each reviewer has probability p of finding a particular bug, the probability that at least one of n independent reviewers finds it is 1 − (1 − p)^n. In our example, p = 0.6. The key is that only one reviewer needs to find the bug.
安排多位审阅者也会耗费时间。由于我们必须等待最慢的审阅者完成,审阅时间可能会略有增加。Running several reviewers also has a cost in time. Review time can increase modestly because we have to wait for the slowest reviewer to finish.
同型号与混合型号评测Same-model and mixed-model reviews
反复运行同一个审查器,效果终究有限。运行三次后,收益就开始递减。Repeatedly running the same reviewer only takes us so far. We start to see diminishing returns after the third run.
每个模型也都有受训练过程影响的偏见。无论审查多少次拉取请求,某些模型仍然难以发现特定的错误。模型在代码审查方面各有优势,也各有特定的盲点。Each model also has biases shaped by its training. Some bugs remain difficult for a given model to flag, no matter how many times it reviews a pull request. Models have particular strengths when reviewing code, and they also have specific blind spots.
为了说明这一点,我们使用 ReviewBench 衡量了 GPT-6.1 Sol(高推理能力)、Claude Opus 5.5(高推理能力)以及两者组合发现的严重 bug 百分比。你可以在我们之前的博客文章中了解更多关于 ReviewBench 的信息。To illustrate this, we used ReviewBench to measure the percentage of critical bugs found using GPT-6.1 Sol (high reasoning), Claude Opus 5.5 (high reasoning), and combinations of the two. You can read more about ReviewBench in our earlier blog post.
下图中的虚线表示在每个价格点上,通过反复运行 GPT-6.1 Sol 或 Claude Opus 5.5 所发现的关键漏洞的最高比例。实线表示结合这两个模型后发现的最高比例。In the chart below, the dashed line shows the highest percentage of critical bugs found at each price point by repeatedly running either GPT-6.1 Sol or Claude Opus 5.5. The solid line shows the highest percentage found by combining the two models.
实线始终位于虚线之上或与之重合,因为组合方案可以包含单模型选项。关键在于两者之间的差距,它体现了混合使用模型所能带来的提升。每个拉取请求花费 3 美元时,结合这两个模型可使 ReviewBench 上捕获的关键 bug 比例提高 4.9 个百分点,从 61.3% 升至 66.2%。The solid line is always at or above the dashed line, because a mix can include the single-model option. What matters is the gap between them, which shows the improvement available from mixing models. At $3 per pull request, combining these two models raises the share of critical bugs caught on ReviewBench by 4.9 percentage points, from 61.3% to 66.2%.
Copilot 代码审查可以调用不同提供商的模型,因此不受单一模型系列的优势和盲点所限。这种灵活性让我们能够选择优势互补、在特定价格档位表现最佳的审查模型。Copilot code review can draw on models from different providers, so it isn’t limited to one model family’s strengths and blind spots. That flexibility lets us pick complementary reviewers that perform best at a given price point.
连贯一致的评论Cohesive reviews
当两位独立的审查者检查同一段代码时,他们可能会发现一些相同的错误,也可能各自发现对方遗漏的问题。为减少干扰并避免同一问题被重复报告多次,我们会将双方的发现整合为一份连贯的审查结果。这意味着要去重并排除误报。When two independent reviewers examine the same code, they may find some of the same bugs, and each may find issues the other misses. To reduce noise and avoid reporting the same issue several times, we combine their findings into one cohesive review. That means deduplicating findings and removing false positives.
Copilot 代码审查采用两种策略来实现这一点:投票和智能体聚合。Copilot code review uses two strategies to do this: voting and agentic aggregation.
- 投票会对所有审查者的发现进行去重,并统计每项发现被多少位审查者标记。票数低于设定阈值的发现将被过滤掉,因为票数较少通常意味着置信度较低。投票速度快且成本效益高,因为去重只需一次性调用 LLM。Voting deduplicates the findings from all reviewers and counts how many reviewers flagged each one. Findings with fewer votes than a set threshold are suppressed, on the assumption that fewer votes signals lower confidence. Voting is fast and cost-effective, because deduplication takes only one-shot LLM calls.
- 代理式聚合会使用一个智能体,将所有审阅者的发现整合成一份审阅结果。该智能体可以筛选并完善各项发现、解决分歧,并再次核实每项发现的准确性。代价是审阅所需时间更长,成本也更高。Agentic aggregation uses an agent to reconcile the findings from all reviewers into one review. The agent can curate and refine findings, resolve disagreements, and double-check that each finding is accurate. In exchange, the review takes longer and costs more.
我们来看一个修改了 Python 文件 src/catalog/service.py 的拉取请求示例:Let’s look at an example of a pull request that changes src/catalog/service.py, a Python file:
from catalog import cache, repository as repo
CACHE_TTL_SECONDS = 60
def get_product(product_id):
cached = cache.get(product_id)
if cached is not None:
return cached
product = repo.find(product_id)
if product is not None:
cache.put(
product_id,
product,
ttl_ms=CACHE_TTL_SECONDS,
)
return product
def rename_product(product_id, name):
repo.rename(product_id, name)
三位独立审查员检查了这些更改,并得出以下结论:Three independent reviewers examine the changes and produce these findings:
| Candidate finding | Reviewer A | Reviewer B | Reviewer C |
|---|---|---|---|
| Cache expiration uses the wrong units | X | X | X |
| Renaming a product leaves stale cached data | X | X | |
| Missing products crash the endpoint | X |
前两项发现确实是问题。缓存预期的过期时间单位是毫秒,而重命名产品会更新数据库,却不会同步更新缓存中的快照。仔细查看一下 src/api/products.py——这个拉取请求并未修改该文件——就会发现第三项发现并非如此:The first two findings are true positives. The cache expects expiration times in milliseconds, and renaming a product updates the database but leaves its cached snapshot unchanged. A closer look at src/api/products.py, a file this pull request didn’t change, tells a different story about the third finding:
from catalog.service import get_product
def product_endpoint(product_id):
product = get_product(product_id)
if product is None:
return 404, {"error": "Not found"}
return 200, {"name": product["name"]}
现有的保护逻辑已经会在产品不存在时返回 404,因此第三条发现属于误报。现在来看看随着我们调整投票阈值(即必须有多少名审核者标记某个问题后,我们才会将其显示出来),会发生什么:An existing guard already returns a 404 for a missing product, so the third finding is a false positive. Now consider what happens as we vary the voting threshold, which is the number of reviewers that must flag an issue before we show it:
| Threshold | # of True Positives | # of False Positives | Precision | Recall |
|---|---|---|---|---|
| 1 | 2 | 1 | 67% | 100% |
| 2 | 2 | 0 | 100% | 100% |
| 3 | 1 | 0 | 100% | 50% |
当阈值设为 1 票时,我们会标记出两个真实缺陷和一个误报。将阈值提高到 2 票后,误报消失,只剩下真实缺陷,因此精确率提高。将阈值提高到 3 票时,会漏掉其中一个真实缺陷,因此召回率下降。With a threshold of one vote, we flag two real bugs and one false positive. Raising the threshold to two removes the false positive and leaves only real bugs, which raises precision. Raising it to three drops one of the real bugs, which lowers recall.
投票为我们提供了一种成本低、速度快且简单的方法来筛选发现的问题。难点在于选择合适的阈值,而这个阈值可能因拉取请求而异。智能体式聚合可以让能力更强的模型检查每个发现,剔除误报,并过滤掉严重程度较低的小问题。在这个例子中,检查 src/api/products.py 的聚合器可以剔除误报并保留两个真实的 bug,代价是评审时间更长、成本更高。Voting gives us a cheap, fast, and simple way to curate findings. The challenge is choosing the right threshold, which can vary between pull requests. Agentic aggregation lets a more capable model check each finding, remove false positives, and filter out low-severity nits. In this example, an aggregator that checked src/api/products.py could drop the false positive and keep both real bugs, at the cost of a longer, more expensive review.
投票奖励一致性并控制噪声,因此在成本和延迟受限时很有用。智能体式聚合成本更高,但在我们的实验中得出了质量更高的发现。Voting rewards agreement and controls noise, which makes it useful when cost and latency are tight. Agentic aggregation costs more and, in our experiments, produced higher-quality findings.
新的审核等级New review tiers
我们采用相互独立、优势互补的评审代理,并汇总它们的结果,重新打造了现有的 Lite 和 Balanced 层级,同时推出了全新的 Max 层级。总体而言,每个层级都会使用以下代理来评审你的拉取请求:We used independent, complementary reviewers and aggregation to rebuild our existing Lite and Balanced tiers and to launch a new Max tier. At a high level, each tier reviews your pull request with these agents:
- Lite:4 位 GPT-5.6 Luna 审阅者,并结合投票机制。Lite: 4× GPT-5.6 Luna reviewers, combined with voting.
- 均衡方案:3× GPT-6.1 Sol 审阅者,结合由 GPT-6 Astra 执行的智能体式聚合。Balanced: 3× GPT-6.1 Sol reviewers, combined with agentic aggregation by GPT-6 Astra.
- 最多:4× GPT-6.1 Sol、2× Claude Opus 5.5 和 2× GPT-6 Astra 审阅者,并由 GPT-6.1 Sol 进行智能体式聚合。Max: 4× GPT-6.1 Sol, 2× Claude Opus 5.5, and 2× GPT-6 Astra reviewers, combined with agentic aggregation by GPT-6.1 Sol.
为了开发并迭代全部三个层级的初始配置,我们使用了 ReviewBench——一个面向代码审查智能体的基准测试,其基于具有代表性的 GitHub 拉取请求和与生产环境相契合的指标构建。随后,我们在内部和外部流量上进行了多轮在线实验。To develop and iterate on the initial configurations for all three tiers, we used ReviewBench, a benchmark for code review agents built on representative GitHub pull requests and production-aligned metrics. We then ran several rounds of online experiments on internal and external traffic.
我们的衡量方式How we measure
- 在线实验:9月16日至10月7日期间,共有140万个拉取请求(包括外部拉取请求)参与了 Lite 和 Balanced 两个层级的设计在线实验。10月2日至7日期间,我们使用 GitHub 和 Microsoft 内部的3万条评审记录来设计和测试 Max 层级。Online experiments: In total, 1.4 million pull requests, including external ones, were involved in the online experiments to design the lite and balanced tiers between September 16 and October 7. We used 30K internal reviews within GitHub and Microsoft between October 2 and 7 to design and test the Max tier.
- 严重程度:每项发现都会由另一个代理根据评分标准标记为严重、中等或低。严重级别的意见指出了一个具体问题,应在合并前修复;中等级别的意见指出了一个会影响行为、但不太可能造成严重危害的问题;低级别的意见则描述了可以安全推迟处理的小幅改进。Severity: Each finding is labeled critical, moderate, or low by a separate agent using a rubric. A critical comment is a concrete problem that should be fixed before merging; a moderate one is an issue that affects behavior but is unlikely to cause serious harm, while a low severity comment is one that describes a minor improvement that can safely be deferred.
- 精确率:真实问题在所有发现项中所占的比例。Precision: The share of findings that are real issues.
- 召回率:Copilot 代码审查发现的真实问题所占比例。我们在审查时通过查看其他代理或人工识别出的评论和问题,并将其与 Copilot 代码审查标记的问题进行比较来估算该比例。Recall: The share of real issues that Copilot code review found. We estimate this at review time by looking at the comments and issues identified by other agents or humans and comparing them to those flagged by Copilot code review.
- 已处理/已忽略/误报:正如我们有单独的代理标签来标记严重程度一样,我们也有代理检查评论是否已处理或被忽略。已处理的评论是指在拉取请求合并时已修复的评论,而已忽略的评论是指用户未采取任何行动的评论。误报是指用户明确指出不正确或无效的评论。Addressed/Ignored/False positive: Just as we have a separate agent label severity, we also have an agent check whether a comment was addressed or ignored. An addressed comment is one which is fixed when the pull request merges, while an ignored one is one on which a user does not act upon. A false positive is a comment that a user has explicitly indicated is incorrect or invalid.
以下是最终层级配置在线上的表现:Here’s how the final tier configurations performed online:
覆盖范围和质量有什么区别?What is the difference in coverage and quality?
首先,让我们比较各个层级每次评审的平均发现数量,并按严重程度细分:First, let’s compare the average number of findings per review for each tier, broken down by severity:
Max 的覆盖范围最广,尤其是对关键问题的覆盖,这正是我们的目标。Lite 和 Balanced 在每次评审中发现的问题总数相近,而 Lite 发现的关键问题和低严重性问题更多。Balanced 发现的问题少于 Lite,但其中值得修复的问题更多。Max provides the greatest coverage, especially of critical issues, which was our goal. Lite and Balanced produce a similar total number of findings per review, and Lite produces more critical and low-severity findings. Balanced finds fewer issues than Lite, but more of them are worth fixing.
下图显示了各层级中开发人员已处理、忽略或被归类为误报的严重和中等发现所占的百分比:The chart below shows the percentage of critical and moderate findings that developers addressed, ignored, or that were classified as false positives, for each tier:
总的来说,这构成了三个不同的层级。从 Lite 到 Balanced 再到 Max,开发者会处理更多发现的问题。因此,在迭代过程中需要频繁审查时,Lite 更合适;接近最终版本时,再转向 Balanced 和 Max。Together, these form three distinct tiers. Developers act on more findings as you move from Lite to Balanced to Max. That makes Lite better for frequent review while you’re iterating, and moving to Balanced and Max as you get closer to final.
各档位的价格是多少?How much do the tiers cost?
每个档位都针对特定的价格和质量范围,目标成本从一个档位到下一个档位大约增加 6 倍。Lite 专为迭代过程中频繁审查而设计。Max 则适合在合并前进行全面审查。Each tier targets a specific price and quality range, with target costs rising roughly 6× from one tier to the next. Lite is designed for frequent reviews as you iterate. Max is designed for a thorough pass before you merge.
Balanced 介于两者之间,在快速迭代和最终审核之间提供了折中方案。Balanced sits between them, offering a middle ground between fast iteration and a final review.
Max 对你的要求也更高。它每次审查大约会给出两条发现,而 Lite 和 Balanced 大约为 1.1 到 1.2 条,因此需要阅读的内容更多。对于漏掉一个 bug 通常会造成更大损失的情况,使用它是值得的。Max also asks more of you. It leaves about two findings per review, compared with about 1.1 to 1.2 for Lite and Balanced, so there’s more to read. It’s worth using it where a missed bug would typically cost more than the review.
每个等级分别需要多长时间?How long does each tier take?
审查时间也很重要。有时你在构建过程中需要快速获得反馈;有时,准确性和全面性比速度更重要。Review time matters too. Sometimes you need fast feedback while you build. Other times, correctness and thoroughness matter more than speed.
Lite 和 Balanced 通常约四分钟即可完成。Max 的耗时中位数约为 12 分钟,90 百分位时可能需要 20 分钟,因此最适合作为最后一轮处理。Lite and Balanced typically finish in about four minutes. Max takes about 12 minutes at the median and can take 20 minutes at the 90th percentile, so it fits best as a final pass.
只是一个起点Just a starting point
这是目前各个层级的情况。随着新模型陆续推出,以及我们的方案不断改进,我们会更新各个层级,力求在相应的价格范围内提供尽可能出色的性能。This is a snapshot of where the tiers stand today. As new models become available and our approach improves, we’ll update each tier to deliver the best performance we can within its price range.
下一步:与变更相匹配的审查力度Next: Review effort that fits the change
每个层级使用相同的工具和审查提示。层级决定 Copilot 代码审查的严格程度。仓库的上下文决定它知道该检查什么,包括团队的惯例、允许的例外情况,以及审查人员反复发现的错误。Every tier uses the same tools and review prompt. The tier sets how hard Copilot code review looks. Your repository’s context sets what it knows to look for, including your team’s conventions, the exceptions you allow, and the mistakes your reviewers keep catching.
拉取请求的不同部分可能也需要不同程度的关注。有些部分可能需要前沿模型,而其他部分用较小的模型就足够了。我们正在探索动态代码审查:从审查角色列表中调度审查者,负责拉取请求的特定部分,并根据其需求定制审查方式。Different parts of a pull request may also need different levels of attention. Some may require a frontier model, while a smaller model may be sufficient for others. We’re working toward dynamic code review, dispatching reviewers from a roster of review personas to specific parts of a pull request and tailoring the review to its needs.
目标仍然是让审查发挥作用:增加发现重要问题的机会,同时不把梳理审查结果的工作重新推给你。The goal remains one useful review: more chances to catch important issues, without handing the work of sorting through findings back to you.
致谢Acknowledgments
感谢 GitHub 和 Microsoft 的科学、工程及产品团队,正是你们的努力让这些新套餐成为现实!Thank you to the science, engineering, and product teams across GitHub and Microsoft who helped make these new tiers a reality!