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

Ouverte
#2,475 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 3 jours

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
64/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
typescript

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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

Langage dominant
TypeScript
Étoiles
2k
Forks
301
Merge moyen
3 j 14 h
PR mergées (30 j)
103

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de Zoo-Code-Org/Zoo-Code

Toutes les issues de Zoo-Code-Org/Zoo-Code

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.