Skip to content

test(cli): shell 回收用例补 30s 单测墙钟,避免裸 bun test 5s 默认超时 - #2615

Merged
deepcoldy merged 1 commit into
masterfrom
fix/shell-retirement-bare-bun-timeout
Oct 30, 2026
Merged

deepcoldy merged 1 commit into
masterfrom
fix/shell-retirement-bare-bun-timeout

Conversation

@deepcoldy

Copy link
Copy Markdown
Owner

背景

#2596 已合入(squash c7d1151ea)。双审中 pi 提出一个不阻塞的 P3:该 PR 把 resolveCommandAsync 的探测预算从 100ms 放大到 2s 后,timeout 变体一轮要跑 -lc、-ic 两次探测,合法墙钟约 2 × 2s ≈ 4s(master 旧版约 2 × 100ms ≈ 240ms)。CI 两条测试腿都显式传了单测超时(scripts/run-bun-tests.mjs 给 --timeout=180000,vitest 默认/配置 60s),所以门禁不受影响;但本地定向跑用的裸 bun test test/resolve-command-shell-parse.test.ts 走 Bun 默认 5000ms 单测超时,在高负载机器上会把一条 ~4.5–5.1s 的正常路径误判为超时。

改动(纯测试,单文件)

给这条 it.each 的第三参数 per-test timeout 从 Bun 默认 5000ms 抬到 30_000,只抬 runner 的执行墙钟天花板,不动任何断言与产品代码:

  }, 30_000);

}, 30_000) 是本仓既有写法(test/ask-cli.test.ts、test/api-only-transport-boundary.test.ts 等多处)。

验证

  • 复现(与 pi 各自独立复现,形状逐字相同):isolate-run --cpus 1 + 20 个满转 burner,裸 bun test 8 轮,4 轮报 this test timed out after 5000ms、4 轮通过。
  • 修复后同档:同条件 8 轮 8/8 全绿(文件墙钟 21–24s)。
  • 无负载基线:vitest 18/18、bun:test 18/18(基于合并 test(cli): 放大 shell 回收用例启动预算,修 bun-test 正对照竞态 #2596 后的最新 master 22d1c8d0b)。
  • 变异复验:抬天花板后删掉 src/adapters/cli/registry.ts 里 finish() 的进程组 SIGKILL,两个变体仍在 expect(running).toEqual([])(261 行)咬红——说明 30s 参数没有放松进程组回收与超时语义的守卫,只是避免 runner 切掉正常路径。
  • 对 CI 无变化:CI 用显式 180s(bun leg)/ 60s(vitest),不靠这个默认值。

影响面

仅 test/resolve-command-shell-parse.test.ts(+7/-1),src 零改动,无 breakchange。

🤖 Generated with Claude Code

timeout 变体一轮要跑 -lc、-ic 两次探测、每次 2s 预算,实际墙钟约
4s(master 上 2×100ms 约 240ms)。CI 两条腿都显式传了超时(bun leg
180s、vitest 60s),但本地定向跑用的裸 bun test <file> 走 Bun 默认
5000ms:1 核 + 20 满转负载下 8 轮有 4 轮在 4.5-5.1s 被整体判超时
(复审 P3,pi 与我各自独立复现,形状逐字相同)。

给该 it.each 加第三参数 30_000,只抬 runner 天花板,不动任何断言:
- 同负载 8 轮 8/8 绿(文件墙钟 21-24s);
- 删掉 registry.ts finish() 的进程组 SIGKILL 后两变体仍在 toEqual([])
  咬红,超时语义与进程组回收守卫没有被这个参数放松。
}, 30_000) 是本仓既有写法(ask-cli / api-only-transport-boundary 等)。

Co-Authored-By: Claude Code <[email protected]>
@github-actions

Copy link
Copy Markdown

@deepcoldy 合入 master 后的 Midscene E2E 失败:Feishu live Midscene 失败。

这次运行覆盖 3400614…0946357b3(9 个提交),同批合入的还有 #2542 #2611 #2600 #2578 #2590 #2612 #2594 #2548,失败不一定由本 PR 引起。

用例 跑道 状态 失败信息
Gemini basic bot flow feishu-core-clis failed waitFor timeout: Based on the screenshot, the main content area displays a topic conversation. I am looking for a specific text bubble from "Gemini" containing the string "ACK-e2e-gemini-179337940473…

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

🚀 Released in v3.56.0

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