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

オープン
#2,475 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

まだ誰も着手していません。

評価

難易度
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時間
マージ済み PR(30日)
103

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Zoo-Code-Org/Zoo-Code のほかの issue

Zoo-Code-Org/Zoo-Code の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。