GitHub 上 40% 的 Pull Request 已经由 Agent 起草:2026 Octoverse 数字怎么读
💡 工具推荐: AI Token 计数、代码差异对比、JSON 格式化
GitHub 在 10 月 28 日发布了 Octoverse 2026。整份报告里最值得看的不是开发者总数,而是这一条:到 2026 年 9 月,GitHub 上超过 40% 的 Pull Request 是由 Agent 起草第一版的,而 3 月这个比例是 17%。仅 9 月一个月就是 1.1 亿个 PR,大约是 3 月的六倍。过去十二个月代码推送 179 亿次,比 2024 和 2025 两年加总还多;公开与私有仓库的提交合计 343 亿次,是两年前的三倍多;合并的 PR 增长到三倍以上,达到 13 亿个,平均每天 350 万个。下面我挑出真正会改变你度量方式的几行数据,再给出几个脚本,让你自己验证一下:你的仓库到底像不像这个平均值。
十二个月 179 亿次推送,比 2024 和 2025 加起来还多。
一、先看口径,再看数字
GitHub 统计的三个概念长得像,实际不是一回事。一次 push 是一次推送,可以带很多 commit;一个 commit 是一次快照;contribution 则是每次 push 只计一次,不管里面塞了几个 commit。这就是为什么公开贡献是 25 亿次,而提交是 343 亿次。你要拿自己的团队跟标题数字比,先确认单位一致。另外两行值得单独拎出来,因为它们讲的是自动化而不是生成:GitHub Actions 今年每秒执行 1440 个 job,即每天 1.24 亿次,是去年的三倍多;开发者合并了 3000 多万个 Dependabot PR,大约是 2025 年的两倍。围着代码转的那套机器,扩张速度不比代码本身慢。
# Recompute the pushes-vs-commits gap for one repository, using the same
# distinction Octoverse makes: a contribution counts a push once.
git rev-list --count HEAD # commits on the current branch
git rev-list --count --all # commits across all refs
git log --format='%H' --first-parent | wc -l # linear history size
# Pushes are not recoverable from a clone. They live on the server.
# Use the API and page carefully: 17.9 billion is the platform total, your
# repo is a rounding error, but the RATIO is what you want to compare.
gh api "repos/{owner}/{repo}/commits?per_page=100" --paginate \
| jq '[.[] | .sha] | length'
# Sanity check before you trust any of this: how much of your history is
# merge commits versus real work?
git log --merges --oneline | wc -l
git log --no-merges --oneline | wc -l二、Agent 起草的 PR 更大,而到 9 月已经更快
报告把 Agent 起草的 PR 拆得比较细,你可以在自己的数据上复现。大约 87% 的 Agent 起草 PR 会改动多个文件,而没检测到 Agent 参与的 PR 是 79%。今年 2 月,83% 的 Agent 相关 PR 在两周内合并,比对照组的约 86% 略低;到 9 月,Agent 组升到 90%,对照组还在 86% 左右。这个交叉才是重点。过去两年最常见的质疑是「Agent 写的代码会永远卡在评审里」,总量数据说这七个月里情况反过来了。开发者在评审结构上也动了手:7 月 30 日预览的 stacked pull requests,到 9 月已有 26.4 万开发者用过;AI 辅助代码评审和 GitHub Advanced Security 的用量都同比增长超过 90%。
# Share of pull requests whose first draft came from an agent.
# Detection differs from GitHub's, so measure the delta over time, not the level.
import json, re
import urllib.request
OWNER, REPO = "your-org", "your-repo"
# Trailers and markers that agents commonly leave behind.
AGENT_MARKERS = re.compile(
r"(co-authored-by:\s*.*(copilot|claude|codex|cursor|devin|agent))"
r"|(generated-with:\s*\S+)"
r"|(\bAI-Generated\b)",
re.I,
)
def prs(page):
url = (f"https://api.github.com/repos/{OWNER}/{REPO}/pulls"
f"?state=all&per_page=100&page={page}")
req = urllib.request.Request(url, headers={"Accept": "application/vnd.github+json",
"User-Agent": "octoverse-check"})
with urllib.request.urlopen(req, timeout=30) as r:
return json.load(r)
total, agent = 0, 0
for page in range(1, 11): # first 1,000 PRs; adjust to your volume
batch = prs(page)
if not batch:
break
for pr in batch:
total += 1
blob = (pr.get("title") or "") + "\n" + (pr.get("body") or "")
if AGENT_MARKERS.search(blob):
agent += 1
print(f"agent-started share: {agent}/{total} = {agent / max(total, 1):.1%}")三、提交量 8 倍是相关性,而且很响
2026 年新建的仓库里,带 agent 配置文件(比如 AGENTS.md)的平均提交量是不带这类文件的 8 倍。这里要当作信号读,不能当作因果关系。第一天就提交 AGENTS.md 的仓库,主人本来就打算跑 Agent,所以这个倍数里有很大一块是「意愿」贡献的。诚实的用法是拿它对比你自己仓库的两个时期,而不是拿你的仓库跟陌生人的仓库比。旁边的上下文可以一起看:GitHub Copilot 月活用户里 55% 已经在用 agentic 功能,一年前是 35%;增长最快的是最放手的模式——Copilot cloud agent 同比增长 230%,而 agent 对话是 85%。开发者还是在提问,但越来越多地直接把整个任务交出去。
# Do agent-started PRs touch more files? Octoverse reports 87% vs 79%.
# Pull the file count per PR and split the two cohorts.
import json, statistics, urllib.request
from concurrent.futures import ThreadPoolExecutor
OWNER, REPO = "your-org", "your-repo"
def get(path):
req = urllib.request.Request("https://api.github.com" + path,
headers={"Accept": "application/vnd.github+json",
"User-Agent": "octoverse-check"})
with urllib.request.urlopen(req, timeout=30) as r:
return json.load(r)
def files_for(pr_number):
return len(get(f"/repos/{OWNER}/{REPO}/pulls/{pr_number}/files?per_page=100"))
numbers = [pr["number"] for pr in get(f"/repos/{OWNER}/{REPO}/pulls?state=closed&per_page=50")]
with ThreadPoolExecutor(max_workers=5) as pool:
counts = list(pool.map(files_for, numbers))
multi = sum(1 for c in counts if c > 1) / max(len(counts), 1)
print(f"multi-file share: {multi:.1%} median files: {statistics.median(counts)}")
# A five-point move in either direction across two months is worth a look.
# A one-point move is noise on a sample of fifty.四、多模型已是常态,路由正在被自动化
9 月,自主选择模型的 Copilot 用户里有 61% 在不同会话中用了不止一个模型,四个月前是 50%。付费方案在 5 月涉及 29 个不同模型,9 月是 47 个,而且当月没有任何一个模型占到请求量的 25% 以上。每 100 次开发者手动选择的请求里,38 次给通用模型,37 次给深度推理与规划模型,25 次给快速轻量模型。63% 的付费开发者至少用过一次自动选模型。以 Project HydraFusion 预览的模型编排,路由了近 6 万个会话,现在以 GitHub Copilot Fusion 正式开放。实践层面的结论很直白:如果你的 harness 还把单一模型和单一一组采样参数写死,你在这份数据里已经是少数派了,而写死这件事的成本最后是落在账单上,而不是落在故障单上。
# Model diversity inside your own agent fleet: which models actually carry
# your traffic, and what share does the top one hold?
# Point this at whatever gateway or proxy log you already keep.
import json
from collections import Counter
MODEL_KEYS = ("model", "model_name", "deployment")
def iter_requests(path):
with open(path, encoding="utf-8") as fh:
for line in fh:
line = line.strip()
if line:
yield json.loads(line)
counts, sessions = Counter(), {}
for req in iter_requests("gateway.jsonl"):
payload = req.get("request") or req
model = next((payload[k] for k in MODEL_KEYS if payload.get(k)), "unknown")
counts[model] += 1
sessions.setdefault(req.get("session_id"), set()).add(model)
total = sum(counts.values()) or 1
top_model, top_hits = counts.most_common(1)[0]
multi = sum(1 for m in sessions.values() if len(m) > 1) / max(len(sessions), 1)
print(f"distinct models: {len(counts)}")
print(f"top model share: {top_hits / total:.1%} ({top_model})")
print(f"multi-model sessions: {multi:.1%}")
# Compare against the Octoverse reference points: 47 models on paid plans,
# 61% multi-model users, no model above 25%. If your top model is at 90%,
# you do not have a routing problem yet — you have a concentration risk.五、语言选择正在被「谁挑语言」影响
按贡献者计,TypeScript 仍然是第一,Python 第二,JavaScript 第三。从 2025 年 9 月到 2026 年 9 月,TypeScript 增加了 362 万月活贡献者,Python 增加 323 万,JavaScript 增加 182 万;Rust 翻了一倍,是前十名里百分比增长最快的。更有意思的是 AI 出现在哪里:TypeScript、Python、Rust 的已合并 PR 中,检测到 AI 参与的占比约 40% 到 44%;Java、C#、C++ 落在 21% 到 34% 之间——榜上每一种语言都超过五分之一。在带 agent 信号的 2026 新建仓库里,35% 以 TypeScript 为主要语言,而不带 agent 信号的只有 24%。GitHub 的解释是,开发者会偏向 Agent 产出更容易被验证的语言。反过来的推论就没那么舒服了:当没人指定语言时,Agent 自己的偏好开始塑造技术栈。
# Two-week merge rate, agent cohort versus everyone else.
# Octoverse: 83% vs 86% in February, 90% vs 86% by September.
from datetime import datetime, timezone
import json, urllib.request
OWNER, REPO = "your-org", "your-repo"
def get(path):
req = urllib.request.Request("https://api.github.com" + path,
headers={"Accept": "application/vnd.github+json",
"User-Agent": "octoverse-check"})
with urllib.request.urlopen(req, timeout=30) as r:
return json.load(r)
def parse(ts):
return datetime.fromisoformat(ts.replace("Z", "+00:00"))
def within_two_weeks(created, merged):
return (parse(merged) - parse(created)).days <= 14
cohorts = {"agent": [0, 0], "other": [0, 0]}
for pr in get(f"/repos/{OWNER}/{REPO}/pulls?state=closed&per_page=100"):
if not pr.get("merged_at"):
continue # closed without merge is a different metric
is_agent = "agent" in (pr.get("body") or "").lower()
key = "agent" if is_agent else "other"
cohorts[key][1] += 1
cohorts[key][0] += within_two_weeks(pr["created_at"], pr["merged_at"])
for name, (hit, n) in cohorts.items():
print(f"{name:<6} {hit}/{n} = {hit / max(n, 1):.1%} merged within two weeks")
# Also worth tracking and rarely tracked: merged-then-reverted within 7 days.
# Speed without that number is just velocity in one direction.六、周一该量什么,以及一个别太信预测的理由
有三个指标在自己的仓库上算起来很便宜,而且比任何总量数据都更能拿来做事。第一,第一版由 Agent 起草的 PR 占比。第二,从 Agent 起草到合并的中位时间。第三,Agent PR 与人工 PR 每 100 行改动各自的评审评论数。第三个要盯紧:更多 PR 更快合并、但评审注意力更低,这不显然是进步;第二个数字在变好的同时,第三个可能正在烂掉。至于预测,GitHub 把 40 多个模型推到 2031 年,它们之间已经不再彼此认同——大约一半认为开发者数量会增长三倍以上,略少于一半认为两到三倍,只有三个模型认为低于两倍。这么宽的分布本身就是结论,它说明该先把度量建起来,再谈预测。
Agent 起草的 PR 占比从 3 月的 17% 涨到 9 月的 40% 以上。
带 agent 配置文件的新仓库,平均提交量是 8 倍。
📌 常见问题 FAQ
Octoverse 里 push、commit 和 contribution 有什么区别?
push 是一次推送到 GitHub,可以包含很多 commit;commit 是一次变更快照;contribution 则是每次 push 只计一次,不管里面有几个 commit。这就是为什么提交总数 343 亿次远高于公开贡献的 25 亿次。
带 agent 配置文件真的会导致提交量 8 倍吗?
不是因果。GitHub 报告的是相关性:2026 年新建仓库中,带 agent 配置文件的平均提交量是不带者的 8 倍。第一天就加这类文件的仓库本来就是有意图的,所以这个比值不是受控对比。
GitHub 怎么判断一个 PR 是 Agent 起草的?
这是检测出来的信号,不是开发者主动声明的标记。报告区分「由 Agent 起草第一版」和「检测到 Agent 参与」两类,两者都是启发式判断,检测水平提升后数字会变。趋势方向可信,具体比例只能当近似值。
GitHub Copilot 里的模型选择到底多样到什么程度?
付费方案 5 月用了 29 个不同模型,9 月是 47 个。9 月里自主选模型的用户中 61% 用过不止一个模型,没有任何单一模型占到请求量的 25% 以上,63% 的付费开发者至少用过一次自动选模型。
TypeScript 现在是 GitHub 上使用最多的语言吗?
按贡献者数量算,是的。TypeScript 第一、Python 第二、JavaScript 第三,而且差距在拉大:2025 年 9 月到 2026 年 9 月,TypeScript 增加了 362 万月活贡献者,Python 增加 323 万,JavaScript 增加 182 万。