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

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

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

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

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
12/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
typescript
領域
api

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.
主要言語
TypeScript
スター
2.3k
フォーク
315
平均マージ
3時間 54分
マージ済み PR(30日)
9

環境構築

はじめの一歩

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

MiniMax-AI/minimax-code のほかの issue

MiniMax-AI/minimax-code の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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