Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

docs(workflow): require root-cause PR landing

vastsa87870d01de38
diff --git a/AGENTS.md b/AGENTS.md
index 34ded14d2..7eb504f19 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -1,6 +1,6 @@
# AGENTS.md
-Policy-Sync: 2026-02-16.2
+Policy-Sync: 2026-09-20.1
Mandatory rules for AI coding agents working in PI-Desktop.
@@ -713,15 +713,40 @@ and leave it open. Do not implement first and investigate later.
## 15. GitHub Pull Request Intake
-For a linked pull request, evaluate whether its **principle and
-direction** are sound before replacing anything.
+For a linked pull request, fetch it first. Do not replace the
+contributor's work until the review below is complete.
-If the direction is sound:
+A sound direction is not enough to land. Independently verify that the
+change must fix the reported root cause with the smallest coherent
+change:
+
+1. The reported problem is real (same bar as § 14).
+2. The diff removes that failure mode at the root — not a nearby
+ symptom, a docs-only restatement, a config contract test, or a
+ partial workaround that leaves the original path intact.
+3. Extra files, refactors, and spec theater do not compensate for an
+ incomplete fix.
+
+If (2) or (3) fail:
+
+* do not merge
+* do not approve as "direction is fine, follow up later"
+* comment with the evidence in the pull request's language
+* prefer a minimal completion of the author's approach when that
+ approach can actually reach the root cause
+* do not rewrite from scratch, force-push, or silently reimplement
+ unless the user asks to take the work over
+
+If (1)–(3) hold:
* preserve the contributor's work and authorship
* do not force-push a contributor's branch
* do not ask them to restart for minor style / completeness issues
-* make only minimal landing fixes when necessary
+* missing specs, extra tests, i18n, naming, or formatting are
+ follow-up only when they are not required to prove the root-cause
+ fix (see § 12)
+* make only minimal landing fixes when a landing blocker would
+ break `main`
Do not merge a draft PR unless explicitly authorized or marked ready.
@@ -737,6 +762,8 @@ Landing blockers:
* secret leakage
* privilege / sandbox bypass
* unresolved incompatible protocol change
+* does not actually fix the reported root cause
+* larger than the smallest coherent fix without a stated reason
A sound idea does not override a failing landing gate.
diff --git a/CLAUDE.md b/CLAUDE.md
index 5b8aee3ef..fa5945bae 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -1,6 +1,6 @@
# CLAUDE.md
-Policy-Sync: 2026-02-16.2
+Policy-Sync: 2026-09-20.1
Instructions for Claude Code CLI and Claude Cowork on PI-Desktop.
@@ -305,7 +305,7 @@ Do not push, open a PR, or merge unless the user explicitly asks.
**Issue:** fetch, read body/comments/labels, verify against code. Bugs: reproduce or give concrete evidence; classify as confirmed regression / existing defect / already fixed / expected behavior / environment-specific / insufficient evidence. Do not implement first and investigate later.
-**PR:** judge principle and direction before replacing work. Preserve authorship on a sound PR. Landing blockers include build/typecheck/test/E2E failure, merge conflict, data corruption risk, security violation, secret leakage, sandbox bypass, incompatible protocol change.
+**PR:** fetch first. Do not land on direction alone — the change must fix the reported root cause with the smallest coherent change (not a leftover workaround, docs-only restatement, or extra files instead of a fix). Preserve authorship when that bar is met; do not force-push or rewrite for nits. Request changes and do not merge when the root cause remains. Landing blockers include build/typecheck/test/E2E failure, merge conflict, data corruption risk, security violation, secret leakage, sandbox bypass, incompatible protocol change, an incomplete fix, and an oversized diff without a stated reason.
Security reports are private via `SECURITY.md` — never open a public issue for vulnerabilities or credential exposure.
diff --git a/docs/spec/06-delivery/03-ai-development-workflow.md b/docs/spec/06-delivery/03-ai-development-workflow.md
index 833c58d89..e59a12a68 100644
--- a/docs/spec/06-delivery/03-ai-development-workflow.md
+++ b/docs/spec/06-delivery/03-ai-development-workflow.md
@@ -119,9 +119,9 @@ unambiguous issue number for this repository.
- Do not comment on or close unrelated issues. Do not reopen a closed issue
unless the user explicitly asks.
-### R6 — Merge a linked pull request whose principle is sound, then follow up
+### R6 — Land a linked pull request only when it fixes the root cause with a minimal diff
-> **A linked GitHub pull request whose direction is sound is merged first. Completeness, style, spec-sync, and polish happen after merge so the contributor's work is not discarded.**
+> **A linked GitHub pull request lands only when it actually removes the reported failure mode at the root, with the smallest coherent change. A sound direction is not enough. Completeness nits may follow after merge; an incomplete fix may not.**
This rule applies when the user prompt includes a GitHub pull request URL or
an unambiguous pull request number for this repository.
@@ -129,19 +129,25 @@ an unambiguous pull request number for this repository.
- Fetch the pull request (title, body, files, commits, comments, checks, draft
state, base/head, and linked issues) before creating a replacement
implementation or requesting a rewrite.
-- Independently judge whether the **principle** is sound. The change must
- address a real, in-scope problem, and the approach must be compatible with
- the baseline, security boundaries, and architecture (or be a justified
- spec-backed amendment). Judge the direction, not whether the pull request
- already satisfies R1–R5 completeness.
+- Independently verify all of:
+ 1. The reported problem is real and in scope (same bar as R5).
+ 2. The change must fix the reported root cause with the smallest coherent
+ change — not a nearby symptom, a docs-only restatement, a config
+ contract test, or a partial workaround that leaves the original path
+ intact.
+ 3. Extra files, refactors, and spec theater do not compensate for an
+ incomplete fix. The approach must still be compatible with the
+ baseline, security boundaries, and architecture (or be a justified
+ spec-backed amendment).
- Do not reimplement the pull request as a replacement, close it for nits, or
- ask the contributor to start over when the principle is sound.
-- If the principle is sound:
+ ask the contributor to start over when (1)–(3) hold.
+- If (1)–(3) hold:
1. Merge **that** pull request first, preserving the contributor's commits.
Use a repository-permitted merge strategy that keeps the contributor as
author of the landed work.
2. Missing additional test coverage, documentation, naming cleanup,
- formatting, and other non-blocking polish are follow-up work. Build,
+ formatting, and other non-blocking polish are follow-up work **only
+ when they are not required to prove the root-cause fix**. Build,
typecheck, relevant existing test, required E2E, security, data-safety,
protocol-compatibility, and merge-conflict failures remain landing
blockers.
@@ -149,19 +155,22 @@ an unambiguous pull request number for this repository.
fails existing tests for the changed area, or has merge conflicts) may
receive the smallest commits **on top of** the author's work so the pull
request can land. Do not squash away the author. Do not rewrite the
- design.
+ design. Do not expand the diff beyond the root-cause fix.
4. After the pull request is in `main`, follow R4 for any follow-up
improvements from the updated `main`.
5. Comment on the pull request in its language: acknowledge the
contribution, state what was merged, and list follow-up if any.
-- If the principle is not sound, or a harm blocker exists (secrets, sandbox
- or privilege bypass, malicious or clearly destructive changes, out-of-scope
- reversal of a frozen decision, unrelated drive-by payload): do not merge.
- Comment with the evidence in the pull request's language. Do not silently
- reimplement the same idea as if the pull request never existed.
+- If (1)–(3) fail, or a harm blocker exists (secrets, sandbox or privilege
+ bypass, malicious or clearly destructive changes, out-of-scope reversal of
+ a frozen decision, unrelated drive-by payload): do not merge, do not
+ approve as "direction is fine, follow up later", and comment with the
+ evidence in the pull request's language. Prefer a minimal completion of
+ the author's approach when that approach can actually reach the root
+ cause. Do not silently reimplement the same idea as if the pull request
+ never existed unless the user asks to take the work over.
- Do not merge a draft pull request the author has not marked ready, unless
- the user explicitly asks to merge the draft. Comment with the principle
- review and wait until it is ready.
+ the user explicitly asks to merge the draft. Comment with the review and
+ wait until it is ready.
- A pull request link authorizes reviewing, commenting on, and merging
**that** pull request when this rule applies. It does not authorize
force-pushing the contributor's branch or publishing unrelated branches.
@@ -229,11 +238,11 @@ Do not weaken these required fields. Blank issues stay disabled.
## 2. Development Loop
-Every change follows this sequence. Steps may be iterated if the implementation reveals new requirements. If the prompt includes a GitHub issue, complete R5 verification before step 1. If the prompt includes a GitHub pull request, complete the R6 principle review (and merge when sound) before starting a replacement or follow-up implementation.
+Every change follows this sequence. Steps may be iterated if the implementation reveals new requirements. If the prompt includes a GitHub issue, complete R5 verification before step 1. If the prompt includes a GitHub pull request, complete the R6 root-cause review (and merge only when the change actually fixes the problem with a minimal diff) before starting a replacement or follow-up implementation.
```
0. If a GitHub issue is linked: verify the claim (R5) before any implementation
-0b. If a GitHub pull request is linked: review the principle (R6); merge first when sound; start follow-up only after it is in `main`
+0b. If a GitHub pull request is linked: review root cause and minimality (R6); merge only when it actually fixes the problem; start follow-up only after it is in `main`
1. Sync main + create a request branch and worktree
2. Read baseline + relevant specs
3. Plan change + list impacted specs and necessary validation
@@ -256,7 +265,7 @@ Every change follows this sequence. Steps may be iterated if the implementation
| Step | Action | Output |
|---|---|---|
| **0. Issue verify** | When a GitHub issue is linked, fetch it and independently verify that the reported problem exists. Stop here (comment, and close only if conclusive) when it does not. | Verified issue, or a comment and close/leave-open decision. |
-| **0b. PR review** | When a GitHub pull request is linked, fetch it and independently judge whether the principle is sound. Merge first when it is; start follow-up only after it is in `main`. Stop (comment, do not rewrite) when it is not. | Merged contributor PR plus follow-up plan, or a comment and no merge. |
+| **0b. PR review** | When a GitHub pull request is linked, fetch it and independently verify that it fixes the reported root cause with the smallest coherent change. Merge only when it does; start follow-up only after it is in `main`. Stop (comment, do not rewrite) when it does not. | Merged contributor PR plus follow-up plan, or a comment and no merge. |
| **1. Branch + worktree** | Preserve existing work, update from `origin/main`, and create a dedicated request branch in a dedicated worktree. Reuse the primary checkout's environment where safe. | Isolated task files on current `main` with a consistent development environment. |
| **2. Read** | Read `00-baseline.md` and any specs relevant to the change area. | Mental model of constraints. |
| **3. Plan** | Describe the intended change. List every spec, ADR, and e2e scenario that will need updates, and assess whether local validation is necessary. | Change plan + impact and validation list. |
@@ -549,9 +558,10 @@ explicit branch-only or draft-only delivery scope:
11. If a GitHub issue was linked: the claim was verified before implementation;
the issue received a comment in its language; and the issue was closed when
the outcome was conclusive.
-12. If a GitHub pull request was linked: the principle was reviewed; the pull
- request was merged first when sound; follow-up landed after merge; the
- contributor's work was not discarded.
+12. If a GitHub pull request was linked: the root-cause bar was reviewed; the
+ pull request was merged only when it actually fixed the problem with a
+ minimal diff; follow-up landed after merge; the contributor's work was
+ not discarded.
13. If launch was requested after delivery: the app was built and started from
the integrated `main` checkout and its development environment.
@@ -591,9 +601,10 @@ D164, and D260. GitHub release notes are not a substitute.
| Mixing multiple logical changes in one commit without clear message | Loss of history granularity |
| Implementing a linked GitHub issue without verifying the problem exists | Violates R5; wastes work on invalid or already-fixed claims |
| Closing a linked GitHub issue without a comment in the issue language | Violates R5; leaves no public record of the outcome |
-| Closing, rewriting, or requesting a restart of a linked pull request whose principle is sound | Violates R6; discards the contributor's work |
-| Blocking merge of a sound linked pull request solely for missing specs, tests, style, or agent-workflow completeness | Violates R6; completeness is follow-up after merge |
-| Merging a linked pull request whose principle is unsound or that introduces a harm blocker | Violates R6; merge-first does not apply to unsafe or wrong-direction changes |
+| Closing, rewriting, or requesting a restart of a linked pull request that already fixes the root cause with a minimal diff, solely for nits | Violates R6; discards the contributor's work |
+| Blocking merge of a root-cause-complete linked pull request solely for missing specs, extra tests, style, or agent-workflow completeness | Violates R6; those are follow-up after merge |
+| Merging a linked pull request that only has a sound direction, leaves the original failure mode, or is larger than the smallest coherent fix without a stated reason | Violates R6; direction is not enough |
+| Merging a linked pull request that introduces a harm blocker | Violates R6 |
| Force-pushing a contributor's branch to land a linked pull request | Violates R6; landing fixes go on top of the author's commits |
| Tagging a stable app release without updating `packages/shared/src/changelog.ts` for every shipped locale | Violates D164 / D345 / release runbook; in-app What's new is empty for that locale and version |
| Tagging a stable app release while `README.md` / `README.zh-CN.md` still state an older release line, or bypassing `scripts/check-release-docs.mjs` with `--skip-docs-check` | Violates D260 / release runbook; published documentation advertises a version the release no longer matches |
@@ -631,6 +642,6 @@ This workflow spec itself is accepted when:
- [ ] `AGENTS.md` points to this doc, `04-e2e-test-plan.md`, and `05-change-checklist.md`.
- [ ] Linked GitHub issues are verified before implementation, then commented
on in the issue language and closed when conclusive.
-- [ ] Linked GitHub pull requests whose principle is sound are merged first,
- then followed up; contributor work is not discarded.
+- [ ] Linked GitHub pull requests land only when they fix the reported root
+ cause with a minimal diff; contributor work is not discarded for nits.
- [ ] All indexes updated (NAV, delivery README, spec README, docs README, BOARD).
diff --git a/docs/spec/06-delivery/05-change-checklist.md b/docs/spec/06-delivery/05-change-checklist.md
index dec5a5628..87b9735c7 100644
--- a/docs/spec/06-delivery/05-change-checklist.md
+++ b/docs/spec/06-delivery/05-change-checklist.md
@@ -34,25 +34,28 @@ change or starting follow-up:
- [ ] Pull request title, body, files, commits, comments, checks, draft
state, base/head, and linked issues were fetched.
-- [ ] The **principle** was independently judged (real in-scope problem;
- approach compatible with baseline, security, and architecture).
-- [ ] Completeness gaps (specs, tests, i18n, e2e docs, style, naming) were
- not treated as merge blockers.
-- [ ] If the principle is sound: the pull request was merged first,
+- [ ] The **root-cause bar** was independently judged: real in-scope problem;
+ the change actually removes that failure mode at the root; the diff is the
+ smallest coherent fix; approach compatible with baseline, security, and
+ architecture.
+- [ ] Completeness gaps (specs, extra tests, i18n, e2e docs, style, naming)
+ were not treated as merge blockers **unless** they are required to prove
+ the root-cause fix.
+- [ ] If the root-cause bar holds: the pull request was merged first,
preserving the contributor's commits; landing blockers received only
smallest-on-top commits.
- [ ] Follow-up started only after the pull request was in `main`, using a
new R4 request branch and worktree.
-- [ ] If the principle is not sound or a harm blocker exists: the pull
- request was not merged, and a comment recorded the evidence. The idea was
- not silently reimplemented.
+- [ ] If the root-cause bar fails or a harm blocker exists: the pull
+ request was not merged, was not approved as "direction is fine", and a
+ comment recorded the evidence. The idea was not silently reimplemented.
- [ ] A draft pull request was not merged unless the user explicitly asked.
- [ ] The comment uses the pull request's language.
- [ ] No unrelated pull request was commented on or merged.
- [ ] The contributor's branch was not force-pushed. Unrelated remote
publishing was not inferred from the pull request link.
-See [R6 — Merge a linked pull request whose principle is sound, then follow up](03-ai-development-workflow.md#r6--merge-a-linked-pull-request-whose-principle-is-sound-then-follow-up).
+See [R6 — Land a linked pull request only when it fixes the root cause with a minimal diff](03-ai-development-workflow.md#r6--land-a-linked-pull-request-only-when-it-fixes-the-root-cause-with-a-minimal-diff).
---
@@ -242,7 +245,7 @@ user's delivery scope:
| 9 | Requested local/remote `main` integration completed under R4; expected commits verified and merged worktree/branch removed; any requested launch uses integrated `main` | [R4 — Request branch + worktree + merge gate](03-ai-development-workflow.md#r4--request-branch--worktree--merge-gate) |
| 10 | No merged worktree left on disk; `git worktree list` has no stale entry for this request | [§6.1 Merge Cleanup Checklist](#61-merge-cleanup-checklist) |
| 11 | If a GitHub issue was linked: verified before work; commented in the issue language; closed when conclusive | [R5 — Verify linked GitHub issues](03-ai-development-workflow.md#r5--verify-linked-github-issues-before-work-then-reply-and-close) |
-| 12 | If a GitHub pull request was linked: principle reviewed; merged first when sound; follow-up after merge; contributor work not discarded | [R6 — Merge a linked pull request whose principle is sound, then follow up](03-ai-development-workflow.md#r6--merge-a-linked-pull-request-whose-principle-is-sound-then-follow-up) |
+| 12 | If a GitHub pull request was linked: root-cause bar reviewed; merged only when it actually fixes the problem with a minimal diff; follow-up after merge; contributor work not discarded for nits | [R6 — Land a linked pull request only when it fixes the root cause with a minimal diff](03-ai-development-workflow.md#r6--land-a-linked-pull-request-only-when-it-fixes-the-root-cause-with-a-minimal-diff) |
If any applicable gate fails, the requested integration is **not Done**; report
the blocker without weakening the gate.
diff --git a/docs/zh-CN/spec/06-delivery/03-ai-development-workflow.md b/docs/zh-CN/spec/06-delivery/03-ai-development-workflow.md
index fb626029c..66e45ee01 100644
--- a/docs/zh-CN/spec/06-delivery/03-ai-development-workflow.md
+++ b/docs/zh-CN/spec/06-delivery/03-ai-development-workflow.md
@@ -93,23 +93,26 @@
- issue 链接仅授权评论并关闭**该** issue。它不授权 git push。远程发布仍按 R4 和 `AGENTS.md` 选择加入。
- 不得评论或关闭无关 issue。除非用户明确要求,否则不得重新打开已关闭的 issue。
-### R6 — 原则没问题的链接 PR 先合入,再完善
+### R6 — 链接 PR 必须根治问题且改动最小才可合入
-> **链接的 GitHub pull request 只要方向正确,就必须先合入。完整性、风格、规格同步和打磨在合入之后进行,以免贡献者的工作被丢掉。**
+> **链接的 GitHub pull request 只有真正从根上消掉所报告的失败路径、且改动是最小一致修复时才可合入。方向正确不够。完整性细枝末节可以合入后再做;没修完的问题不能合。**
当用户提示包含 GitHub pull request URL,或本仓库中无歧义的 pull request 编号时,适用本规则。
- 在创建替代实现或要求重写之前,先获取 pull request(标题、正文、文件、提交、评论、检查、草稿状态、base/head 以及关联 issue)。
-- 独立判断**原则**是否成立。该变更必须针对真实且在范围内的问题,并且方案与基线、安全边界和架构兼容(或是有规格依据的正当修订)。判断的是方向,而不是该 pull request 是否已经满足 R1–R5 的完整性。
-- 当原则成立时,不得把该 pull request 重写为替代实现、因细枝末节关闭它,或要求贡献者从头再来。
-- 若原则成立:
+- 独立核实以下全部成立:
+ 1. 所报告的问题真实且在范围内(与 R5 同一标准)。
+ 2. 该变更必须从根上修复所报告的问题,且是最小一致改动——不是旁边的症状、纯文档重述、配置契约测试,或留下原路径的半截绕过。
+ 3. 多出来的文件、重构和规格表演不能弥补没修完的问题。方案仍须与基线、安全边界和架构兼容(或是有规格依据的正当修订)。
+- 当 (1)–(3) 成立时,不得把该 pull request 重写为替代实现、因细枝末节关闭它,或要求贡献者从头再来。
+- 若 (1)–(3) 成立:
1. 先合入**该** pull request,并保留贡献者的提交。使用仓库允许的、能让贡献者作为合入工作作者的合并策略。
- 2. 额外测试覆盖、文档、命名清理、格式化和其他非阻塞打磨可以作为后续工作。构建、类型检查、相关既有测试、必需的 E2E、安全、数据安全、协议兼容性和合并冲突失败仍然是落地阻塞项。
- 3. 会破坏 `main` 的落地阻塞(无法编译、使改动区域的现有测试失败、或存在合并冲突)可以在作者工作**之上**追加最小提交以便合入。不得 squash 掉作者。不得改写设计。
+ 2. 额外测试覆盖、文档、命名清理、格式化和其他非阻塞打磨可以作为后续工作,**前提是它们不是证明根因修复所必需的**。构建、类型检查、相关既有测试、必需的 E2E、安全、数据安全、协议兼容性和合并冲突失败仍然是落地阻塞项。
+ 3. 会破坏 `main` 的落地阻塞(无法编译、使改动区域的现有测试失败、或存在合并冲突)可以在作者工作**之上**追加最小提交以便合入。不得 squash 掉作者。不得改写设计。不得把 diff 扩到根因修复之外。
4. 该 pull request 进入 `main` 之后,按 R4 从更新后的 `main` 做任何后续完善。
5. 用该 pull request 的原文语言评论:肯定贡献、说明已合入的内容,并列后续工作(如有)。
-- 若原则不成立,或存在危害阻塞(密钥、沙箱或权限绕过、恶意或明显破坏性改动、超出范围地推翻冻结决策、无关的顺便改动):不得合入。用该 pull request 的原文语言评论证据。不得在假装该 pull request 从未存在的情况下悄悄重做同一想法。
-- 不得合入作者尚未标为 ready 的草稿 pull request,除非用户明确要求合入该草稿。评论原则审查结果并等到它 ready。
+- 若 (1)–(3) 不成立,或存在危害阻塞(密钥、沙箱或权限绕过、恶意或明显破坏性改动、超出范围地推翻冻结决策、无关的顺便改动):不得合入,不得以「方向没问题、以后再补」为由通过,并用该 pull request 的原文语言评论证据。作者的方案若能真正修到根因,优先做最小补完。除非用户要求接管,否则不得假装该 pull request 从未存在而悄悄重做同一想法。
+- 不得合入作者尚未标为 ready 的草稿 pull request,除非用户明确要求合入该草稿。评论审查结果并等到它 ready。
- pull request 链接在本规则适用时,授权审查、评论并合入**该** pull request。它不授权对贡献者分支 force-push,也不授权发布无关分支。后续工作仍遵循 R4 的远程发布选择加入规则。
- 不得评论或合入无关 pull request。已合入的 pull request 不再重新打开;剩余缺口转为普通后续工作。
- 当同时链接了 issue 和 pull request 时,R6 适用于该 pull request;R5 在合入结果之后仍适用于该 issue。
@@ -145,11 +148,11 @@
## 2. 开发循环
-每一个变化都遵循这个顺序。如果实施过程中出现新的需求,则可以重复步骤。如果提示包含 GitHub issue,必须在步骤 1 之前完成 R5 核实。如果提示包含 GitHub pull request,必须在开始替代实现或后续完善之前完成 R6 原则审查(原则成立时先合入)。
+每一个变化都遵循这个顺序。如果实施过程中出现新的需求,则可以重复步骤。如果提示包含 GitHub issue,必须在步骤 1 之前完成 R5 核实。如果提示包含 GitHub pull request,必须在开始替代实现或后续完善之前完成 R6 根因审查(只有真正修好且改动最小时才合入)。
```
0. If a GitHub issue is linked: verify the claim (R5) before any implementation
-0b. If a GitHub pull request is linked: review the principle (R6); merge first when sound; start follow-up only after it is in `main`
+0b. If a GitHub pull request is linked: review root cause and minimality (R6); merge only when it actually fixes the problem; start follow-up only after it is in `main`
1. Sync main + create a request branch and worktree
2. Read baseline + relevant specs
3. Plan change + list impacted specs and necessary validation
@@ -170,7 +173,7 @@
| 步骤 | 行动 | 输出 |
|---|---|---|
| **0. Issue 核实** | 当链接了 GitHub issue 时,先获取并独立核实所报告的问题是否存在。若不存在则停止实现(评论,并仅在结论明确时关闭)。 | 已核实的 issue,或评论以及关闭/保持打开的决定。 |
-| **0b. PR 审查** | 当链接了 GitHub pull request 时,先获取并独立判断原则是否成立。成立则先合入;仅在它进入 `main` 之后开始后续完善。不成立则停止(评论,不重写)。 | 已合入的贡献者 PR 加后续计划,或评论且不合入。 |
+| **0b. PR 审查** | 当链接了 GitHub pull request 时,先获取并独立核实它是否从根上修好所报告的问题、且改动最小。成立才合入;仅在它进入 `main` 之后开始后续完善。不成立则停止(评论,不重写)。 | 已合入的贡献者 PR 加后续计划,或评论且不合入。 |
| **1.分支+工作树** | 保留现有工作,从 `origin/main` 进行更新,并在专用工作树中创建专用请求分支。在安全的情况下重复使用主要结账环境。 | 当前 `main` 上的独立任务文件具有一致的开发环境。 |
| **2.阅读** | 阅读 `00-baseline.md` 以及与变更区域相关的任何规范。 | 约束的心理模型。 |
| **3. Plan** | 描述预期的改变。列出需要更新的每个规范、ADR 和 e2e 场景,并评估是否需要本地验证。 | 变更计划+影响和验证列表。 |
@@ -397,7 +400,7 @@ git branch -d <type>/<short-description>
9. 按用户要求的提交/推送交付已集成到本地 `main`;获得远程交付授权时,PR/MR 已审核并合入远程 `main`,且本地 `main` 包含已落地的变更。
10. 集成后已在 `main` 中确认预期提交,且请求工作树已移除、合并的请求分支已删除。
11. 若链接了 GitHub issue:在实现前已核实该主张;issue 收到以其原文语言撰写的评论;结论明确时已关闭该 issue。
-12. 若链接了 GitHub pull request:已审查原则;原则成立时已先合入;后续完善在合入之后落地;贡献者的工作未被丢掉。
+12. 若链接了 GitHub pull request:已审查根因门槛;仅在真正修好且改动最小时合入;后续完善在合入之后落地;未因细枝末节丢掉贡献者的工作。
### 发布/版本标签门
@@ -433,9 +436,10 @@ D164 与 D260。 GitHub 发行说明并不能替代。
| 在一次提交中混合多个逻辑更改而没有明确的消息 | 历史粒度的损失 |
| 未核实问题是否存在就开始实现链接的 GitHub issue | 违反 R5;把工作浪费在无效或已修复的主张上 |
| 关闭链接的 GitHub issue 时没有以其原文语言撰写的评论 | 违反 R5;没有公开记录处理结果 |
-| 关闭、重写或要求重启原则成立的链接 pull request | 违反 R6;丢掉贡献者的工作 |
-| 仅因缺失规格、测试、风格或智能体工作流完整性而阻止合入原则成立的链接 pull request | 违反 R6;完整性是合入后的后续工作 |
-| 合入原则不成立或引入危害阻塞的链接 pull request | 违反 R6;先合入不适用于不安全或方向错误的改动 |
+| 关闭、重写或要求重启已经根治问题且改动最小的链接 pull request(仅因细枝末节) | 违反 R6;丢掉贡献者的工作 |
+| 仅因缺失规格、额外测试、风格或智能体工作流完整性而阻止合入已根治问题的链接 pull request | 违反 R6;那些是合入后的后续工作 |
+| 合入只是方向正确、仍留下原失败路径、或未经说明就大于最小修复的链接 pull request | 违反 R6;方向正确不够 |
+| 合入引入危害阻塞的链接 pull request | 违反 R6 |
| 为落地链接 pull request 而对贡献者分支 force-push | 违反 R6;落地修复加在作者提交之上 |
| 在不为每个已发货语言更新 `packages/shared/src/changelog.ts` 的情况下标记稳定的应用程序版本 | 违反 D164/D345/发布操作手册;该语言版本的应用内新增功能为空 |
| 在 `README.md` / `README.zh-CN.md` 仍声明旧版本线时标记稳定版本,或用 `--skip-docs-check` 绕过 `scripts/check-release-docs.mjs` | 违反 D260/发布操作手册;已发布文档宣传的版本与实际发布不符 |
@@ -466,5 +470,5 @@ D164 与 D260。 GitHub 发行说明并不能替代。
- [ ] 禁止行为列表涵盖已知的风险领域。
- [ ] `AGENTS.md` 指向此文档、`04-e2e-test-plan.md` 和 `05-change-checklist.md`。
- [ ] 链接的 GitHub issue 必须在实现前核实,然后以其原文语言评论,并在结论明确时关闭。
-- [ ] 原则成立的链接 GitHub pull request 必须先合入,再完善;不得丢掉贡献者的工作。
+- [ ] 链接的 GitHub pull request 只有根治问题且改动最小才可合入;不得因细枝末节丢掉贡献者的工作。
- [ ] 更新所有索引(NAV、交付自述文件、规格自述文件、文档自述文件、董事会)。
diff --git a/docs/zh-CN/spec/06-delivery/05-change-checklist.md b/docs/zh-CN/spec/06-delivery/05-change-checklist.md
index 51f347b2d..1f0033641 100644
--- a/docs/zh-CN/spec/06-delivery/05-change-checklist.md
+++ b/docs/zh-CN/spec/06-delivery/05-change-checklist.md
@@ -30,17 +30,17 @@
当提示包含 GitHub pull request URL 或本仓库中无歧义的 pull request 编号时,必须在重写该变更或开始后续完善之前完成本门禁:
- [ ] 已获取 pull request 的标题、正文、文件、提交、评论、检查、草稿状态、base/head 以及关联 issue。
-- [ ] 已独立判断**原则**(真实且在范围内的问题;方案与基线、安全和架构兼容)。
-- [ ] 未把完整性缺口(规格、测试、i18n、e2e 文档、风格、命名)当作合入阻塞项。
-- [ ] 若原则成立:已先合入该 pull request 并保留贡献者提交;落地阻塞仅在作者工作之上追加了最小提交。
+- [ ] 已独立判断**根因门槛**(真实且在范围内的问题;改动真正从根上消掉该失败路径;diff 是最小一致修复;方案与基线、安全和架构兼容)。
+- [ ] 未把完整性缺口(规格、额外测试、i18n、e2e 文档、风格、命名)当作合入阻塞项,**除非**它们是证明根因修复所必需的。
+- [ ] 若根因门槛成立:已先合入该 pull request 并保留贡献者提交;落地阻塞仅在作者工作之上追加了最小提交。
- [ ] 仅在该 pull request 进入 `main` 之后,才用新的 R4 请求分支和工作树开始后续完善。
-- [ ] 若原则不成立或存在危害阻塞:未合入该 pull request,并已用评论记录证据。未悄悄重做该想法。
+- [ ] 若根因门槛不成立或存在危害阻塞:未合入该 pull request,未以「方向没问题」通过,并已用评论记录证据。未悄悄重做该想法。
- [ ] 除非用户明确要求,否则未合入草稿 pull request。
- [ ] 评论使用该 pull request 的原文语言。
- [ ] 未评论或合入无关 pull request。
- [ ] 未对贡献者分支 force-push。未从 pull request 链接推断无关的远程发布。
-参见 [R6 — 原则没问题的链接 PR 先合入,再完善](/zh-CN/spec/06-delivery/03-ai-development-workflow#r6-—-原则没问题的链接-pr-先合入-再完善)。
+参见 [R6 — 链接 PR 必须根治问题且改动最小才可合入](/zh-CN/spec/06-delivery/03-ai-development-workflow#r6-—-链接-pr-必须根治问题且改动最小才可合入)。
---
@@ -196,6 +196,6 @@
| 9 | PR/MR 合并为 `main`;请求删除工作树和分支 | [R4 — 请求分支 + 工作树 + 合并门](/zh-CN/spec/06-delivery/03-ai-development-workflow#r4-—-请求分支-工作树-合并门) |
| 10 | 磁盘上没有留下合并的工作树; `git worktree list` 没有该请求的过时条目 | [§6.1 合并清理清单](#_6-1-合并清理清单) |
| 11 | 若链接了 GitHub issue:实现前已核实;以其原文语言评论;结论明确时已关闭 | [R5 — 先核实链接的 GitHub issue](/zh-CN/spec/06-delivery/03-ai-development-workflow#r5-—-先核实链接的-github-issue-再回复并关闭) |
-| 12 | 若链接了 GitHub pull request:已审查原则;原则成立时已先合入;后续完善在合入之后;未丢掉贡献者工作 | [R6 — 原则没问题的链接 PR 先合入,再完善](/zh-CN/spec/06-delivery/03-ai-development-workflow#r6-—-原则没问题的链接-pr-先合入-再完善) |
+| 12 | 若链接了 GitHub pull request:已审查根因门槛;仅在真正修好且改动最小时合入;后续完善在合入之后;未因细枝末节丢掉贡献者工作 | [R6 — 链接 PR 必须根治问题且改动最小才可合入](/zh-CN/spec/06-delivery/03-ai-development-workflow#r6-—-链接-pr-必须根治问题且改动最小才可合入) |
如果任何一个门失败,则更改**未完成**。
diff --git a/scripts/check-agent-policy-sync.mjs b/scripts/check-agent-policy-sync.mjs
index fe81f70b9..ba2adffa3 100644
--- a/scripts/check-agent-policy-sync.mjs
+++ b/scripts/check-agent-policy-sync.mjs
@@ -129,6 +129,12 @@ const REQUIRED_ANCHORS = [
id: "specs-stay-synchronized",
anyOf: ["observable behavior changes must update the relevant spec"],
},
+ {
+ id: "pr-root-cause-minimal",
+ anyOf: [
+ "must fix the reported root cause with the smallest coherent change",
+ ],
+ },
];
function requireContains(label, haystack, needle, message) {