Repository navigation
fix(worker-pool): 静态兜底卡发送失败时不再抛出成 daemon 级 unhandled rejection - #2003
Merged
deepcoldy merged 1 commit intoOct 19, 2026
Merged
Conversation
worker_ready 发流式卡失败后会改发静态会话卡;静态卡也失败时,catch 里的 `throw fallbackErr` 抛出了 fire-and-forget 的 worker IPC 消息处理器,没有任何 调用方 await,最终只会被 daemon 的 rejection guard 记成 "Unhandled promise rejection in daemon"。回复目标坏掉的会话每次冷启动都会 触发一次。 改为记 warn 后结束本分支:streamCardId 在进入兜底前已清空,后续 screen_update 仍可重新建卡;撤回(MessageWithdrawnError)分支保持不变。 新增回归测试:流式 POST 与静态兜底 POST 都失败时,不产生 unhandled rejection、不关会话。未修复时该测试必红。 Co-Authored-By: Claude Opus 5.5 <[email protected]>
xu4wang
requested review from
47seek,
LucasIcarus,
deepcoldy,
xiaoxueSunn and
xiongz-c
as code owners
October 18, 2026 04:17
Owner
|
你好,这个 PR 的自动评审群已建,麻烦点击链接加入群聊、查看评审意见并跟进后续修改: 另外你暂时不在自动拉群名单里,也可以把 GitHub 账号和飞书信息补进名单文档,补好后后续评审会自动拉你进群:https://bytedance.larkoffice.com/wiki/WJ1nwWbtxi89erkNGNbcgkt9nUe (本条为自动流程发出的提示消息) |
|
🚀 Released in v3.47.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_ready发流式卡失败后会降级发静态会话卡。如果静态卡也发送失败(且不是MessageWithdrawnError),src/core/worker-pool.ts的兜底 catch 会throw fallbackErr。这段代码运行在 worker IPC 的message处理器里,属于 fire-and-forget,没有调用方 await,所以错误最后只会被 daemon 的 rejection guard 记成:实际环境:一个 chat-scope 会话的回复目标坏掉后(根因另开 issue),每次冷启动都会触发一次,12 小时内 37 条。daemon 没有崩,但日志里出现了本不该有的 ERROR,也会掩盖真正的未捕获异常。
修改
logger.warn并结束该分支,不再向上抛出。streamCardId已经清空,后续screen_update仍然可以重新建卡,行为不变。MessageWithdrawnError分支(关会话)保持不变。测试
test/worker-ready-display-mode.test.ts新增用例:流式 POST 和静态兜底 POST 都失败时,断言没有unhandledRejection、streamCardId为空、会话没有被关闭。Error: fallback POST failed这条 unhandled rejection;修复后变绿。vitest run --project unit跑了 worker-ready / streaming-card / session-lifecycle / worker-pool / stuck-warning-integration 这几组:9 个文件、509 个用例全过。tsc --noEmit通过。vi.hoisted,属于run-bun-tests.mjs的 deferred 集合,bun 腿不跑它;改动前后 bun 下的表现一致。🤖 Generated with Claude Code