ACP: a message sent to a busy session is dropped instead of queued

Abierto
#574 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
12/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
typescript
Área
api

Línea de trabajo

Start by reproducing the five-step sequence in the issue over raw JSON-RPC on stdio: a session/prompt during a running turn, then the mcode/session/queue/enqueue calls with the same clientRequestId. Compare the two busy error texts and the itemId values returned. The issue asks for three contract decisions (a stable busy error code, idempotent enqueue, and an observable fate for queued items), so this needs maintainer agreement on the design before code changes.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Product or interface

CLI - ACP

Use case and problem

A third-party ACP client that talks to mcode acp cannot deliver a message to a session that is already running a turn. The client sends session/prompt and the adapter rejects it:

-32602  A prompt is already active for this session.
-32603  Session already has an active Turn. Use queue send to deliver the message after it.

Both texts are seen in practice, for the same condition, so a client cannot rely on one of them.

The message is neither queued nor delivered: the client sees an error, and the text the user typed is gone. This is not a corner case — a parent agent that is notified that its sub-agent finished while the parent's own turn is still running hits it every time.

The machinery already exists. The TUI queues messages typed during a run, and the ACP adapter exposes the same capability as a vendor extension:

"_meta": { "minimax-code/extensions": { "methods": [
  "mcode/session/steer",
  "mcode/session/queue/list", "mcode/session/queue/enqueue",
  "mcode/session/queue/update", "mcode/session/queue/delete", "mcode/session/queue/steer"
] } }

The problem is that the standard protocol has no way to express any of it:

  • session/prompt has no "queue this" disposition, and the ACP schema's promptCapabilities carries only image, audio and embeddedContext, so initialize cannot tell a client that queueing exists.
  • The error text points at "queue send" without naming a callable method, and it differs between the two busy responses.
  • A client that does not read the vendor _meta block has to guess the method name. Most do not.
Measured behaviour today

Measured against mcode 0.7.3 over raw JSON-RPC on stdio:

  • mcode/session/queue/enqueue accepts {sessionId, text, clientRequestId?} and answers {itemId, status: "queued", position}.
  • A queued message runs as its own turn right after the current one. The queue empties, and the model call for the queued message shows up in usage_update.
  • The answer to a queued message never arrives in session/update. During a 78 s observation after the current turn ended, no agent_message_chunk carried the expected reply — only session_info_update and usage_update. A client therefore cannot learn the result of a queued message through the standard channel.
  • clientRequestId does not dedupe: two enqueue calls with the same clientRequestId and the same text produced two different itemId values and two entries in queue/list. The field is accepted and then ignored.
  • mcode/session/queue/update is never emitted, so a client learns about queue changes only by polling queue/list.
  • mcode/session/queue/delete removes an entry while its status is queued; once the entry left that state the call is not editable and the element is reported as not found.

Minimal reproduction (no real paths or identifiers):

1. initialize
2. session/new                                  -> sessionId
3. session/prompt { sessionId, prompt: [text "run: sleep 15"] }   (do not wait)
4. session/prompt { sessionId, prompt: [text "SECOND"] }
   -> error -32603 "Session already has an active Turn. Use queue send to deliver the message after it."
5. mcode/session/queue/enqueue { sessionId, text: "SECOND", clientRequestId: "x" }
   -> { itemId: "queue_…", status: "queued", position: 1 }
6. mcode/session/queue/enqueue { sessionId, text: "SECOND", clientRequestId: "x" }
   -> { itemId: "queue_…different…", status: "queued", position: 2 }   // same key, two entries
Desired behavior

Three contract points would make this interoperable. Each one is about the contract, not about the implementation.

  1. A machine-readable busy signal. The busy condition should be distinguishable from an invalid request and from an internal error by a stable code or a field in the error data, and it should be the same for both busy texts. A client should be able to branch on it without parsing prose.

  2. Idempotent enqueue. The same (sessionId, clientRequestId) should return the same itemId, and the same key with different content should be a conflict. Without this, a client that retries after a lost acknowledgement cannot avoid delivering the message twice.

  3. An observable fate for a queued item. The client should learn that an item was accepted, when it started, and how it ended (finished, failed, cancelled) — with the itemId, and tied to the turn that produced it and to its answer. The state must survive a reconnect. An item disappearing from queue/list is not proof that it ran, and its answer not arriving in session/update leaves the client with no result at all.

Acceptance criteria
  • A session/prompt that arrives during a running turn is either queued, or rejected with an error whose busy condition is machine-readable and names the callable extension method. It is never silently dropped.
  • With idempotent enqueue, a repeated (sessionId, clientRequestId) returns the same itemId; a repeated key with different content is a conflict.
  • The client can learn the outcome of a queued message — its answer and its terminal state — through the standard notification channel or through a documented extension notification, including after a reconnect.
  • Queued messages stay visible through mcode/session/queue/list and can be removed with mcode/session/queue/delete while they have not started, consistent with the existing extension contract.
Platform

Multiple platforms

Alternatives and additional context
  • Queuing every busy session/prompt automatically would change ACP semantics, so it is better left opt-in: either an agreed opt-in behaviour, or the structured busy signal plus a documented enqueue method, and let the client decide.
  • Steering via mcode/session/steer works for clients that read the vendor extension, but the ACP schema has no capability to advertise it, so a client has to hard-code provider-specific knowledge.
  • The client side of this problem is tracked in the Paseo repository: https://github.com/getpaseo/paseo/issues/8300 and https://github.com/getpaseo/paseo/discussions/8301 — they look at queuing messages on the client side, but a client-side queue cannot help when the client does not own the turn.
  • Related open issues in this repository: #295 (parallel queued tasks in the interactive TUI), #335 (separating mid-run steer/queue messages in Goal mode). This request is about the ACP surface specifically, not the TUI.
Lenguaje dominante
TypeScript
Estrellas
2.3k
Forks
315
Merge medio
3 h 54 min
PR fusionados (30 d)
9

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de MiniMax-AI/minimax-code

Todos los issues de MiniMax-AI/minimax-code

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.