Repository navigation
fix(worker-pool): 文档评论轮在入队前被拒时回评论并清理 Typing 表情 - #3053
Merged
Merged
Conversation
现象:开启 XPI(跨身份打断隔离)时,文档评论会话里上一轮仍在执行、另一身份的评论到达 worker,被以 cross_principal_requires_owner_confirmation 在入队前拒收。daemon 侧没有任何处理:评论串收不到回复,Typing 表情一直挂着,日志里也看不出原因。 根因:worker-pool 的 turn_input_rejected 分发只调用 rejectOrdinaryImDelivery,而它只处理登记在 pendingOrdinaryImDeliveries 里的普通 IM 轮;文档评论轮的 turnId 是评论回复 id,没有记录可落脚,直接 return。 修法:turn_input_rejected 带 rejectedBeforeAdmission 且该轮是文档评论轮时,同步消费该轮落点(重复的拒收帧不会二次回复),在原评论串回一条复用 worker.input_rejected_before_admission 文案的提示,再移除该回复上的 Typing 表情。Codex App 会话里先撤掉该轮唯一的 accepted ledger 条目,撤不掉时保持原行为;该轮仍挂在排队激活日志上时也保持原行为,因为下次 fork 会重放它。普通 IM 轮仍走 rejectOrdinaryImDelivery。 验证: - bunx vitest run --project unit test/bridge-final-output-retry.test.ts test/doc-comment-daemon-concurrency.test.ts test/codex-app-dispatch-ledger.test.ts test/doc-comment-failures-ui.test.ts:306 passed - 新增用例在改动前失败;去掉 ledger 撤销或排队激活判断时对应用例失败 - bunx tsc --noEmit -p tsconfig.json、bun run build:通过
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
November 7, 2026 11:56
Owner
Author
|
已合入 master(squash 2cacd8a)。评审中记录的可选 P3 留作 follow-up,均不阻断:
作者已在 PR「已知限制」自陈的 consume 后崩溃窗口(漏清 Typing 且关会话清理不再覆盖)经评审接受:与 final_output 路径一致,去重优先于表情清理。 |
This was referenced Nov 8, 2026
|
🚀 Released in v3.59.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.
现象
开启跨身份打断隔离(
BOTMUX_XPI_ENABLED=true/crossPrincipalInterruption,默认关闭)时,文档评论会话里上一轮还在执行,另一身份的评论到达 worker 后被准入前拒收(turn_input_rejected,reasoncross_principal_requires_owner_confirmation)。结果是评论串里没有任何回复,Typing 表情一直挂着,daemon 日志也看不出原因。根因
turn_input_rejected的处理只调用rejectOrdinaryImDelivery,它只认登记在pendingOrdinaryImDeliveries里的普通消息轮(om_/bmx-recovery-/board:)。文档评论轮的 turnId 是评论回复 id,查不到记录就直接返回。这一轮没有执行,也不会有final_output,没有任何其它路径会回这条评论、清掉它的 Typing 表情。修法
src/core/worker-pool.ts新增rejectDocCommentTurnBeforeAdmission,在turn_input_rejected带rejectedBeforeAdmission时调用:resolveDocCommentTarget查这一轮的评论落点,查不到(非文档评论轮)就什么都不做。consumeDocCommentTurn),并打 warn 日志。worker 重发同一拒收帧时查不到落点,不会发第二条提示。worker.input_rejected_before_admission回复评论作者(未执行、无副作用、等当前轮结束后重发),再清掉这条评论上的 Typing 表情。accepted。不处理的话,下一轮 prepare 会报dispatch_out_of_order,refork 还会重放这条输入,跟「未执行、请重发」的提示矛盾(用户重发后会执行两次)。因此先按 turnId 找到唯一一条accepted条目,用现有的rollbackAcceptedCodexAppDispatch撤掉(该函数改为返回是否撤销并落盘成功,既有调用方不用返回值)。条目不唯一、已是prepared,或撤销失败时,不消费、不提示,保持原行为。queuedActivationPending/queuedActivationTurnId)仍挂着它,下次 fork 会重放这条输入,同样不能说「未执行」。这种情况直接返回,不撤 ledger、不消费、不提示,保持原行为。影响面
rejectOrdinaryImDelivery,不受影响。已知限制
acceptedledger 条目,这是既有问题,不在本 PR 范围。验证
bunx vitest run --project unit test/bridge-final-output-retry.test.ts test/doc-comment-daemon-concurrency.test.ts test/codex-app-dispatch-ledger.test.ts test/doc-comment-failures-ui.test.ts --maxWorkers=2:4 个文件 306 个用例通过。test/bridge-final-output-retry.test.ts新增 describe「Worker turn_input_rejected for document-comment turns」,走真实的 worker 消息处理:accepted条目被撤掉,前一轮的条目保留。prepared:ledger、落点都不动,不回评论。prepared用例变红;bunx tsc --noEmit -p tsconfig.json、bun run build通过。Fixes #2326