From c733d5f26a2e41ba0f9c873099ebe4c0c25bebf1 Mon Sep 17 00:00:00 2001 From: jhfnetboy Date: Thu, 6 Aug 2026 11:25:52 +0700 Subject: [PATCH] =?UTF-8?q?fix(pilot):=20run=20=E7=9A=84=E6=97=A0=E4=BA=BA?= =?UTF-8?q?=E5=80=BC=E5=AE=88=E5=90=88=E5=B9=B6=E6=AD=A5=E9=AA=A4=E8=A1=A5?= =?UTF-8?q?=20--allow-trunk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit run.md 全文没有 --allow-trunk,而 git-guard 对 trunk 型 integration 缺这个 flag 直接 die。也就是说【单主干仓库上 pilot run 走到合并那步 必然 exit 3 停住】—— 而 run.md 开头明写「半夜没人回答」。 Brood 自己就是单主干(.pilot.yml: base_branch=main, integration_branch=main), 所以这条在本仓库当前就生效。照旧文档原样跑: $ git-guard.sh merge-pr 45 --integration main --squash git-guard: BLOCKED: integration 'main' is a trunk branch … rc=3 补上之后走到真正该停的地方: $ git-guard.sh merge-pr 45 --integration main --squash --allow-trunk git-guard: BLOCKED: --allow-trunk: PR #45 reviewDecision is 'CHANGES_REQUESTED', not APPROVED — refusing. #48 刚合入的 doctor 第 4 步会把这种配置判为「合法配置,什么都不缺」, 然后 run 走到合并就断 —— 两份文档各自都对,合起来是断的。 不是放宽:--allow-trunk 仍要求分支保护要求审批 + PR 已 APPROVED + 该分支开启 stale-dismissal(#47 加的),三条任一读不到都 fail-closed。 文档里把这三条前提写明,并指向 SKILL.md §doctor 第 4 步。 来源:PR#48 review 标 Medium,当时判「先于本批 PR 存在、不阻塞」记账, 仓库 owner 复核后要求单独修 —— 它让 pilot 的核心能力(无人值守跑到交付) 在 pilot 自己的仓库上跑不完。 Claude-Session: https://claude.ai/code/session_01CmAW1q62bBtjT99inZeyLk --- plugins/pilot/skills/pilot/phases/run.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/pilot/skills/pilot/phases/run.md b/plugins/pilot/skills/pilot/phases/run.md index 7d8488a..b79eb36 100644 --- a/plugins/pilot/skills/pilot/phases/run.md +++ b/plugins/pilot/skills/pilot/phases/run.md @@ -67,6 +67,8 @@ bash /scripts/check-docs.sh --docs-dir --strict ```bash # bash /scripts/git-guard.sh push # bash /scripts/git-guard.sh merge-pr --integration --squash + # # 单主干仓库(integration_branch == base_branch)必须再加 --allow-trunk,否则被硬拒绝 + # bash /scripts/git-guard.sh merge-pr --integration --squash --allow-trunk ``` (内置 main/master/develop/preview/integration/release/hotfix + .pilot.yml 实际值,前缀匹配。仅当要临时补充 .pilot.yml 之外的分支时,才可选加 `--protect ""`。) @@ -74,7 +76,12 @@ bash /scripts/check-docs.sh --docs-dir --strict 运行 `bash /scripts/pr-monitor.sh`,对我的每个 open PR: - **`decision=APPROVED` 且 checks 通过** → 合并进**集成分支**(不是主干): `bash /scripts/git-guard.sh merge-pr --integration --squash` - (git-guard 会先校验 PR base == `integration_branch`,base 是主干或其它分支会被拒绝;**不加 `--delete-branch`**——远程分支删除统一交给 §合并后的 safe-cleanup,受 `allow_remote_cleanup` 与 dirty-worktree 检查约束)。 + **单主干仓库**(`.pilot.yml` 里 `integration_branch` == `base_branch`,PR 直接开向主干)**必须再加 `--allow-trunk`**: + `bash /scripts/git-guard.sh merge-pr --integration --squash --allow-trunk` + ——不加就会被 git-guard 硬拒绝(`integration '' is a trunk branch`,rc=3),无人值守就停在这一步。 + 它**不是绕过**:仍要求该分支的保护规则要求审批、这个 PR 已 `APPROVED`、且该分支开启了 stale-dismissal, + 三条任一读不到就 fail-closed 拒绝(见 SKILL.md §doctor 第 4 步)。 + (git-guard 会先校验 PR base == `integration_branch`,base 是其它分支会被拒绝;**不加 `--delete-branch`**——分支清理统一交给 §合并后的 safe-cleanup。) 合并后:把对应 Task 在 `tasks.md` 标 `DONE`、更新 `progress.md`,运行 `bash /scripts/safe-cleanup.sh --integration [--protect ""] [--remote-name ] --apply` 清掉本地已合并分支/worktree(**必须显式带上与 `.pilot.yml` 一致的 `--integration`/`--protect`/`--remote-name`,不要依赖脚本猜默认值**;要连带删远程,且 `allow_remote_cleanup: true` 时,再加 `--remote`)。**做完回到主循环顶端,继续下一项。**