Summary
When the agent is running a turn, newly submitted prompts queue FIFO. At each turn boundary the harness drains exactly one queued prompt and starts a new turn for it, so n queued prompts produce n sequential turns — each with its own model round-trip, and each answered without the context of the prompts behind it.
Current behavior
- User (or a connected client) submits prompts A, B, C while a turn is running.
- When the running turn ends, the machine drains only A and starts a turn for it.
- B starts its own turn only after A's turn completes; same for C.
Proposed behavior
When a turn ends with several prompts queued, drain the whole queue into the next turn: the model receives all queued messages at once — FIFO order preserved, each still a separate user message — and answers them in a single turn. Prompts submitted while idle behave exactly as today (a queue of length one drains as one message), and pure-notification turns are unchanged.
Prompt-gate semantics are preserved per item: the queue snapshot is gated sequentially, blocked or failed items drop individually with their existing prompt.blocked / prompt.gate_failed events, and prompts arriving during gating are deferred to the next batch.
Why
- Fewer model round-trips when input accumulates during a long turn (interactive TUI use, and API/ACP clients that stream follow-up prompts).
- The model answers queued messages with full visibility of all of them, instead of answering the first one blind to the rest.
Implementation
A complete, tested implementation is available as PR (linked below): the batch drain lives in the agent machine (packages/agent-core-v2), secondary prompts bind to the shared turn so their handles and lifecycle events behave exactly as if each had its own turn, and cancelling any batched prompt cancels the shared turn. Full agent-core-v2 suite passes (6,878 tests), with new coverage for multi-prompt drain, per-item gate outcomes, and shared-turn lifecycle.
We understand external feature PRs are not accepted without maintainer approval — this issue is the discussion venue; the PR is offered as a reference implementation.
Summary
When the agent is running a turn, newly submitted prompts queue FIFO. At each turn boundary the harness drains exactly one queued prompt and starts a new turn for it, so n queued prompts produce n sequential turns — each with its own model round-trip, and each answered without the context of the prompts behind it.
Current behavior
Proposed behavior
When a turn ends with several prompts queued, drain the whole queue into the next turn: the model receives all queued messages at once — FIFO order preserved, each still a separate user message — and answers them in a single turn. Prompts submitted while idle behave exactly as today (a queue of length one drains as one message), and pure-notification turns are unchanged.
Prompt-gate semantics are preserved per item: the queue snapshot is gated sequentially, blocked or failed items drop individually with their existing
prompt.blocked/prompt.gate_failedevents, and prompts arriving during gating are deferred to the next batch.Why
Implementation
A complete, tested implementation is available as PR (linked below): the batch drain lives in the agent machine (
packages/agent-core-v2), secondary prompts bind to the shared turn so their handles and lifecycle events behave exactly as if each had its own turn, and cancelling any batched prompt cancels the shared turn. Fullagent-core-v2suite passes (6,878 tests), with new coverage for multi-prompt drain, per-item gate outcomes, and shared-turn lifecycle.We understand external feature PRs are not accepted without maintainer approval — this issue is the discussion venue; the PR is offered as a reference implementation.