[BUG] Two queued messages sent in the same tick: the second overwrites the first unread ask response

未关闭
#2,475 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
64/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript

调研方向

Start by reading src/core/task/Task.ts, especially handleWebviewAskResponse, processQueuedMessages, and the ask() polling path; trace how unread responses reach conversation content. Add a test that sends two queued responses before one ask() poll and asserts both payloads appear in the conversation content. The issue is done when neither response is overwritten and both reach the conversation.

由索引模型根据 Issue 内容生成。

描述

Problem

Two queued messages that leave the queue in the same tick can lose one. The second message overwrites the first message in the unread ask response.

Cause (from reading the code, not yet shown by a failing test)
  1. Task.handleWebviewAskResponse writes one response slot: askResponse, askResponseText, askResponseImages and askResponseSegments.
  2. Task.processQueuedMessages() dequeues one message. It then calls setTimeout, which calls submitUserMessage, which calls handleWebviewAskResponse.
  3. Each tool call can call processQueuedMessages(). A multi-file apply_patch calls it once for each changed file.
  4. If two calls run before ask() polls, the second write replaces the first. The first message has already left the queue, so it never reaches the conversation.

main has the same path. PR #2421 adds no new loss. It adds one more way to reach the slot: a blocked drain can send a message when an edit ends.

Expected result

Each queued message that leaves the queue reaches the conversation content.

Fix ideas
  • Keep each queued message pending until the task consumes it.
  • Or combine unread responses and do not replace an unread one.
  • Related: #21 (extract the ask and say flow from Task.ts).
Test wanted

Send two queued responses before one ask() poll. Assert that both payloads reach the conversation content. A test that only counts two submitUserMessage calls does not detect the loss.

Found in

Review of PR #2421, bot comment on src/core/task/Task.ts (submitQueuedMessage).

主要语言
TypeScript
星标
2k
派生
301
平均合并
3 天 14 小时
30 天内合并 PR
103

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Zoo-Code-Org/Zoo-Code 的其他 Issue

查看 Zoo-Code-Org/Zoo-Code 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。