跳到正文
DEV Community· Sean Kwon·· 1 小時前精選AI 評分81

AI 編碼智能體令程式碼行數增加 30%、PR 提交至合併時間延長 49%,如何紓緩審查積壓

AI Coding Agents Raised Code Output 30% and Slowed PR Reviews 49%: How to Fix the Queue

AI 導讀

兩項大型實證研究均發現,AI 編碼智能體提高程式碼產出,卻未相應帶動已交付成果,人工審查成為瓶頸。Harvard 研究錄得程式碼行數增加 30%、PR 提交至合併時間延長 49%;NBER 研究中,自動化編碼智能體帶來的提交增幅為 240%,實際發佈增幅則為 30%。文章建議追蹤合併時間的第 90 百分位數,讓智能體先開 Draft PR,並在通知人工審查前要求測試通過及附上驗證説明。

推薦理由

文章把研究中的產出與交付落差,轉化為量度合併尾段延遲、以 Draft PR 延後通知及在人工審查前設驗證門檻的可操作流程。

正文 · 原文

Two large-scale 2026 empirical studies reached the same answer on AI coding agents: drafting code got dramatically faster, while shipping finished software barely moved because human code review became the choke point. In a Harvard working paper covering over 700 firms, AI coding agents raised lines of code by 30% and pull requests by 23%, yet average PR submission-to-merge time jumped 49%.

What the two multi-tool studies actually measured

Both papers track real production engineering telemetry across multiple coding tools instead of synthetic benchmark tasks.

Harvard economists Fiona Chen and James Stratton (author research page, reported in detail by Ars Technica) analyzed 300 million work events across more than 700,000 employees at over 700 software companies through March 2026, later expanding the dataset to 445M work events across 720,542 workers at 655 firms. Across adopting companies, AI coding agents lifted lines of code by 30%, commits by 20%, and pull requests by 23%. Resolution rates for Jira issues and epics showed no statistically significant increase.

A separate NBER working paper (w35275) by Mert Demirer, Leon Musolff, and Liyuan Yang tracked more than 500,000 GitHub developers with AI usage telemetry. Cumulative commits rose 30% for autocomplete, 180% for interactive coding agents, and 240% for autonomous coding agents. Moving up the delivery funnel, that 240% commit gain dropped to 80% for projects and fell all the way to 30% for actual releases.

Empirical dataset Code generation gain Shipped output impact Measured bottleneck
Harvard / Jellyfish (over 700 firms, 700,000+ workers; expanded to 445M events across 655 firms) +30% lines of code, +20% commits, +23% pull requests No statistically significant rise in Jira issues or epics resolved +49% PR submission-to-merge time, +35% comments per PR, change requests nearly doubled
NBER w35275 (500,000+ GitHub developers) +30% commits (autocomplete), +180% (interactive), +240% (autonomous agents) +240% commit surge drops to +80% projects and +30% actual releases 0.23 elasticity of substitution between AI and human effort

The NBER authors tie this drop to the weak-link effect: an estimated elasticity of substitution of 0.23 between AI and human effort means faster drafting cannot substitute for human verification and review.

Why AI code reviewers did not clear the backlog

Teams already tried throwing automated review bots at the queue. In the Harvard dataset, 80% of measured firms had adopted some form of AI code review by March 2026. Even with broad adoption, AI generated only 23.3% of review comments across 10.8% of pull requests. Meanwhile, the share of human workers doing code reviews still climbed 14%.

The numbers point to two stacked failure modes. First, agents push 23% more pull requests into a fixed pool of senior maintainers who understand the codebase. Second, first-pass draft quality drops, so reviewers spend more cycles catching edge cases and sending work back, driving a 35% jump in comments per PR and nearly doubling the share of pull requests with changes requested.

Fixing the queue takes process gates before a human ever gets notified, not another bot leaving style comments after a reviewer is already paged.

Gate 1: Audit merge tail latency and change-request loops in your own repo

Before changing team rules, measure both median and 90th-percentile merge hours alongside review churn on your own merged pull requests. The GitHub CLI gh pr list manual exposes createdAt, mergedAt, reviews, and reviewDecision directly as JSON.

Pipe the last 50 merged PRs into a short Python check to measure median merge time, 90th-percentile tail wait, median review events, and how often drafts bounce back with CHANGES_REQUESTED (GitHub Pull Request Reviews REST docs):

