fix(worker): 避免冷启动误报消息投递失败 - #781
Merged
deepcoldy merged 2 commits intoAug 8, 2026
Merged
Conversation
在完整 Worker 加载前确认进程已持有首轮输入,避免模块加载较慢时触发错误重试和用户可见的假失败。正式处理器就绪后仍按原顺序提交消息,保留现有队列确认与失败恢复语义。
恢复 process 作为 EventEmitter 的实际运行时类型,避免不同 @types/node 版本将 emit 重载收窄后阻断 TypeScript 构建。类型转换仅作用于就绪事件,不改变 IPC 回放逻辑。
Contributor
Author
|
已修复评审指出的 TS2769 阻塞:将自定义就绪事件的调用点收窄转换为 NodeJS.EventEmitter,保持运行时和 IPC 回放语义不变。 验证:
最新提交:e8cacac3 |
|
🚀 Released in v3.11.0 |
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.
问题
普通群消息在冷启动 Worker 时立即启动 2 秒回执计时。Worker 模块加载耗时超过两轮计时后,Daemon 会发送“Worker 未能接收”的错误提示,但消息随后仍会进入 CLI,形成用户可见的假失败和重复投递。
修改
--import加载轻量 IPC 预加载层,在完整 Worker 模块加载前持有并确认首轮消息turn_input_committed队列提交确认、重试与失败恢复语义影响面
验证
pnpm exec vitest run test/worker-ipc-preload.test.ts test/session-lifecycle-start.test.ts test/worker-ordinary-im-receipt-wiring.test.ts:81 项通过pnpm test:全量 unit 测试通过pnpm build:通过