Repository navigation
fix(cli,worker): 修复连续排队轮次引用锁死在上一轮及mid-turn提醒消息拆分 - #1789
Merged
Merged
Conversation
1. 修复连续快速发送消息时引用锁死在首轮的问题: - cli: 在 cmdSend 中,若检测到 PID marker 中的 active 轮次已在 ledger 中完成 final 交付且存在排队轮次,自动原子推进 marker 至下一排队轮次,重新绑定对应轮次的 quoteTargetId 与 senderOpenId,允许正常交付 final,并在 steerPromotedTurn 场景下将回退的 auxiliary 自动恢复为 final,打破死锁循环。 - worker: 在 prepareNormalWrite 判定 isTypeAhead 时增加检查当前 active 轮次是否已交付 final;若已完结且无更早排队,新消息直接作为 active 轮次接管,不再排入 type-ahead。 - worker: advanceQueuedTypeAheadTurn 推进后置位 queuedTurnAdvanceConsumedForPrompt,防止后续 prompt_ready 出现多余步进。 2. 修复普通群聊顶层轮次引用污染问题: - cli: 顶层普通群聊中引入 turnBoundQuoteTarget 优先解析当前轮次精确绑定的消息 ID,避免 fallback 到全局最新 slot 产生跨轮引用污染。 3. 修复 Claude Code 2.1+ mid-turn 消息拆分与活动丢失: - claude-transcript: 识别 mid-turn <system-reminder> 吸收消息,不将其误判为新对话轮次起点。 - bridge-turn-queue: 跟踪 hasAssistantActivity,保护已有工具调用的轮次不被 HOL drop。
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
October 10, 2026 05:56
|
🚀 Released in v3.41.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 send时,读到 active 仍是上一轮且上一轮 final 已交付,触发 ledger 冲突拒绝再次发送 final;CLI 降级为--response-kind auxiliary。而 auxiliary 发送不会推进 marker,导致 active 轮次永久停留在第一轮,后续所有轮次全被当成第一轮的 auxiliary,连续多次全部错误引用了第一条消息。src/cli.ts:在cmdSend中,若检测到 PID marker 中的 active 轮次已在 ledger 中完成 final 交付且存在排队轮次,自动原子推进 marker 至下一排队轮次,重新绑定对应轮次的quoteTargetId与senderOpenId,允许正常交付 final,并在steerPromotedTurn场景下将回退的 auxiliary 自动恢复为 final,打破死锁循环。src/worker.ts:在prepareNormalWrite判定isTypeAhead时增加检查当前 active 轮次是否已交付 final;若已完结且无更早排队,新消息直接作为 active 轮次接管,不再排入 type-ahead。src/worker.ts:advanceQueuedTypeAheadTurn推进后置位queuedTurnAdvanceConsumedForPrompt,防止后续prompt_ready出现多余步进。修复普通群聊顶层轮次引用污染问题:
src/cli.ts:普通群聊顶层轮次中引入turnBoundQuoteTarget,优先解析当前轮次精确绑定的消息 ID,避免 fallback 到全局最新 slot 产生跨轮引用污染。修复 Claude Code 2.1+ mid-turn 消息拆分与活动丢失:
src/services/claude-transcript.ts:识别 mid-turn<system-reminder>吸收消息,不将其误判为新对话轮次起点。src/services/bridge-turn-queue.ts:跟踪hasAssistantActivity,保护已有工具调用的轮次不被 HOL drop。影响面评估
测试验证
bun run test test/cli-send-turn-idempotency.test.ts:覆盖 active 轮次已交付 final 时自动推进 PID marker 到排队轮次、正确引用新轮次的触发消息、以及 auxiliary 自动晋升 final 专项单测,全部通过。bun run test test/session-marker-resolve.test.ts test/send-after-the-fact-topic-quote-wiring.test.ts test/bridge-turn-queue.test.ts test/command-schema.test.ts test/command-router-oracle-diff.test.ts:141/141 单测全部通过。bun run build:exit code 0。bun run switch:here && bun run daemon:restart部署成功,实测消息引用与 @ 行为完全准确。