gh pr list --state merged --limit 50 \
  --json number,createdAt,mergedAt,reviews,reviewDecision \
  | python3 -c '
import json, statistics, sys
from datetime import datetime

prs = json.load(sys.stdin)
merge_hours, rev_counts = [], []
changes_requested = 0

for pr in prs:
    created = datetime.fromisoformat(pr["createdAt"].replace("Z", "+00:00"))
    merged = datetime.fromisoformat(pr["mergedAt"].replace("Z", "+00:00"))
    merge_hours.append((merged - created).total_seconds() / 3600)
    revs = pr.get("reviews") or []
    rev_counts.append(len(revs))
    if any(r.get("state") == "CHANGES_REQUESTED" for r in revs):
        changes_requested += 1

merge_hours.sort()
p90 = merge_hours[int(0.9 * (len(merge_hours) - 1))]
print(f"Merged PRs analyzed: {len(prs)}")
print(f"Median hours to merge: {statistics.median(merge_hours):.1f}h")
print(f"90th-percentile hours to merge: {p90:.1f}h")
print(f"Median review events per PR: {statistics.median(rev_counts):.1f}")
print(f"PRs with CHANGES_REQUESTED: {changes_requested}/{len(prs)} ({100 * changes_requested / max(len(prs), 1):.1f}%)")
'

Running that exact command against the last 50 merged pull requests on modelcontextprotocol/python-sdk produces:

Merged PRs analyzed: 50
Median hours to merge: 0.4h
90th-percentile hours to merge: 44.1h
Median review events per PR: 2.0
PRs with CHANGES_REQUESTED: 0/50 (0.0%)

Looking only at the 0.4h median would suggest there is no queue at all, while the 44.1h 90th-percentile merge time reveals where harder PRs actually stall. Running the same snapshot weekly before and after changing PR rules shows whether your backlog sits in queue wait or in repeated revision rounds.

Gate 2: Force every agent PR into Draft mode so CODEOWNERS stay quiet until CI passes

Most review queues clog because an agent finishes a loop and opens a normal pull request immediately, paging every owner before tests finish or the author inspects the diff. Under GitHub's CODEOWNERS rules, code owners are not automatically requested to review draft pull requests. When you mark a draft pull request as ready for review, code owners are automatically notified.

Make Draft mode the default in your agent prompt instructions and shell workflow using gh pr create --draft and gh pr ready:

# 1. Agent opens every PR as a draft so CODEOWNERS are not paged on broken runs
gh pr create --draft --fill

# 2. Only after local tests, CI checks, and author diff inspection pass:
gh pr ready

That single change keeps raw agent output out of senior engineers' notification queues while the author trims dead code, verifies edge cases, and fixes failing checks.

Gate 3: Block ready-for-review PRs that lack a reproducible verification block

Draft mode protects reviewer attention during CI, while a pre-review workflow stops half-baked drafts from triggering change-request loops after they turn ready. Using GitHub Actions pull_request triggers for opened, synchronize, and ready_for_review, require every non-draft PR to pass tests and include a non-empty verification section describing the exact command run to prove behavior:

name: PR Review Readiness Gate

on:
  pull_request:
    types: [opened, synchronize, ready_for_review]

jobs:
  verify-before-human-review:
    if: github.event.pull_request.draft == false
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Check PR verification block
        env:
          pr_body: ${{ github.event.pull_request.body }}
        run: |
          python3 - << 'PY'
          import os, re, sys
          body = os.environ.get("pr_body", "")
          match = re.search(r"(?is)##\s+Verification\s*\n(.+)", body)
          if not match or len(match.group(1).strip()) < 25:
              print("Missing ## Verification section with test command and observed result.")
              sys.exit(1)
          print("Verification block present.")
          PY
      - name: Run full test suite
        run: npm test

Because the job skips draft pull requests (github.event.pull_request.draft == false) and fires automatically on ready_for_review, authors and agents can iterate freely in draft while guaranteeing that any PR reaching a human reviewer has both green tests and a written verification trace.

Keep review capacity ahead of drafting speed

Faster code generation only raises shipped output when review capacity and draft verification scale with it. Measure your current tail merge latency and CHANGES_REQUESTED rate with gh pr list, default agent PRs to --draft so CODEOWNERS are only notified on verified work, and run a ready_for_review readiness gate before human reviewers open the diff.

Where has the review queue slowed down most on your repositories since adopting coding agents, and which workflow change actually cut back the revision loops?

來源:DEV Community · dev.to