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

Đang mở
#2,475 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 3 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
64/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
backend-api-design

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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).

Ngôn ngữ chính
TypeScript
Star
2k
Fork
301
Merge trung bình
3 ngày 14 giờ
Pull request đã merge (30 ngày)
103

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Zoo-Code-Org/Zoo-Code

Tất cả issue của Zoo-Code-Org/Zoo-Code

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.