Repository navigation
test(worker): 分档等待真实 worker 冷启动与 IPC 事件 - #3740
Merged
Merged
Conversation
Closes #3737 Closes #3738 Co-Authored-By: Claude Code <[email protected]>
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
November 23, 2026 12:58
|
@deepcoldy 合入 master 后的 Midscene E2E 失败:Feishu live Midscene 失败。 这次运行覆盖 67ae83e…045ca7551(2 个提交),同批合入的还有 #3757,失败不一定由本 PR 引起。
|
|
🚀 Released in v3.59.31 |
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.
根因
两个失败用例都把 Node+tsx 冷启动 → worker init → PTY/CLI spawn → 目标 IPC/日志事件 放进同一个固定墙钟窗口:Pi 为 15s,Codex 为 12s。CI 高负载下,首个用例的冷启动本身就能耗尽窗口:
Spawning fresh CLI,但没有等到cli_install_changed。ready前超时,且尚未收到任何 worker 日志。本地把 2 个 CPU burner 与 4 份测试/真实 worker 冷启动限制在同一颗核,可重复得到与 CI 相同的失败。相同压载下仅做诊断性放宽后,两个目标用例均 4/4 通过:Pi 约 15.55–15.69s 收到事件,Codex 约 14.16–14.23s 收到 ready。事件会到达,未复现 worker 永久丢消息或 frozen HOME 初始化死锁;根因是测试没有区分启动耗时与功能观测耗时。
修复
waitForWorkerMessage:直接订阅 IPC 事件,并重放订阅前已收集的消息;worker 提前报错、退出或启动失败时立即给出带日志的失败。cli_install_changed功能窗口;警告先于 ready 到达时也能从消息记录重放。没有修改生产代码,也没有放宽版本号、鉴权环境、启动参数或负向行为断言。
加压与回归证据
cli_install_changed15s 超时;Codex 4/4 复现 ready 12s 超时最终本地验证:
所有 Bun 定向测试均经
scripts/fenced-run.ts运行;未部署、未重启 daemon/fleet。为什么不会掩盖真问题
cli_install_changed若不再产生,仍会在 ready 后的 15s 功能窗口内咬红;版本和只上报一次的断言原样保留。影响面
仅测试与测试 helper,覆盖 Bun/Vitest 两种父运行时下的真实 Node worker + PTY 路径。不涉及 daemon 行为、生产持久状态、其他 CLI、其他后端或 UI。
Closes #3737
Closes #3738
🤖 Generated with Claude Code