Repository navigation
CI 端口类 e2e 测试自 #3055 合入后批量抽风:claude-native attach 测试与 #3044 端口测试随机失败,挡住多个在途 PR #3188
Copy link
Copy link
Closed
Description
来源: #3048 分析 PR #3047(kernel 工具配对修复)时发现
现象
2026-10-14 13:09 UTC(#3055 / fix-3044-replacement-port-hop 合入 master,bd2aa6e15)之后,多个 PR 的 CI 出现同一模式的 test lane 失败:
- shard 3 在 ubuntu/windows × node 22/24 四个平台全部失败,失败的都是同一个子测试:
tests/claude-native.test.ts的 "hook e2e: manualbili starton the pinned port is attached, not refused ([bug] claude native proxy outlives all sessions despite README lifecycle contract — watcher-based shutdown did not fire #1322/claude-native hooks must not attach to a lifecycle-less proxy — attach gate + self-managed fallback #1335/[Design] 定死端口 lane(claude 48787 / zcode 48789)端口被占时的 0 配置解法 #1660)"; - ubuntu shard 1 额外失败
zone live: marked upgrade-replacement fails fast on an occupied port instead of hopping (#3044)(windows shard 1 同测试通过)。
同一小时内失败的 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 引入的回归
- fix: self-restart replacement binds-or-dies on the freed port instead of hopping (#3044) #3055 自己合并前的 CI 就红了(run 38569444973,shard 3 同一个测试),而它合并后 master bd2aa6e 的 CI 全绿——同一片代码,一次红一次绿;
- 各 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)按默认策略拒绝; - 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 无关套件全绿;
- 分片布局(LPT 按行数装箱)已用脚本对 master 与 PR 树分别模拟:两个树上 claude-native.test.ts 都在 shard 3、port-zone-live.test.ts 都在 shard 1,排除"本 PR 改了分片导致碰撞"的可能。
影响
- 13:09 UTC 之后每个 PR 的 CI 都有概率整片变红,合并被噪声阻塞(PR kernel: pair orphaned tool halves by order and multiplicity, not id-set membership (#3046) #3047 目前即被挡,其自身相关 lane——kernel-guard、lock-sync、static-gates、全部 e2e 专项——均绿);
- 每次误报都要人工辨认"哪些红与本 PR 无关",消耗 review 时间。
建议排查方向
- claude-native hook e2e 的 attach 时序:同 shard 内先跑的子测试是否泄漏了未清理的
bili start守护进程并占住后续测试钉选的端口;或 attach 探测早于守护进程的 armed-shared 记录发布完成。给测试加清理/等待,或让 attach 探测带短重试; - 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 过),同样方向;
- 核对 fix: self-restart replacement binds-or-dies on the freed port instead of hopping (#3044) #3055 是否改变了守护进程 arm/publish 的时序(该窗口内唯一改动端口 lane 语义的合入)。
注:以上证据全部来自 CI 日志比对;按本地测试纪律未在本地跑全量回归。
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
ci: per-file zone-port bands for live suites + bounded TOCTOU retries (…
ci: per-file zone-port bands for live suites + deterministic teardown…
Merge pull request #3197 from ranxianglei/fix/3182-zone-slot-bands