diff --git a/.claude/agents/os-dev.md b/.claude/agents/os-dev.md index 3270d101648..4bdfd5b4938 100644 --- a/.claude/agents/os-dev.md +++ b/.claude/agents/os-dev.md @@ -44,8 +44,9 @@ model: opus 2. **issue 已由 PM 认领**(大家共享同一 GitHub 身份)。不要动 assignee;若发现与他人在途 工作重复,停下报 `blocked`。**PR 上不是你设置的状态属于另一个 actor——去问,永不去 「纠正」**:共享身份让所有人的写入都像你写的;被改写的 body 只是关于 body 的证据,不证 - 明别的;回退他人的操作——尤其是 ready 翻转——永远轮不到你(把 ready PR 翻回 draft 会 - 一步无声毁掉 auto-merge 与合并队列成员资格)。把意外写进 `summary`,交给 PM 裁决。 + 明别的;回退他人的操作——尤其是 ready 翻转——永远轮不到你(转回 draft 实测两向: + 掉 auto-merge 与队列成员资格,或踢不掉、照样合入 —— 没有一向是好的)。把意外写进 + `summary`,交给 PM 裁决。 3. **范围 = 这张 issue,别无其它。** 顺路撞见的无关缺陷立成新的**无 assignee** issue,列进 `out_of_scope_findings` —— 永不在本 PR 里修。立单纪律:**先搜再立**(关键词 + 文件路径扫 open issues;并行 dev 看不见彼此同一小时立的卡,这一搜只能靠你)—— 通道**先探后选**: diff --git a/.claude/skills/pm-dispatch/SKILL.md b/.claude/skills/pm-dispatch/SKILL.md index 8358ec652ba..33af0b111c8 100644 --- a/.claude/skills/pm-dispatch/SKILL.md +++ b/.claude/skills/pm-dispatch/SKILL.md @@ -62,8 +62,9 @@ fire 一轮烟测,判据取**GitHub 上的产出**;③ 每 fire 一轮:读座位 `state=CLOSED` 按 `updated_at` 降序第一张卡的 `Claim:` session ID —— 第四读免疫标签惯例:不用 `pm:dispatched` 的会话对前三读完全隐形,叠加过期座位贴后与空席同形(实测:一个 16 分钟前还 在一趟合并五个 PR 的会话被读作「清」)。标记可漏写,认领不可省;第三、四读数只**增 -加**自退、永不清座位。四读数皆清,先在座位贴留一行开轮标记(session ID + fire 时刻)再跑 -轮。 +加**自退、永不清座位;两读判「非本 session」把 subagent dev 的同 ID 认领读作本会话在飞、 +不自退,是特意保留的安全方向 —— 同会话 dev 本非互斥对象,甄别靠分支(见「认领」)。 +四读数皆清,先在座位贴留一行开轮标记(session ID + fire 时刻)再跑轮。 ## 全体座位的不变量 @@ -542,16 +543,15 @@ PR 前合一次 main;③ 兄弟卡落地后再合一次;④ 冲突交合并队 ### 认领(先认领后动工) 同账号内的多会话共享 GitHub 身份,assignee 只回答「有 agent 认领了」,回答不了「哪个」—— -认领 -评论承载身份;跨账号只需一条:assignee 不是你 ⇒ 永不碰。选中的单,派发前按序执行**一个 -原子对**: +认领评论承载身份(`mode:subagent` 派发下其身份位是分支,见规则 2);跨账号只需一条:assignee +不是你 ⇒ 永不碰。选中的单,派发前按序执行**一个原子对**: 1. **Assign @me + 状态标签对调**(`pm:dispatched` 与摘 `pm:queue` 同一次标签写入 ——只摘不换留 下的在飞卡会被分诊析取每轮重付全评论读);step 1 之后获得 assignee 的直接弃出本批。 -2. **认领评论**(英文),固定形状;session ID 不可省(共享身份下它是「这个认领是不是我的」唯 - 一答 - 案);**首行以字面 `Claim:` 开头是机器判据**(维护者 2026-08-11 裁定;巡查谓词只认这一个拼写 - 且保持严格,修法是全舰队向文档拼写收敛,⛔ 不放宽谓词): +2. **认领评论**(英文),固定形状;session ID 不可省,但 `mode:subagent` 的 dev 与 PM 同会话、同 + ID(实测),甄别身份是**分支** —— 评论对买到「dev 跑过、在哪条分支」,`mode:cloud` 才额外 + 买到「哪个会话」;**首行以字面 `Claim:` 开头是机器判据**(维护者 2026-08-11 裁定;巡查谓词 + 只认这一个拼写且保持严格,修法是全舰队向文档拼写收敛,⛔ 不放宽谓词): > Claim: PM loop round N > Session: `session_` @@ -644,11 +644,9 @@ suggestion 行是输入不是决定,不采纳给理由。 要赔一次往返、且指望 dev 敢跟派发者争(实测:一句「会截断数据」的栅栏,那条路径上每 一列其实都是空的)。**人工地板栅栏**(挡在维护者该做的决定之外)关于流程不关于代 码,免测量。 -- **派发令必须要求 dev 留自己的认领评论**(其**本身**的 session ID + 分支,在 PM 那条**之外**) - —— 共享身份下 assignee 只说「有人认领了」,分得清「谁」的只有评论,而 PM 那条标识的 - 是 PM 会话、不是写代码的那个。「已认领、别动 assignee」⛔ 收窄到**恰好 assignee 这个字 - 段**:它读起来像「认领协议已满足」,那是另一句话且可能是假的(实测:被这么告知的卡当 - 时无 assignee、无认领评论、无分支)。 +- **派发令必须要求 dev 留自己的认领评论**(其**本身**的 session ID + 分支,在 PM 那条**之外**; + 身份语义见「认领」规则 2)。「已认领、别动 assignee」⛔ 收窄到 assignee 字段本身:「认领协议 + 已满足」是另一句话且可能是假的(实测:被这么告知的卡 assignee、认领评论、分支三者皆无)。 - **触 `skills/**`(对外发布的技能包)的卡,派发词必带 PM 定的净增行数预算**(按 feature 大小 定,小功能给小数);dev 装不下 ⇒ 停手回报,⛔ 不自行扩写、不自行抬预算(抬预算是维护者 裁决)。 @@ -758,10 +756,13 @@ issue 上(不能合 ≠ 不复核;技能面 PR 的复核席须跑在契约复审 draft PR 上 **request review `os-zhuang`**(维护者 2026-08-19:「还是应该在 pr 的审核流程,发给 os-zhuang 审核。我的手机github 应该会收到推送消息吧」;当日实测 draft 可点名审核且推送到达手机, 维护者确认「推送到了」;推送通道仅此一条,同日裁定:「只有需要我审核的pr 推给我。」)—— 「等人 -合」清单从此活在 GitHub 的 Review-requested 队列,合并自动消项。**能请审则请审;PR 作者身份即 os-zhuang 的席位,请审必失败**(GitHub 拒绝向 PR 作者请审,author-identity 422)—— 改为把 PR **assign 给 os-zhuang** 替代通知,并在轮次报告点名说明走了 assignee 兜底;④ 轮次报 -告单列「awaiting a human merge」(「等人来合」与「被忘了」在 GitHub 上长得一模一样)。混 -合 diff 一条命中就分叉,⛔ 不按比例判;要拆就让 dev 单独开 PR;已入队才读到本条 ⇒ 撤回 -只有转 draft。**skills 车道自有 PR 再按 diff 内容分流**(维护者 2026-08-26 裁定,原话:「skills 中的 +合」清单从此活在 GitHub 的 Review-requested 队列,合并自动消项。**能请审则请审;PR 作者身份即 os-zhuang 的席位,请审必失败**(GitHub 拒绝向 PR 作者请审,author-identity 422)—— 改为把 PR **assign 给 os-zhuang** 替代通知,并在轮次报告点名说明走了 assignee 兜底。 +**MCP 请审必显式带 `draft: true`**:`update_pull_request` 不管传不传都发送 draft 位,一次只传 +reviewers 的请审曾把治理面 draft 静默转正入队;门开席位改走载荷无 draft 位的专用 REST 请审 +端点(事实行与踢队读数住 platform-readings);④ 轮次报告单列「awaiting a human merge」(「等人来 +合」与「被忘了」在 GitHub 上长得一模一样)。混 +合 diff 一条命中就分叉,⛔ 不按比例判;要拆就让 dev 单独开 PR;已入队才读到本条 ⇒ 转 draft +与 disable 都做再验队列 ref(转 draft 单独不可靠,两向相反实测住 platform-readings)。**skills 车道自有 PR 再按 diff 内容分流**(维护者 2026-08-26 裁定,原话:「skills 中的 pr,只有包含md文件时需要推给我审核,其他代码文件你直接自己审核。」):diff 含任一 `.md` 文件 ⇒ 上述终局四件套照旧;纯代码面(`scripts/pm/` 工具、`.claude/` hooks/workflows/settings、`skills/**` 非 md 产物)⇒ skills 席按契约复审档自审(清单不减)后直接落地(ready → 入队),⛔ 不推维护者;分 diff --git a/.claude/skills/pm-dispatch/references/platform-readings.md b/.claude/skills/pm-dispatch/references/platform-readings.md index f6ee1ca812d..543c5e54321 100644 --- a/.claude/skills/pm-dispatch/references/platform-readings.md +++ b/.claude/skills/pm-dispatch/references/platform-readings.md @@ -5,11 +5,10 @@ ## 队列成员资格与 auto-merge -- **「本仓是否强制队列」是仓库 ruleset 事实**:`grep merge_group` 答的是另一个问题 (队列内是 - 否重跑 CI),两者独立、缺席不构成反证(实测:某仓 ruleset 强制而无 trigger,队列照收 PR、由 PR - 上下文的 check run 满足);权威读数 = 合并尝试本身(回 405 - `Changes must be made through the merge queue`)或 rulesets API;姊妹仓不一致(objectos 2026-08-18 起有队 - 列,hotcrm 只有 ruleset)⇒ 新仓落地约定靠实测确立,⛔ 不由缺席推断(2026-08-20 实测)。 +- **「本仓是否强制队列」是仓库 ruleset 事实**:`grep merge_group` 答的是另一个问题(队列内是否 + 重跑 CI),两者独立、缺席不构成反证(实测:某仓 ruleset 强制而无 trigger,队列照收 PR);权威读 + 数 = 合并尝试本身(回 405 `Changes must be made through the merge queue`)或 rulesets API;姊妹仓不一 + 致(objectos 2026-08-18 起有队列,hotcrm 只有 ruleset)⇒ 新仓靠实测,⛔ 不由缺席推断(2026-08-20)。 - 判「在不在合并队列」看 timeline 事件 `added_to_merge_queue`(REST `GET /repos/{owner}/{repo}/issues/{pr}/timeline`),⛔ 不看 `auto_merge` 字段 —— 入队后它回落为 off,零 信息量(维护者 2026-08-11 裁定)。队列分支(ls-remote 拼写见「零成本等价物」)正命中即已入 @@ -22,32 +21,38 @@ 交**,`git merge-base --is-ancestor origin/main` 对已完全合入的 PR 答 NO(非浅检出),而同 一 PR 的 `list_pull_requests` 实测回过自相矛盾的行:`merged: false` 与 `merged_at` 有值并存 —— 只读布尔的一切判据把已落地读成「没合」(2026-08-23 落地时刻实测)。 -- **`mergeable_state` 惰性计算**:首次 GET 可能回 `unknown` —— 重读一次拿真值; `dirty` 即队列入 - 口否决(冲突对象是**当前** main);draft PR 恒回 `draft` (「draft+clean」组合不存在);本地试合并 - 随 fetch 老化,该字段不老化。只在入队决策点 `get` 一次:挂了 flip 定点(landing-operations)就到 - 点再读,⛔「又查又等」双份支出。 +- **`mergeable_state` 惰性计算,`unknown` 不是读数**(2026-08-25 实测:头已 dirty 的 PR 整窗答 + unknown,席位误读「auto-merge 被清」在脏头上重挂 —— 挂 unknown = 挂在可能脏的头上);`dirty` + 即队列入口否决(冲突对象是**当前** main);draft PR 恒回 `draft`;判头脏的决断读数是零配额本 + 地试合并:fetch PR ref 后 `git merge-tree --write-tree origin/main `(冲突文件直接列出;随 fetch + 老化,重跑先 fetch;与 enable 序列的队列 ref/update-branch 探针互补,彼答入队与暗冲突、此在挂 + 前答头脏)。入队决策点才 `get` 一次:挂了 flip 定点(landing-operations)到点读,⛔ 不又查又等。 - **状态核验用最小字段**(search/list + `fields`)或等事件,整对象 `get` 留给入队决策点;门禁放行 判据 = 承载门禁族 job 的 conclusion,聚合(`blocked`/`dirty`)只作阴性筛查再定位,放行按名定向读 单条 job,⛔ 不拉全表(按名定位失败才拉)。 -- **PR 转回 draft 同时掉 auto-merge 与队列成员资格,均不自动恢复**(转正后重新挂);要真踢出队 - 列只有转 draft —— `disable_pr_auto_merge` 单独调用**不解除队列成员资格**,PR 照样落地。 -- **undraft 的可用路径只有 MCP 一条**:`update_pull_request` 传 `draft: false` 落地(2026-08-24 三张 PR 逐 - 张回读确认);**裸 GraphQL 会话内被拒**(回「only the pinned set of PR-review operations is served」,它建 - 议的「改用 REST」对 undraft **是错的**);**裸 REST `PATCH /pulls/{n}` 传 `draft: false` 回 200 而无操 - 作**。⚠️ 与探针无关,是接口自身性质 ⇒ undraft 没有 REST 对应物,池为 0 时只能等重置。 -- **`enable_pr_auto_merge` 一律显式传 `mergeMethod: "SQUASH"`**(不传时静默退回被禁的 merge-commit 方式 - = 无操作),但**该参数本身实测惰性** —— 传 SQUASH 后 REST 回读 `auto_merge.merge_method` 仍是 - `merge`(2026-08-24 两张 PR、其中一张 disable→enable 复验同值)⇒ ⛔ 不为它翻转空转;**在本仓无 - 害**:合并由队列执行、方法归队列,本仓 `allow_merge_commit:false`,落地无一例外单亲 - squash。**回显两向不可靠,空回显≠未挂上**(实测:队列路径回显空字段而入队照发、正常落 - 地;显式传 SQUASH 回显 `MERGE`,落地仍每 PR 一提交)⇒ ⛔ 不拿回显当任何方向的证据 —— - 「空字段 = 静默空转签名」的旧读法已被推翻,权威信号见下两条。 +- **转 draft 不是可靠的踢队手段 —— 两向都有实测,处置按最坏走**:本仓测得转 draft 同时掉 + auto-merge 与队列成员资格(均不自动恢复,转正后重新挂);objectui 2026-08-25 测得相反 —— 已入 + 队 PR 转 draft 后条目保位、~40 分钟后队列照样合并,彼时 `disable_pr_auto_merge` 已拒绝(仓别/时 + 机差异未分辨)。共同支持的补救:转 draft + disable 都做(本仓测得 disable 单独不踢队、objectui + 彼时径直拒绝),**验队列 ref 与未落地**(拼写见「零成本等价物」),⛔ 不据单读数报补救。 +- **`update_pull_request` 不管传不传都发送 `draft` 位 ⇒ 对 draft PR 的任何调用必须显式带 + `draft: true`**(reviewers/title/body/labels 单字段调用同坑;objectui 2026-08-25 实测:一次只传 + reviewers 的请审把治理面 draft 发布进合并队列,后果见上条);请审免碰 draft 位的专用路 = REST + `POST /pulls/{n}/requested_reviewers`(文档载明、未实测:载荷只有 reviewers/team_reviewers;门开席位优 + 先,MCP-only 席才用 update + 显式 `draft: true`)。undraft 可用路径只有 MCP 这条:传 `draft: false` + 落地(2026-08-24 三张 PR 逐张回读确认);**裸 GraphQL 会话内被拒**(回「only the pinned set of + PR-review operations is served」,它建议的「改用 REST」对 undraft **是错的**);**裸 REST + `PATCH /pulls/{n}` 传 `draft: false` 回 200 而无操作** —— 接口性质 ⇒ 池 0 只能等重置。 +- **`enable_pr_auto_merge` 一律显式传 `mergeMethod: "SQUASH"`**(不传时静默退回被禁的 merge-commit = + 无操作);**回显两向不可靠,空回显≠未挂上**:传 SQUASH 后回读 `auto_merge.merge_method` 仍 + `merge`(2026-08-24 两张 PR、一张 disable→enable 复验同值)、队列路径回显空字段而入队照发,落 + 地仍无一例外单亲 squash(方法归队列,本仓 `allow_merge_commit:false`)⇒ ⛔ 不拿回显当任何方向 + 的证据、不为它翻转空转;「空字段=静默空转签名」旧读法已推翻,权威信号见下两条。 - **配额枯竭时 `enable_pr_auto_merge` 回成功而挂载根本没发生**(实测:一次「成功」后 2.5 小时 - 零动静,同期别的 PR 正常合入;配额恢复后同一调用 ~1 分钟内落地)⇒ **验效果,不验回 - 应**:按下条序列以队列分支 / timeline 入队事件确认,⛔ 不拿成功报文收工。「回读 - `auto_merge` 非空」本接口给不了:`pull_request_read` 与 `fields` 枚举都无该成员(armed 与未 armed - 读回逐字节相同)⇒ 效果读数只有队列分支、timeline 入队事件、最终落地三种。已死假说: - auto-merge 不会在已绿 PR 上静默空转(恢复窗口里两个全绿 PR 挂上即合)。 + 零动静,同期别的 PR 正常合入;配额恢复后同一调用 ~1 分钟内落地)⇒ **验效果,不验回应**, + 按下条序列以队列分支/timeline 入队事件确认,⛔ 不拿成功报文收工;回读 `auto_merge` 非空 + 本接口给不了(`pull_request_read` 与 `fields` 枚举都无该成员,armed 与否读回逐字节相同)⇒ 效果 + 读数只有队列分支、timeline 入队事件、最终落地三种;已死假说:已绿 PR 会静默空转。 - enable 后的验证序列(2026-08-25 增补):① 先验队列分支 `git ls-remote origin 'refs/heads/gh-readonly-queue/*'`(零配额,给条目 ~20–30s 建出;正命中即已入队, 在 PR 读数发僵时仍决断 —— 实测人工合并后 PR 照答 open/merged:false 达 ~15 分钟,队列 ref @@ -113,10 +118,9 @@ - **两个「瘦身参数」都不省池**:`fields` 省载荷不省池 —— MCP list/search 服务器端无条件抓 Project field_values,池枯竭时**最小字段请求同样全体失败**(报错串 `failed to fetch issue field values: API rate limit already exceeded`);⛔ **`minimal_output: true` 不裁 - `list_issues` 的 `body`**(2026-08-22 实测:返回字段仍含 `body`,首条 3258 字符仍超单次工具输出上 - 限被落盘)—— 工具描述的反向暗示为假,**永不当省额度手段写进任何 skill**;没有参数能 - 关掉 `body`:要么接受整表 107 点,要么换窄接口(点数未测)。⚠️ 站得住的证据是直接观察 - `body` 在,不是前后体积对比(两次调用相隔数小时、population 已变)。 + `list_issues` 的 `body`**(2026-08-22 实测:返回字段仍含 `body`),**永不当省额度手段写进任何 + skill**;没有参数能关掉 `body`:要么整表 107 点要么换窄接口(点数未测)。⚠️ 站得住的证据 + 是直接观察 `body` 在,不是前后体积对比(两次调用相隔数小时、population 已变)。 - **git 先行**:本地检出 / `git log` / `ls-remote` 不花配额,断粮期分支存在性检查照常可用,PR 文 件读取同走 git(REST PR files 端点实测可瞬态 404)。**零成本等价物四条**(API 两次挂掉期间实 测可用):合并队列 `git ls-remote origin 'refs/heads/gh-readonly-queue/*'`;是否落地 @@ -127,8 +131,7 @@ 再派 —— 中途撞限流的 dev **完不成强制查重**,只能把发现交回 PM 代为归档,⛔ 不盲目开 卡。打满时:待执行写**排成有序清单挂进巡逻词**(不靠记忆),恢复窗口按序连清;重试对齐 整点(REST core 整点重置)优于指数退避,⛔ 绝不忙轮询;search 与 core 独立计,一侧打满另一侧 - 可作退路;REST core 共享身份下同样会打满;文档载明、未实测:条件请求答 `304` 不计 core - 池。 + 可作退路;REST core 共享身份下同样会打满;文档载明未实测:条件请求答 `304` 不计 core 池。 - **公开仓零配额读法两档,payload 档优先**:单卡页 `/issues/N` 内嵌 JSON 载**原始 body + 全评 论**,精确、零配额 —— 取含 `bodyHTML` 的 `script[type="application/json"]` 块,读 `payload.preloadedQueries[0].result.data.repository.issue.body` 与 `frontTimelineItems`/`backTimelineItems`; @@ -149,13 +152,10 @@ 按右尺寸规则;`GET /search/issues` **不是**退路 —— 出口代理按设计只放 repo-scoped 路径),403 走降级梯 MCP 档(单标签一次读全 + 本地求交 —— ⛔ **不是翻页手扫**:极易半途而废,实测 226 张 open 只扫了 100 张,**不完整枚举比零结果更危险**)。⛔ 已推翻的候选机理别再追: - 「限定符打零」两次实测反证(带 `repo:` 的控制词回 5;`is:open` 对照回 1 精确命中),限定符 - 只**收窄**不破坏;归零机理仍未定(scope 过滤层静默清空 / search 桶 403 被吞成空结果),要定 - 它须在复现会话里抓原始响应。 + 「限定符打零」两次实测反证,限定符只收窄不破坏;归零机理未定,定它须抓原始响应。 - **`search_issues` 不可靠地返回分钟级新卡**:同轮发现的东西查重,搜索之外必须按创建时间列 - 近期 issue(`list_issues` + `orderBy: CREATED_AT`)—— 实测一张 ~7 分钟大的同实例卡被关键词与语 - 义搜索双双漏掉,靠按日期列表才逮到;边界:两次观察,断言只到「search 可能漏掉分钟级 - issue」(2026-08-20 实测)。 + 近期 issue(`list_issues` + `orderBy: CREATED_AT`)—— 实测一张 ~7 分钟大的同实例卡被关键词与 + 语义搜索双漏,靠日期列表才逮到;边界:两次观察,断言只到可能漏分钟级(2026-08-20 实测)。 - **会话中途轮换凭据把 GitHub MCP 服务器杀到不可恢复**:此后一切 `mcp__github__*` 回 `Streamable HTTP error: invalid session`,只有新会话重绑 —— 轮换前提醒维护者:在飞席位丢整条 GitHub 通道;配额池按身份计,换身份即清零燃烧,共享身份结构不变。 diff --git a/scripts/pm/check-half-states.mjs b/scripts/pm/check-half-states.mjs index 247f33f1ecd..78b3d454778 100644 --- a/scripts/pm/check-half-states.mjs +++ b/scripts/pm/check-half-states.mjs @@ -6029,6 +6029,165 @@ export function h35GateRemovalWithoutEvidence(removal, gateEvents, options = {}) return null; } +// --------------------------------------------------------------------------- +// H36 — two open PRs holding the same changed file, one side already ACCEPTED +// or armed (#12286). +// +// ## The incident, and what exactly went unheld +// +// Two open PRs edited one runtime source file across lanes for ~4h. The +// later-opened one merged first; the earlier — reviewed, ACCEPTED, 32/32 +// checks green — was left in a silent merge conflict. Nothing mechanical +// objected, and the single-claim gate was RIGHT not to: its header forbids +// per-incident growth of `SINGLE_CLAIM_PATHS`, and its declared scope held. +// What is unheld is LEGIBILITY: the same-file fence lives in a claim comment +// in one lane's thread, so a second seat that never asks the cross-lane +// question gets no signal from anywhere. The platform volunteers nothing +// either: `mergeable_state` stayed `unknown` throughout (computed lazily), so +// the seat's first reading was wrong and it armed auto-merge on a dirty head. +// +// ## What this row is — patrol INPUT, never a verdict +// +// A pair sharing a changed file is often perfectly fine (the incident's own +// two sides were additive and semantically safe). The row does not judge the +// pair; it makes the hold visible on the anchor every seat already reads, so +// the cross-lane walk the claim shape requires has a mechanical backstop for +// the case where a seat skipped or misjudged it — which is exactly the +// two-possibility fork the incident could not distinguish after the fact. +// Report-only like everything here: the remedy is a PROBE — fetch the PR ref, +// `git merge-tree --write-tree` against today's main answers "would this land +// clean" for free — never a label and never a gate. +// +// ## Why "ACCEPTED/armed" gates the row +// +// A pair of unarmed drafts is ordinary concurrent work-in-progress; the walk +// at their own dispatch time is the instrument for that. The board state +// worth a standing row is the incident's: a side that is DONE — ready +// (= reviewed by construction here: dev PRs flip ready only at review +// ACCEPT) or armed — can be silently passed by the other side landing first, +// after which every proxy signal reads healthy while it rots. `auto_merge` +// is read in the finding-INCREASING direction only, H16's argument exactly: +// arming resolves no conflict, so an armed side is more at risk, not handled. +// +// ## The noise floor is CLOSED, and argued from the single-claim gate's data +// +// That gate's header measured shared-changed-path collisions over ~650 PRs: +// the top repo-wide pairs are the lock file (33), a plugin manifest (21) and +// the root manifest (15) — ordinary concurrent work in a repo taking ~18 +// merges a day. Pairing on those would put a row on the anchor every sweep +// and bury the one that matters. So exactly two spellings are excluded, both +// shared BY CONSTRUCTION, and the closed set is pinned by the self-test +// against per-incident growth (the discipline `SINGLE_CLAIM_PATHS` applies +// to itself): the pnpm lockfile (touched by any PR moving dependencies, and +// merged mechanically) and `.changeset/` (every PR ADDS a uniquely-named +// file there — a collision on one is not a source-file hold). +// `changeset-release/*` PRs are excluded as CANDIDATES for the matching +// reason: the Version Packages PR consumes every changeset file on the +// board, so it would pair with essentially every open PR, and it is +// regenerated from `main` on every push — it holds nothing. +// +// ## Bounded, and bounded honestly +// +// The files fetch is ONE page per candidate, candidates being the open PRs +// this sweep already listed — bounded by the open population (~19 at the +// reading this landed on). A PR with more changed files than the page has +// the tail unread: that can only MISS a pair, never invent one, and both the +// summary line's `read X of Y` and a per-row truncation sentence say so. +// Positive evidence only — this row never asserts "no overlap". +// --------------------------------------------------------------------------- + +/** The closed noise floor — exact spellings, then prefixes. See the banner. */ +export const H36_SHARED_PATH_NOISE = Object.freeze(['pnpm-lock.yaml']); +export const H36_SHARED_PREFIX_NOISE = Object.freeze(['.changeset/']); +export const H36_FILES_PAGE_SIZE = 100; +export const H36_SAMPLE_PATHS = 3; + +export function h36NoisePath(path) { + const p = String(path ?? ''); + if (H36_SHARED_PATH_NOISE.includes(p)) return true; + return H36_SHARED_PREFIX_NOISE.some((prefix) => p.startsWith(prefix)); +} + +/** ACCEPTED (ready = reviewed by construction) or armed — the at-risk side. */ +export function h36AcceptedOrArmed(pr) { + if (!pr) return false; + return pr.draft === false || pr.auto_merge != null; +} + +/** + * Whether this open PR is worth a files page — the gathering policy, H16's + * idiom: answerable from the LIST row alone, and never NARROWER than the + * predicate's population. A pair needs one accepted/armed side, but the + * OTHER side can be any open PR (a draft included — the incident's second + * side was one when the window opened), so every open PR outside the + * changeset-release exclusion is a candidate. + */ +export function h36NeedsFiles(pr) { + if (!pr || pr.merged_at) return false; + return !String(pr.head?.ref ?? '').startsWith('changeset-release/'); +} + +/** The all-failed transport judgement — H16's, verbatim in shape. */ +export function h36DetailPassUnreadable(candidates, probed) { + return (candidates ?? 0) > 0 && (probed ?? 0) === 0; +} + +/** + * The pair rows. `filesByPr` maps PR number → `{ paths, truncated }`; a PR + * absent from the map was unread (a failed page) and simply cannot pair — + * the coverage pair reports that shortfall, and a missed pair is the only + * possible consequence. One row per PAIR, keyed to the accepted/armed side + * (both accepted: the earlier-created one), because that is the side that + * silently rots when the other lands first; the other side is named in the + * sentence. + */ +export function h36SharedFileHolds(openPrs, filesByPr) { + const rows = []; + const prs = (openPrs ?? []).filter((pr) => h36NeedsFiles(pr)); + prs.sort((a, b) => String(a.created_at ?? '').localeCompare(String(b.created_at ?? ''))); + for (let i = 0; i < prs.length; i++) { + for (let j = i + 1; j < prs.length; j++) { + const a = prs[i]; + const b = prs[j]; + if (!h36AcceptedOrArmed(a) && !h36AcceptedOrArmed(b)) continue; + const fa = filesByPr?.get?.(a.number); + const fb = filesByPr?.get?.(b.number); + if (!fa || !fb) continue; + const inB = new Set((fb.paths ?? []).filter((p) => !h36NoisePath(p))); + const shared = (fa.paths ?? []).filter((p) => !h36NoisePath(p) && inB.has(p)); + if (shared.length === 0) continue; + const key = h36AcceptedOrArmed(a) ? a : b; + const other = key === a ? b : a; + const state = + key.auto_merge != null + ? key.draft === false + ? 'ready AND armed' + : 'armed' + : 'ready (reviewed by construction)'; + const sample = shared + .slice(0, H36_SAMPLE_PATHS) + .map((p) => `\`${p}\``) + .join(', '); + const more = shared.length > H36_SAMPLE_PATHS ? `, +${shared.length - H36_SAMPLE_PATHS} more` : ''; + const truncated = + fa.truncated || fb.truncated + ? ' One side\'s file list was TRUNCATED at the page size, which can only have hidden MORE overlap.' + : ''; + rows.push([ + key, + `open and ${state}, sharing ${shared.length} changed file(s) with open PR #${other.number} ` + + `(${sample}${more}) — a cross-lane same-file hold made visible: the fence otherwise lives ` + + 'only in one lane\'s claim comment, and `mergeable_state` volunteers nothing (`unknown` is ' + + 'not a reading). Patrol input, NOT a verdict — both sides may be additive and disjoint. ' + + 'Whichever lands second re-probes before (re-)arming: fetch the PR ref and run ' + + '`git merge-tree --write-tree` against current `main` — the zero-quota reading GitHub ' + + `never volunteers.${truncated}`, + ]); + } + } + return rows; +} + // --------------------------------------------------------------------------- // Report rendering — pure over (findings, counts), so `--self-test` pins both // media offline. The live sweep below picks a renderer and prints it; nothing @@ -6135,6 +6294,8 @@ export function isUnjudgedFinding(message) { export const SWEEP_COUNT_KEYS = [ 'conflictCandidates', 'conflictProbed', + 'sharedFileCandidates', + 'sharedFileProbed', 'fallbackCandidates', 'fallbackProbed', 'restartCandidates', @@ -6304,6 +6465,9 @@ export function summaryLine(counts, findingCount) { 'quiet H35 section here is a short read, not a clean board.' : '.' } ` + + `Shared-file holds (H36): changed-file page read on ${counts.sharedFileProbed ?? 0} of ` + + `${counts.sharedFileCandidates ?? 0} open PR(s) — a pair needs both sides read, so a shortfall ` + + 'can only MISS a hold, never invent one. ' + `Report-only: findings are patrol input, not a gate verdict.` ); } @@ -7097,6 +7261,11 @@ async function sweep(options = {}) { const stats = { conflictCandidates: 0, conflictProbed: 0, + // H36's coverage pair (#12286) — open PRs whose changed-file page this + // sweep owes, and how many pages actually answered. Same per-row failure + // mode as H16's detail pass, so it owes the same `read X of Y`. + sharedFileCandidates: 0, + sharedFileProbed: 0, fallbackCandidates: 0, fallbackProbed: 0, // H9's coverage pair — `pm:on-hold` cards whose verdict the comment @@ -7763,6 +7932,36 @@ async function sweepInto(findings, seen, seenPrs, seenMerged, seenUnscoped, seen throw lastDetailError; } + // H36 (#12286) — the shared-file pass, H16's transport posture over one + // changed-file page per open PR (the population this sweep already listed; + // gathering policy at `h36NeedsFiles`). A failed page drops that PR out of + // the pairing — a MISS, never an invention — and the summary's `read X of Y` + // says so; all-failed is the transport, not a clean board (#4690). + let lastFilesError = null; + const filesByPr = new Map(); + for (const pr of seenPrs.values()) { + if (!h36NeedsFiles(pr)) continue; + stats.sharedFileCandidates = (stats.sharedFileCandidates ?? 0) + 1; + let page; + try { + page = await rest(`/repos/${OWNER_REPO}/pulls/${pr.number}/files?per_page=${H36_FILES_PAGE_SIZE}`); + } catch (err) { + lastFilesError = err; + continue; + } + stats.sharedFileProbed = (stats.sharedFileProbed ?? 0) + 1; + filesByPr.set(pr.number, { + paths: (Array.isArray(page) ? page : []).map((f) => String(f?.filename ?? '')), + truncated: Array.isArray(page) && page.length >= H36_FILES_PAGE_SIZE, + }); + } + if (h36DetailPassUnreadable(stats.sharedFileCandidates, stats.sharedFileProbed)) { + throw lastFilesError; + } + for (const [pr, hold36] of h36SharedFileHolds([...seenPrs.values()], filesByPr)) { + findings.push([pr, 'H36', hold36]); + } + // H8 — one bounded merged-PR listing (window note at the helper), matched // against the already-collected open `pm:dispatched` cards; no per-card fetch. // @@ -11840,6 +12039,77 @@ function selfTest() { // Absent counts degrade to 0, never to `undefined` — H32's pair does the same. t('H35 summary: absent counts degrade to 0', summaryLine({}, 0).includes('0 removal(s) of a gate-semantic label'), true); + // -- H36 — cross-lane same-file holds (report-only patrol input, #12286) --- + const h36pr = (number, opts = {}) => ({ + number, + created_at: opts.created_at ?? '2026-08-25T10:00:00Z', + draft: opts.draft ?? true, + auto_merge: opts.auto_merge ?? null, + merged_at: opts.merged_at ?? null, + head: { ref: opts.ref ?? `claude/issue-${number}-x` }, + html_url: `https://example.test/${number}`, + }); + const h36files = (entries, truncated = []) => + new Map( + Object.entries(entries).map(([n, paths]) => [ + Number(n), + { paths, truncated: truncated.includes(Number(n)) }, + ]), + ); + const h36rows = (...args) => h36SharedFileHolds(...args); + // The wrapper discipline the row-text wrappers at the top explain: a nulled + // first row must report as red CASES, never abort the suite in argument + // evaluation. The count assertions stay on `h36rows` directly. + const h36row1 = (...args) => String(h36SharedFileHolds(...args)[0]?.[1] ?? ''); + const h36key1 = (...args) => h36SharedFileHolds(...args)[0]?.[0]?.number ?? null; + const readyEarly = h36pr(100, { draft: false }); + const draftLate = h36pr(200, { created_at: '2026-08-25T11:00:00Z' }); + const sharedAuto = h36files({ + 100: ['packages/runtime/src/domains/automation.ts'], + 200: ['packages/runtime/src/domains/automation.ts', 'docs/x.md'], + }); + // ⭐ THE FINDING — the incident's own shape: an accepted side and any other + // open PR holding one source file. + t('H36: ready + draft sharing a source file -> one row', h36rows([readyEarly, draftLate], sharedAuto).length, 1); + t('H36: …keyed to the accepted side', h36key1([readyEarly, draftLate], sharedAuto), 100); + t('H36: …naming the other side', h36row1([readyEarly, draftLate], sharedAuto).includes('#200'), true); + t('H36: …and the shared path', h36row1([readyEarly, draftLate], sharedAuto).includes('automation.ts'), true); + t('H36: …and states the non-verdict posture', h36row1([readyEarly, draftLate], sharedAuto).includes('NOT a verdict'), true); + t('H36: …and the remedy is the local probe', h36row1([readyEarly, draftLate], sharedAuto).includes('merge-tree'), true); + // The gate on the row: some side must be DONE. + t('H36: two unarmed drafts -> silent (the dispatch-time walk owns that case)', h36rows([h36pr(100), draftLate], sharedAuto).length, 0); + t('H36: an ARMED draft is at risk, finding-increasing like H16', h36rows([h36pr(100, { auto_merge: { merge_method: 'squash' } }), draftLate], sharedAuto).length, 1); + t('H36: both accepted -> keyed to the earlier-created side', h36key1([h36pr(100, { draft: false }), h36pr(200, { draft: false, created_at: '2026-08-25T11:00:00Z' })], sharedAuto), 100); + // The noise floor: closed, two spellings, pinned against per-incident growth. + t('H36: lockfile-only overlap is the noise floor -> silent', h36rows([readyEarly, draftLate], h36files({ 100: ['pnpm-lock.yaml'], 200: ['pnpm-lock.yaml'] })).length, 0); + t('H36: .changeset/ overlap is the noise floor -> silent', h36rows([readyEarly, draftLate], h36files({ 100: ['.changeset/a.md'], 200: ['.changeset/a.md'] })).length, 0); + t('H36: the noise floor is CLOSED at two spellings — growing it needs its own card', H36_SHARED_PATH_NOISE.length + H36_SHARED_PREFIX_NOISE.length, 2); + t('H36: a source path is NOT noise', h36NoisePath('packages/runtime/src/domains/automation.ts'), false); + // Candidate policy: never narrower than the predicate's population. + t('H36: changeset-release PRs are not candidates', h36NeedsFiles(h36pr(300, { ref: 'changeset-release/main' })), false); + t('H36: a merged row is not a candidate', h36NeedsFiles(h36pr(300, { merged_at: '2026-08-25T12:00:00Z' })), false); + t('H36: a draft IS a candidate (the pair\'s other side can be one)', h36NeedsFiles(draftLate), true); + // An unread side cannot pair — a miss, never an invention. + t('H36: an unread side cannot pair', h36rows([readyEarly, draftLate], h36files({ 100: ['x.ts'] })).length, 0); + // Truncation: pairs on what was seen, and says the list was short. + const truncPair = h36files( + { 100: ['packages/runtime/src/domains/automation.ts'], 200: ['packages/runtime/src/domains/automation.ts'] }, + [200], + ); + t('H36: a truncated list still pairs on what was seen', h36rows([readyEarly, draftLate], truncPair).length, 1); + t('H36: …and the row says so, in the only-hides-more direction', h36row1([readyEarly, draftLate], truncPair).includes('TRUNCATED'), true); + t('H36: an untruncated pair makes no such claim', h36row1([readyEarly, draftLate], sharedAuto).includes('TRUNCATED'), false); + // The transport judgement — H16's shape, asserted on this pass's own pair. + t('H36: an all-failed files pass is the transport, not a clean board', h36DetailPassUnreadable(3, 0), true); + t('H36: zero candidates is a clean reading', h36DetailPassUnreadable(0, 0), false); + t('H36: a partial read is a bounded gap, not a failure', h36DetailPassUnreadable(3, 1), false); + // The coverage pair reaches the summary line, and degrades to 0. + t('H36 summary: the pair is reported', summaryLine({ sharedFileProbed: 17, sharedFileCandidates: 19 }, 0).includes('changed-file page read on 17 of 19 open PR(s)'), true); + t('H36 summary: …and states the miss-only direction', summaryLine({}, 0).includes('MISS a hold, never invent one'), true); + t('H36: both count keys ride the enumerated contract', SWEEP_COUNT_KEYS.includes('sharedFileCandidates') && SWEEP_COUNT_KEYS.includes('sharedFileProbed'), true); + // The markdown medium renders an H36 row like every other finding row. + t('markdown: an H36 row links the PR it names', renderMarkdown([[{ number: 100, html_url: 'https://example.test/100' }, 'H36', 'shares a file']], { repo: 'r', issues: 0, unscoped: 0, prs: 2, merged: 0 }).includes('- **H36** [#100](https://example.test/100)'), true); + // -- The `[::]` collapse (#12090): behaviour-preserving, asserted as such --- // The class held U+003A TWICE, never the fullwidth U+FF1A its shape implied. // These cases pin that the collapse changed nothing a reader could observe.