* Queue and steer messages while a turn runs: protocol, runtime, server
Protocol v23 (event format 5): a chat holds messages back while a turn
runs (`queue.add`, `queue.remove`, `queue.resume`, `thread.queue.updated`,
thread snapshot `queue`), and a message can join the running turn
(`turn.steer`, provider capability `canSteer`).
The server owns the queue (migration 28, `threads.queue_json`). A queued
message runs as the next turn when the running one completes, with the
model and effort it was sent with; the message leaves the queue in the
same write that starts its turn. Stop, a failed turn and a restart pause
the queue, which then moves only on `queue.resume`.
Claude steers with an async user message at `priority: 'next'`, which
the CLI folds into the running turn at its next tool boundary (probed on
Agent SDK 0.3.220; `'now'` ends the turn instead). Until the CLI takes it
the message waits in the queue as `steering`; once taken it becomes a
user message inside the turn. A steer the turn ended without reading is
taken back (`cancelAsyncMessage`) and runs as the next turn, or the CLI
starts a turn of its own for it, which the server records as the
message's. Stop takes steers back before it interrupts, so nothing runs
later by surprise. Cursor and OpenCode cannot steer; their messages queue.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Live test: steer folds into a running Claude turn, and a queued message runs next
Opt in with OPENMANAGER_LIVE_CLAUDE=1. Cleanup retries removing the temp
folder, which the CLI can still hold for a moment on Windows.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Queue and steer from the composer, with queued messages above it
While a turn runs, Enter queues the message (or steers it, by a device
setting under Settings > Chat), and Cmd/Ctrl+Enter does the other. The
send button beside Stop names the action and offers both when the
provider can steer. Queued messages show as rows above the composer, in
the order they will run: removable while they wait, "Joins at the next
step" while the provider holds a steer, and a Paused header with Resume
after Stop, a failure or a restart. A row names the model or effort it
will run with when that differs from the composer.
A steered message renders where the agent read it: the turn's reply
splits at it, the first part keeping its row key. The client keeps the
server's queue as given (`thread.queue.updated`, thread snapshot) and
queue commands never touch the send outbox.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Only the provider says a steer came back; review fixes
- A stopped or failed turn no longer turns a `steering` message back into
`queued` on the server's guess: only `steer_withdrawn` (also sent when
the process exits) does, so a resume cannot send it twice.
- A take-back the CLI cannot answer within 5 s replaces the runtime,
whose exit gives the steer back, instead of freezing the queue. Claude
refuses to steer without `cancelAsyncMessage`, and to prompt while it
still holds a steer; the server refuses a turn while one is held.
- A delivered steer keeps the message's id, so a retried send of it is
recognised and not sent again. The client keys retries by text alone.
- Steering a turn the provider began by itself queues instead.
- A queued message that cannot start pauses the queue (`failure`); a plan
build that does not start lets the queue move; queues are paused after
a restart under their own try.
- A stored queue reads item by item, never dropping the whole queue.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Stop runs the next queued message; given-back steers run first
Stop ends the running turn, not the plan queued behind it, so the queue
now drains after a user Stop instead of pausing. The `stop` pause reason
is gone from the protocol; failure and restart still pause.
A steer the provider gives back (Stop, restart, or a turn that ended
first) now runs ahead of messages that were only queued, keeping steer
order, instead of at its queue position (which raced the CLI).
The drain after Stop waits for the cancel to settle. The steer-turn test
clock follows the real clock (it was pinned to 2026-11-07 10:00 UTC).
New live test: Stop with a pending steer and a queued message.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Re-pin event format 5's digest: the queue pause reasons changed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>