Repository navigation
test(bun-runner): 等待 tmux shim 写入 pending intent 后再退出,消除延迟收割启动竞态 - #3760
Merged
Merged
Conversation
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
November 23, 2026 23:56
Owner
Author
CI
|
deepcoldy
commented
Nov 24, 2026
deepcoldy
left a comment
Owner
Author
There was a problem hiding this comment.
复审结论:代码层面可合,无新增阻断项。
- 已确认远端 head
1e371f4d2a与本地 rebase 后d9d21b852b的目标文件 blob 均为d26e8fa1d4,stable patch-id 均为a79297db9cda…;基线origin/master=045ca7551b。diff 仍只有test/bun-runner-process-reaper.integration.test.ts+19 行,不触及生产代码、runner 或围栏实现。 test/bun-runner-process-reaper.integration.test.ts:261-270、:339-345等待本次 client 的pendingintent 后再退出,与test/helpers/tmux-fence.ts:201-226的同步写入及随后exec顺序吻合;等待发生在延迟 wrapper 启动真实 tmux 之前,没有削弱外层 runner 收割晚到 server 的被测场景。scripts/test-process-reaper.mjs:332-374确实以该 intent 驱动有界等待与收割,原竞态闭合。- 变异复验:将两处 marker 的
client.pid改为999999后,startup 1s、startup 5s、restart 三个目标用例均在 deadline 后失败,其余 4 个用例通过;恢复后目标文件 hash 与 HEAD 逐字一致。 - 实际验证:
bun test test/bun-runner-process-reaper.integration.test.ts7/7 通过(24.76s);bunx vitest run test/bun-runner-process-reaper.integration.test.ts7/7 通过(25.91s);bun run build通过。 - P3 nit(不阻断):
:265、:340的 marker 未带行尾\n,与同仓既有同构等待的防御性写法略有差异;本场景 socket 独立且目标 pid 精确匹配,不要求为此修改。
远端当前仍有已说明的 test (2/4) 无关失败及汇总 test 失败;以上结论针对本 PR diff,实际合并仍需满足仓库常规 CI 与审批条件。
This was referenced Nov 24, 2026
|
🚀 Released in v3.59.32 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改了什么 & 为什么
Fixes #3759
test/bun-runner-process-reaper.integration.test.ts的两个延迟启动用例(startup.test.ts与restart.test.ts)在spawn(tmux, ..., { detached: true }); client.unref();后立即返回退出,未等待fence.binDir/tmuxshim 执行record_server_intent把pending\t<socket>\t<pid>写入BOTMUX_TMUX_SERVER_LOG。在 CI 高负载下,bun test进程可能先于 detached shim 启动完成而退出,导致scripts/run-bun-tests.mjs读到空日志提前收尾,随后 shim 才写日志并执行sleep 1拉起真实 tmux server,使外层query.status !== 0断言偶发失败(PR #3750 job138072441598,全用例仅耗时2564ms,其中1800ms为后置等待)。本 PR 在测试体返回前仅等待
BOTMUX_TMUX_SERVER_LOG出现对应pending\t<socket>\t<client.pid>记录(shim 刚进入exec "$REAL"的sleep阶段,真实 tmux server 仍未启动),既完整保留外层 runner 收割晚到 server 的被测行为,又消除高负载下的启动竞态。影响范围评估
test/bun-runner-process-reaper.integration.test.ts,不改动任何生产代码、runner 或围栏脚本。run-bun-tests.mjs+ 真实 tmux shim + 1s / 5s 延迟 wrapper 端到端验证。实际测试验证
bun test test/bun-runner-process-reaper.integration.test.ts npx vitest run test/bun-runner-process-reaper.integration.test.ts