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

Aperta
#2,475 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
64/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
TypeScript
Stelle
2k
Fork
301
Merge medio
3g 14h
PR unite (30g)
103

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Zoo-Code-Org/Zoo-Code

Tutte le issue di Zoo-Code-Org/Zoo-Code

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.