Skip to content

feat(brief): 开 PR 前补三行标题/正文语言自检清单 - #18

Merged
onyx-space merged 4 commits into
mainfrom
fm/pr-desc-selfcheck-hard-gate
Sep 13, 2026
Merged

onyx-space merged 4 commits into
mainfrom
fm/pr-desc-selfcheck-hard-gate

Conversation

@onyx-space

@onyx-space onyx-space commented Sep 12, 2026 •

Copy link
Copy Markdown
Owner

队长原话(Intent)

队长口径(2026-09-10 定):自有仓 PR 一律标题中文(保留 conventional 英文前缀)+ 正文中文在上、英文折叠在 <details><summary>English</summary>。

现状:本周同类违规 6 次(firstmate #16/#17、HT #1、elmo-apps #44/#45、passkey #3、pi-ecc-agents #1),每次都由监督侧事后叫回改。简报里其实写了这条契约,但 worker 实际开 PR 时没执行。

改了什么

  • bin/fm-dod-lib.sh 的 PR 描述块在原有 pr-description skill 指针之外,新增「报 PR ready 之前」的自检清单:先判定这次 PR 属于哪一类,再按该类的规则核对 live 的标题与正文,任一为「否」必须在报 ready 前改好。
  • 队长自有仓(GitHub onyx-space/*、内网 Gitea admin/* 与 AI.Buddy/*)适用中文优先契约,逐条自检三问:
    • 标题:conventional commit 前缀之后是中文吗(feat(scope): <中文>)?
    • 正文:中文在折叠之上、打开就能看到吗?
    • 正文:英文正文折叠在 <details><summary>English</summary> 里了吗?
  • 第三方上游仓不适用中文优先契约:按上游自身惯例书写(通常是英文),并且禁止把上游 PR 的标题改成中文。
  • 该块同时由 bin/fm-brief.sh 渲染进 ship brief、由 bin/fm-promote.sh 渲染进 promoted scout 的 ship 指令,两条开 PR 路径都带上自检;local-only 不开 PR,仍不渲染。
  • docs/architecture.md 同步更新该块的职责描述;tests/fm-brief.test.sh 与 tests/fm-task-delivery.test.sh 相应调整断言,覆盖三条自检项、类型分流,并确认 skill 的格式细则与平台命令未被复制进 brief。

风险评估

✅ 低。本次只改一段共享提示词(prompt block)的措辞,另配一句文档说明和相应测试:新增的按类型分流写法与 intent 中「自有仓」的范围一致,也没有偏离单一 owner 的 skill 归属;该段在两条开 PR 路径上都原样渲染,没有改动任何代码路径或控制流。

验证

在隔离的 FM_HOME 里把真实生成器端到端跑了一遍。bin/fm-brief.sh 会把 # PR description 段渲染进 no-mistakes 与 direct-PR 两类 ship brief,内容含:未改动的单一 owner 指针(~/.agents/skills/pr-description/SKILL.md)、报 PR ready 之前的自检门、自有仓三问(conventional 前缀之后是中文标题、中文正文位于折叠之上、英文正文折叠在 <details><summary>English</summary> 内),以及显式的第三方上游分支(never rewrite a third-party upstream PR title into Chinese);local-only 的 brief 不带该段。用 bin/fm-promote.sh 提升一个 scout,再执行它打印出的投递命令:promoted 的 no-mistakes / direct-PR worker 收到同一段,local-only 的收到零段。单一 owner 的守卫成立:brief 里既没有 gh pr edit,也没有 ## 摘要,格式与平台命令仍归 skill 独有。把基线提交单独导出并生成它的 brief,复现了本次改动要补的缺口:指针在,自检与上游分支都不在。两个改动的测试文件都通过。唯一没有实测的环节,是 worker 的 LLM 在真正开 PR 时会不会照做;这属于模型理解范畴,本次改动的确定性提示词策略与 no-mistakes 的测试质量规则都把它挡在实测 CI 之外,而隔离门里也没有可用的、能打真实 PR 端点的 worker 跑。文档(docs/architecture.md)已读过,与新的按类型分流写法一致;lint 与静态检查不在本阶段的边界内。

  • 实测验证:✅ go,8 个场景中 7 个以真实产品跑通。
场景 结果 实测 证据
用 bin/fm-brief.sh 生成 no-mistakes ship brief,会输出 pr-description 指针、自有仓三问,以及第三方上游豁免 ✅ pass live Generated data/brief-prdesc-no-mistakes/brief.md; block in pr-description-selfcheck-live.txt; counts in pr-description-selfcheck-checks.txt (pointer=1, self-check-gate=1, three questions=1 each, own-r…
用 bin/fm-brief.sh 生成 direct-PR ship brief,输出的自检与上面完全一致 ✅ pass live Generated data/brief-prdesc-direct-PR/brief.md; block in pr-description-selfcheck-live.txt; counts in pr-description-selfcheck-checks.txt (same as no-mistakes)
local-only ship brief 不开 PR,因此不带任何 PR-description 段 ✅ pass live Generated data/brief-prdesc-local-only/brief.md contains 0 occurrences of # PR description (pr-description-selfcheck-checks.txt)
用 bin/fm-promote.sh 提升 scout 并执行它打印的投递命令后,promoted 的 no-mistakes / direct-PR worker 收到同一段自检,local-only 收到零 ✅ pass live Captured fm-send.sh payloads payload-promote-dod-{no-mistakes,direct-pr,local-only}; blocks in pr-description-selfcheck-live.txt; counts in pr-description-selfcheck-checks.txt
brief 从不复述 pr-description skill 的平台命令与格式标题,契约仍归 skill 独有 ✅ pass live Live briefs show 0 occurrences of gh pr edit and 0 of ## 摘要 while carrying the pointer and actionable questions (pr-description-selfcheck-checks.txt)
对抗性场景:第三方上游 PR 永不会被要求改成中文标题,输出的 brief 明确禁止改写它的标题 ✅ pass live Both PR-opening briefs contain Third-party upstream repo - the Chinese-first contract does not apply ... never rewrite a third-party upstream PR title into Chinese (pr-description-selfcheck-live.txt…
回归差值:基线提交的 brief 有指针,但没有自检、也没有上游分支,说明本次改动补上了此前缺失的纪律 ✅ pass live Extracted base 47b5518, ran its bin/fm-brief.sh: pointer=1, self-check-gate=0, upstream-branch=0 (pr-description-selfcheck-checks.txt)
worker 读到 brief 后,能否真开出一个合规的自有仓 PR(标题后半句中文、中文正文在折叠之上、英文已折叠) ⏸️ untested no Requires a live firstmate worker run against a real repository with PR-create authority (gh-axi / Gitea token) plus an LLM-interpretation judgment, which the change's own test strategy and no-mistakes…
English

What Changed

  • In bin/fm-dod-lib.sh, the PR-description block now carries a pre-PR self-check alongside the existing pr-description skill pointer: the worker must first classify the PR, then verify the three decisions for that kind - title language, visible body language, and the English fold - fixing any "no" before reporting the PR ready.
  • The self-check is scope-aware: the Chinese-first contract applies to the captain's own repos (GitHub onyx-space/*, internal Gitea admin/* and AI.Buddy/*); a third-party upstream PR is exempt and follows the upstream's own conventions, and its title must never be rewritten into Chinese.
  • The block is still rendered by bin/fm-brief.sh into a ship brief and by bin/fm-promote.sh into a promoted scout's ship instructions, so both PR-opening paths carry the self-check; local-only still renders nothing because it opens no PR.
  • docs/architecture.md is updated to match the block's new ownership prose, and tests/fm-brief.test.sh plus tests/fm-task-delivery.test.sh assert the three decisions, the own-repo/upstream split, and that the skill's format headings and platform commands are not duplicated into the brief.

Risk Assessment

✅ Low: Prose-only change to one shared prompt block plus matching doc sentence and tests: the new scope-aware wording matches the intent's 自有仓 scope and the single-owner skill, and the block renders verbatim on both PR-opening paths with no code path or control flow changed.

Testing

Drove the real generators end-to-end in an isolated FM_HOME. bin/fm-brief.sh emits the # PR description block into no-mistakes and direct-PR ship briefs containing the unchanged single-owner pointer (~/.agents/skills/pr-description/SKILL.md), the PR-ready self-check gate, the three own-repo questions (Chinese title after the conventional prefix, Chinese body above the fold, English body folded in &lt;details&gt;&lt;summary&gt;English&lt;/summary&gt;), and the explicit third-party upstream branch with never rewrite a third-party upstream PR title into Chinese; the local-only brief carries no block. Promoting a scout through bin/fm-promote.sh and executing the delivery command it prints delivers the same block to promoted no-mistakes/direct-PR workers and none to a local-only one. The one-owner guard holds: the briefs contain neither gh pr edit nor ## 摘要, so the skill remains the sole owner of format and platform commands. Extracting the base commit and generating its brief reproduced the gap the change closes: the pointer was present but the self-check and upstream branch were absent. Both changed test files pass. The only undriven part is whether a worker LLM actually obeys the emitted prompt when it opens a PR; that is model interpretation, which the change's own deterministic-prompt strategy and no-mistakes' test-quality rule keep out of live CI, and no live worker run against a real PR endpoint is available in this isolated gate. Docs (docs/architecture.md) were read and match the new scope-aware wording; lint/static checks are outside this phase's boundary.

  • Live validation: ✅ go - 7 of 8 scenarios driven live against the product
Scenario Result Live Evidence
Generating a no-mistakes ship brief with bin/fm-brief.sh emits the pr-description pointer, the three own-repo self-check questions, and the third-party upstream exemption ✅ pass live Generated data/brief-prdesc-no-mistakes/brief.md; block in pr-description-selfcheck-live.txt; counts in pr-description-selfcheck-checks.txt (pointer=1, self-check-gate=1, three questions=1 each, own-r…
Generating a direct-PR ship brief with bin/fm-brief.sh emits the identical scope-aware self-check ✅ pass live Generated data/brief-prdesc-direct-PR/brief.md; block in pr-description-selfcheck-live.txt; counts in pr-description-selfcheck-checks.txt (same as no-mistakes)
A local-only ship brief, which opens no PR, carries no PR-description block ✅ pass live Generated data/brief-prdesc-local-only/brief.md contains 0 occurrences of # PR description (pr-description-selfcheck-checks.txt)
Promoting a scout with bin/fm-promote.sh and running its printed delivery command delivers the same self-check to promoted no-mistakes and direct-PR workers, and none to a local-only one ✅ pass live Captured fm-send.sh payloads payload-promote-dod-{no-mistakes,direct-pr,local-only}; blocks in pr-description-selfcheck-live.txt; counts in pr-description-selfcheck-checks.txt
The brief never restates the pr-description skill's platform command or format headings, so the skill stays the single owner of the contract ✅ pass live Live briefs show 0 occurrences of gh pr edit and 0 of ## 摘要 while carrying the pointer and actionable questions (pr-description-selfcheck-checks.txt)
An adversarial third-party upstream PR is never sent to a Chinese title: the emitted brief explicitly forbids retitling it ✅ pass live Both PR-opening briefs contain Third-party upstream repo - the Chinese-first contract does not apply ... never rewrite a third-party upstream PR title into Chinese (pr-description-selfcheck-live.txt…
Regression delta: a base-commit brief had the skill pointer but no self-check and no upstream branch, so the change adds the previously missing discipline ✅ pass live Extracted base 47b5518, ran its bin/fm-brief.sh: pointer=1, self-check-gate=0, upstream-branch=0 (pr-description-selfcheck-checks.txt)
A worker agent reading the emitted brief actually opens a compliant own-repo PR (Chinese second half in the title, Chinese body above the fold, English folded) ⏸️ untested no Requires a live firstmate worker run against a real repository with PR-create authority (gh-axi / Gitea token) plus an LLM-interpretation judgment, which the change's own test strategy and no-mistakes…
Evidence: Live-generated PR description block for ship briefs and promoted payloads (both PR-opening modes + local-only)

Source: Live-generated PR description block for ship briefs and promoted payloads (both PR-opening modes + local-only)

# Target commit: 060541d64a8e7cac8af21d2310d5d6bdc256ebdc
# Live-generated from bin/fm-brief.sh (FM_HOME isolated) and bin/fm-promote.sh delivery payload

===== SHIP BRIEF ($HOME/data/brief-prdesc-no-mistakes/brief.md) =====
# PR description
Before you write or edit a pull request description, read the `pr-description` skill (`~/.agents/skills/pr-description/SKILL.md`); it is the single owner of that contract.
Do not use `ce-translate` for a PR description.
Before you report the PR ready, self-check the live title and body against that skill's rule for this PR's kind:
- Captain's own repo (GitHub `onyx-space/*`, internal Gitea `admin/*` and `AI.Buddy/*`) - the Chinese-first contract applies; fix any "no" before you report:
  - Title: Chinese after the conventional-commit prefix (`feat(scope): <中文>`)?
  - Body: Chinese visible first, above the fold?
  - Body: the English body folded inside `<details><summary>English</summary>`?
- Third-party upstream repo - the Chinese-first contract does not apply; follow that upstream's own conventions, usually English, and never rewrite a third-party upstream PR title into Chinese.

# Definition of done

===== SHIP BRIEF ($HOME/data/brief-prdesc-direct-PR/brief.md) =====
# PR description
Before you write or edit a pull request description, read the `pr-description` skill (`~/.agents/skills/pr-description/SKILL.md`); it is the single owner of that contract.
Do not use `ce-translate` for a PR description.
Before you report the PR ready, self-check the live title and body against that skill's rule for this PR's kind:
- Captain's own repo (GitHub `onyx-space/*`, internal Gitea `admin/*` and `AI.Buddy/*`) - the Chinese-first contract applies; fix any "no" before you report:
  - Title: Chinese after the conventional-commit prefix (`feat(scope): <中文>`)?
  - Body: Chinese visible first, above the fold?
  - Body: the English body folded inside `<details><summary>English</summary>`?
- Third-party upstream repo - the Chinese-first contract does not apply; follow that upstream's own conventions, usually English, and never rewrite a third-party upstream PR title into Chinese.

# Definition of done

===== LOCAL-ONLY SHIP BRIEF =====
(none) the PR description block is absent from the local-only brief, which opens no PR

===== PROMOTED-SCOUT DELIVERY PAYLOAD (no-mistakes) =====
# PR description
Before you write or edit a pull request description, read the `pr-description` skill (`~/.agents/skills/pr-description/SKILL.md`); it is the single owner of that contract.
Do not use `ce-translate` for a PR description.
Before you report the PR ready, self-check the live title and body against that skill's rule for this PR's kind:
- Captain's own repo (GitHub `onyx-space/*`, internal Gitea `admin/*` and `AI.Buddy/*`) - the Chinese-first contract applies; fix any "no" before you report:
  - Title: Chinese after the conventional-commit prefix (`feat(scope): <中文>`)?
  - Body: Chinese visible first, above the fold?
  - Body: the English body folded inside `<details><summary>English</summary>`?
- Third-party upstream repo - the Chinese-first contract does not apply; follow that upstream's own conventions, usually English, and never rewrite a third-party upstream PR title into Chinese.

# Definition of done

===== PROMOTED-SCOUT DELIVERY PAYLOAD (direct-PR) =====
# PR description
Before you write or edit a pull request description, read the `pr-description` skill (`~/.agents/skills/pr-description/SKILL.md`); it is the single owner of that contract.
Do not use `ce-translate` for a PR description.
Before you report the PR ready, self-check the live title and body against that skill's rule for this PR's kind:
- Captain's own repo (GitHub `onyx-space/*`, internal Gitea `admin/*` and `AI.Buddy/*`) - the Chinese-first contract applies; fix any "no" before you report:
  - Title: Chinese after the conventional-commit prefix (`feat(scope): <中文>`)?
  - Body: Chinese visible first, above the fold?
  - Body: the English body folded inside `<details><summary>English</summary>`?
- Third-party upstream repo - the Chinese-first contract does not apply; follow that upstream's own conventions, usually English, and never rewrite a third-party upstream PR title into Chinese.

# Definition of done

===== PROMOTED-SCOUT DELIVERY PAYLOAD (local-only) =====
(none) promoted local-only worker receives no PR description block
Evidence: Live check matrix: own-repo questions, upstream exemption, local-only absence, single-owner guard, base-commit regression

Source: Live check matrix: own-repo questions, upstream exemption, local-only absence, single-owner guard, base-commit regression

PR self-check live verification (target 060541d, base 47b5518)
date: 2026-09-13T00:29:57Z

--- own-repo self-check + third-party branch reach SHIP briefs ---
no-mistakes  pointer=1 self-check-gate=1 title-q=1 above-fold-q=1 fold-q=1 own-repo=1 upstream-branch=1 never-retitle-upstream=1
direct-PR    pointer=1 self-check-gate=1 title-q=1 above-fold-q=1 fold-q=1 own-repo=1 upstream-branch=1 never-retitle-upstream=1

--- local-only ship brief must NOT carry the block (opens no PR) ---
PR-description block count: 0

--- promoted-scout delivery payload carries the same block ---
no-mistakes  block=1 self-check-gate=1 upstream-branch=1
direct-PR    block=1 self-check-gate=1 upstream-branch=1
local-only   block=0 self-check-gate=0 upstream-branch=0

--- one-owner guard: the skill stays the owner of format/commands ---
no-mistakes  gh-pr-edit=0 format-heading=0
direct-PR    gh-pr-edit=0 format-heading=0

--- regression: BASE brief had the pointer but no self-check ---
base  pointer=1 self-check-gate=0 upstream-branch=0

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 7 of 8 scenarios driven live against the product
Scenario Result Live Evidence
Generating a no-mistakes ship brief with bin/fm-brief.sh emits the pr-description pointer, the three own-repo self-check questions, and the third-party upstream exemption ✅ pass live Generated data/brief-prdesc-no-mistakes/brief.md; block in pr-description-selfcheck-live.txt; counts in pr-description-selfcheck-checks.txt (pointer=1, self-check-gate=1, three questions=1 each, own-r…
Generating a direct-PR ship brief with bin/fm-brief.sh emits the identical scope-aware self-check ✅ pass live Generated data/brief-prdesc-direct-PR/brief.md; block in pr-description-selfcheck-live.txt; counts in pr-description-selfcheck-checks.txt (same as no-mistakes)
A local-only ship brief, which opens no PR, carries no PR-description block ✅ pass live Generated data/brief-prdesc-local-only/brief.md contains 0 occurrences of # PR description (pr-description-selfcheck-checks.txt)
Promoting a scout with bin/fm-promote.sh and running its printed delivery command delivers the same self-check to promoted no-mistakes and direct-PR workers, and none to a local-only one ✅ pass live Captured fm-send.sh payloads payload-promote-dod-{no-mistakes,direct-pr,local-only}; blocks in pr-description-selfcheck-live.txt; counts in pr-description-selfcheck-checks.txt
The brief never restates the pr-description skill's platform command or format headings, so the skill stays the single owner of the contract ✅ pass live Live briefs show 0 occurrences of gh pr edit and 0 of ## 摘要 while carrying the pointer and actionable questions (pr-description-selfcheck-checks.txt)
An adversarial third-party upstream PR is never sent to a Chinese title: the emitted brief explicitly forbids retitling it ✅ pass live Both PR-opening briefs contain Third-party upstream repo - the Chinese-first contract does not apply ... never rewrite a third-party upstream PR title into Chinese (pr-description-selfcheck-live.txt…
Regression delta: a base-commit brief had the skill pointer but no self-check and no upstream branch, so the change adds the previously missing discipline ✅ pass live Extracted base 47b5518, ran its bin/fm-brief.sh: pointer=1, self-check-gate=0, upstream-branch=0 (pr-description-selfcheck-checks.txt)
A worker agent reading the emitted brief actually opens a compliant own-repo PR (Chinese second half in the title, Chinese body above the fold, English folded) ⏸️ untested no Requires a live firstmate worker run against a real repository with PR-create authority (gh-axi / Gitea token) plus an LLM-interpretation judgment, which the change's own test strategy and no-mistakes…
  • FM_HOME=&lt;isolated&gt; bin/fm-brief.sh brief-prdesc-{no-mistakes,direct-PR,local-only} some-proj --mode &lt;mode&gt; and inspection of each generated data/&lt;id&gt;/brief.md
  • FM_HOME=&lt;isolated&gt; bin/fm-promote.sh promote-dod-&lt;mode&gt; --mode &lt;mode&gt; --yolo off then running the printed next: fm-send.sh delivery command against a capturing stub, for no-mistakes, direct-PR and local-only
  • bash tests/fm-brief.test.sh (full file for the changed test)
  • bash tests/fm-task-delivery.test.sh (full file for the changed test)
  • baseline delta: extracted base tree with git archive 47b5518 and ran its bin/fm-brief.sh to confirm the pointer existed without the self-check
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

onyx-space and others added 4 commits September 13, 2026 07:41
本周 6 次同类违规(firstmate #16/#17、HT #1、elmo-apps #44/#45、passkey #3、
pi-ecc-agents #1)的根因不在 worker,而在简报本身:`# PR description` 是第 14/14
段、位于第 110 行(全文 151 行),内容仅两行且只指向 `pr-description` skill,
标题中文/正文中文在上/英文折叠这三个要求**在简报里从未出现**(旧测试甚至用
assert_no_grep 明确禁止它出现),所以没加载该 skill 的 worker 无从遵守。

改法(最小):在 `bin/fm-dod-lib.sh` 的 `fm_pr_description_block`(简报与提升后
worker 的同一 owner)里补三行自检清单,放在「报告 PR ready 之前」这一动作点上:

- Title: Chinese after the conventional-commit prefix (`feat(scope): <中文>`)?
- Body: Chinese visible first, above the fold?
- Body: the English body folded inside `<details><summary>English</summary>`?

不新增脚本/框架、不改交付流程语义:完整格式、翻译规则、各平台命令仍由
`pr-description` skill 单一拥有,简报只补「开 PR 那一刻要做的三个决定」。
测试同步更新:断言三问与折叠标记在两种开 PR 模式下都存在、提升后 worker 同样
收到,并断言简报仍不复制 skill 的平台命令与格式标题(守住单一 owner 边界)。
firstmate 裁定收口:仓内规范要求普通 `-`、不用 em dash,本次改动只涉及
`fm_pr_description_block` 自检块里的两处分隔符(自有仓分支与第三方上游分支
各一处),换掉即可,不新增自动守卫、不顺手全仓替换。纯字符替换,零行为变化。
@onyx-space onyx-space changed the title feat(brief): PR 描述块补按 PR 类型分流的开 PR 前自检 feat(brief): 开 PR 前补三行标题/正文语言自检清单 Sep 13, 2026
@onyx-space

Copy link
Copy Markdown
Owner Author

打回,中文

@onyx-space

Copy link
Copy Markdown
Owner Author

Risk Assessment 后面的中文不合格

@onyx-space
onyx-space merged commit a30e365 into main Sep 13, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant