← Back to Pull requests

chore: add regression and user-impact review to the PR workflow #4023

Closed
unknown closed this pull request without merging on Sep 28, 2026 03:27 UTC
View on GitHub
unknown unknown commented on Sep 24, 2026 08:45 UTC
Author

Requirement or Bug

无关联 issue。多个 PR 合入后对现有用户造成回归(#3492 → #3900,#3931 → #4015,#2961 → #3167,#3964 → #4013),共同点是没有人回答"谁在依赖旧行为",本 PR 把这个问题写进 PR 流程的三处:作者填表、Codex 自动 review 规则、人工触发的评审 skill。

Bug Reproduction Steps

N/A

Root Cause

N/A

Code Changes

 .agents/skills/
 ├── review-pr/
 │   ├── SKILL.md              # 重写:定性 → 模板核对 → 回归与用户影响三遍;影响等级三步判定;finding 证据门槛
+│   └── surfaces.md           # 新建:人群清单、触发线索文件、历史案例
 ├── write-pr/SKILL.md         # 加"行为变化与受影响人群"填表指引;PR 描述跟随用户语言
 └── gen-changesets/SKILL.md   # 默认翻转或删除行为时须写明失去的行为,有退路则写退路
 .github/pull_request_template.md   # Impact Scope → Behavior Changes and Affected Users;检查清单加一项
 AGENTS.md                          # 新增 ## Code Review Rules 六条,给 Codex 自动 review 读

三处共用一条判据:改动前能工作的任何输入(配置键、环境变量、命令行参数、provider 响应形态、旧版本写的会话数据、客户端请求、hook 载荷)改动后必须行为不变,除非 PR 明确声明并给出退路。

评审 skill 的流程变化:

 review-pr
   读 PR 元数据与 diff
+  第一遍:定性(改动类型决定第三遍深度;发布与打包 CI 按用户可感知处理)
   第二遍:按模板逐节核对
+  第三遍:回归与用户影响(尽量由独立子 agent 盲跑,再与作者的表对比)
+    行为变化清单:被删或收窄的分支、新增条件、反向改写的测试断言、命中触发线索的文件
+    受影响人群:从 surfaces.md 取名,须有存在证据
+    影响等级:三步判定,见下
+    补救核对:退路开关、changeset 是否点明失去的行为、老数据与老客户端、guard 测试、文档
+    finding 须有改动前后 file:line 与具名人群双证据,否则降级为"待作者确认",上限 5 条
   输出评审摘要(跟随用户语言)

影响等级只由改动事实决定,changeset、文档、guard 测试只出现在补救核对里:

数据丢失 / 安全边界放宽 / 老数据不可读 / 某人群功能整体不可用 → L3
否则:有一键退路 → L1;无退路 → L2;无可观测变化 → L0
用户输入被静默忽略或丢弃且无任何错误信号 → 升一级,最高 L3

L3 建议阻塞:须补 guard 测试,并提供退路、flag 门控或迁移
L2 维护者显式拍板,changeset 写明失去的行为
L1 只查 changeset

验证方式是把新 skill 回放到三个已合并 PR 上盲审:

  • #3492:无提示下把 OpenRouter 方言丢思考链列为第 1 条 finding(无退路 L2,输入静默丢弃升 L3),根因与修法和 #3910 一致。

  • #3931:独立得出 L1 并因静默升 L2,抓到 changeset 没写失去的行为,补出 AGENTS.md 变更提醒失效、/reload 不覆盖 AGENTS.md。

  • #3964(56 文件,测信噪比):8 行清单中 5 行有双证据、1 行降级到待确认;列出的四条 L3 候选随 #4013 回滚已不在 main。
  • 两次盲审的自评各指出一条清单缺口(watch 默认值、git 仓库形态人群),已按 skill 的"复盘回填"规则补进 surfaces.md。本 PR 自身收到 Copilot 4 条、Codex 8 条评论:11 条已采纳(klient 与 kosong 两条按核实的消费方范围收窄),1 条保留 disable-model-invocation 原设定并改为从 AGENTS.md 删除调用指令,各线程已回复。

    Behavior Changes and Affected Users

    产品运行时行为:None。diff 不含任何 src/ 文件,.agents/、.github/ 与 AGENTS.md 不进发布包。

    贡献流程的变化:

    | 行为 | 变化前 | 变化后 | 谁在依赖旧行为 | 退路 |
    |---|---|---|---|---|
    | PR 模板的影响范围一节 | Impact Scope 自由文本 | 改名 Behavior Changes and Affected Users,要求填行为变化表;检查清单多一项 | 所有 PR 作者,含外部贡献者 | 已开的 PR 不受影响;review-pr 对旧节名按同一标准核对 |
    | Codex 自动 review | 只有通用检查 | 读 AGENTS.md 的 ## Code Review Rules,会多出回归类评论并引用规则 | 所有 PR 作者 | 规则要求双证据控制噪音;本 PR 自身的一轮评审是样本 |
    | 每个 agent 会话加载的根 AGENTS.md | 1638 词 | 2056 词,多出评审规则一节 | 在本仓库工作的所有 agent | 无;如需精简可砍到约 300 词而不伤触发条件 |
    | review-pr 的输出语言 | 固定中文 | 跟随用户当前语言 | 使用 review-pr 的维护者 | 不需要 |
    | PR 描述语言 | 未规定,习惯英文 | 跟随用户当前语言;标题、changeset、模板节标题固定英文 | 所有 PR 作者 | 不需要 |
    | changeset 措辞 | 只写变了什么 | 默认翻转或删除行为时还须写明失去的行为,有退路则写退路 | 写 changeset 的作者 | 不需要 |
    | review-pr 的触发方式 | 仅用户触发 | 不变;AGENTS.md 不再指示 agent 调用它 | 无 | 不需要 |

    受影响模块:无代码模块。测试覆盖:无自动化测试;验证方式见上文的三次回放。

    Checklist

  • I have read the CONTRIBUTING document.

  • I have linked a related issue (external PRs: issue must have a maintainer's /approve). 无 issue,内部流程改动,问题见上文。

  • I have added tests that prove my feature works. N/A,不含代码;验证方式为回放三个已合并 PR。

  • The behavior-change table above is complete, and every removed behavior or flipped default is named in the changeset and either has an escape hatch or was explicitly approved by a maintainer in this PR. 无默认翻转或删除行为。

  • Ran gen-changesets skill, or this PR needs no changeset. 不进发布包,无需 changeset。

  • Ran gen-docs skill, or this PR needs no doc update. 用户文档不描述 PR 流程。
  • Diff: 446 lines (+334 / -112) across 5 files Reviewer: HelloWorldU Review duration: 5441m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 446 lines diff across 5 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.365
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #4023"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.4% (MEDIUM) · Higher = larger blast radius
    45.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.9% · Safe to merge
    17.9%