Skip to content

CI 端口类 e2e 测试自 #3055 合入后批量抽风:claude-native attach 测试与 #3044 端口测试随机失败,挡住多个在途 PR #3188

Closed

Description

@ranxianglei

来源: #3048 分析 PR #3047(kernel 工具配对修复)时发现

现象

2026-10-14 13:09 UTC(#3055 / fix-3044-replacement-port-hop 合入 master,bd2aa6e15)之后,多个 PR 的 CI 出现同一模式的 test lane 失败:

同一小时内失败的 run(均为 pull_request 触发):

run head 时间 (UTC)
38569444973 b37e99e(#3055 自己的 PR 头) 13:09
38569938739 1d73941 13:12
38571051719 5fc68be 13:21
38571989833 d7b531d 13:27
38572560190 976f8e3 13:31
38573899595 f05d7cb 13:41
38574346215 / 38576850227 1c221a7(PR #3047 rebase 后,两波) 13:44 / 14:01

为什么判定是抽风(flake)而不是某个 PR 引入的回归

  1. fix: self-restart replacement binds-or-dies on the freed port instead of hopping (#3044) #3055 自己合并前的 CI 就红了(run 38569444973,shard 3 同一个测试),而它合并后 master bd2aa6e 的 CI 全绿——同一片代码,一次红一次绿;
  2. 各 run 的失败断言完全一致,但端口号/pid 每次不同(如 35173/pid 4054、36841/pid 4132):native-attach: skip http://127.0.0.1:<port> (pid <p>): not own lane and not an armed shared daemon (attachPolicy=own-lane) + port <port> is held by a lifecycle-less bili proxy——即测试钉住的端口上有一个"无生命周期标记"的 bili 守护进程占着,attach 门(claude-native hooks must not attach to a lifecycle-less proxy — attach gate + self-managed fallback #1335)按默认策略拒绝;
  3. PR kernel: pair orphaned tool halves by order and multiplicity, not id-set membership (#3046) #3047 的 diff 只含 kernel/src/prune.ts(仅处理模型请求时的消息重建)、kernel 测试、版本号/lockfile、wire-contract 假上游——不触碰 src/ 任何端口/attach 路径,且本地定向复跑这些 e2e 无关套件全绿;
  4. 分片布局(LPT 按行数装箱)已用脚本对 master 与 PR 树分别模拟:两个树上 claude-native.test.ts 都在 shard 3、port-zone-live.test.ts 都在 shard 1,排除"本 PR 改了分片导致碰撞"的可能。

影响

建议排查方向

  1. claude-native hook e2e 的 attach 时序:同 shard 内先跑的子测试是否泄漏了未清理的 bili start 守护进程并占住后续测试钉选的端口;或 attach 探测早于守护进程的 armed-shared 记录发布完成。给测试加清理/等待,或让 attach 探测带短重试;
  2. autoRestartOnUpdate + occupied target port -> orphan process leak: new instance silently hops to the next port, old instance never exits #3044 的 fail-fast-on-occupied-port 测试对并发占位者敏感(ubuntu 挂 windows 过),同样方向;
  3. 核对 fix: self-restart replacement binds-or-dies on the freed port instead of hopping (#3044) #3055 是否改变了守护进程 arm/publish 的时序(该窗口内唯一改动端口 lane 语义的合入)。

注:以上证据全部来自 CI 日志比对;按本地测试纪律未在本地跑全量回归。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions