Skip to content

Steering an Active Turn

A tool may be running when a user adds a clarification. App Server’s turn/steer RPC lets the client target the current turn explicitly. The successful reply tells the client which turn accepted the input. A later provider request shows what the model can use. App Server guide · Protocol types

Evidence. Source and upstream fixture inspected at Codex CLI 0.172.0. The fixture uses a local command and a scripted provider.

  1. Name the thread and active turn. App Server loads the thread, validates the input, and forwards the text, optional client message ID, and expected turn ID to core. A client can reuse the ID from the previous turn/start response as expectedTurnId. RPC handler
  2. Check the precondition and queue the input. Core checks for an active task and rejects a mismatched turn ID before it queues the message. With an eligible active turn and valid input, core queues the input and returns the active turn’s ID. App Server maps a mismatch to an invalid request error. Core admission · Queue and return · RPC errors
  3. Observe the later input. In the fixture, the first provider response requests a short sleep. The client sends the text steer with the active turn ID. Core’s turn loop can collect pending input as it prepares another request. The fixture checks that the last captured Responses request includes the steering text as a user item. First tool call · Steer request · Read pending input · Captured request
Observation What the assertion measures
RPC response The returned turn ID equals the ID from turn/start. Response assertion
Client notification An item/started notification carries a user message with the submitted client message ID and text. Notification assertion
Model input The last captured provider request contains the steering text as a user item. In both fixture cases, the supplied context item precedes it. The cases differ in how that context is represented. Provider assertions

The fixture measures input delivery during an active turn. It scripts the final answer. To study how a model responds to a mid-turn correction, keep the original task and timing fixed, vary only the steering text, and score the model’s first action after it receives the new input. Run the upstream fixture

Suppose the client has received an approval request for a command, and the user chooses to stop the turn. The client sends turn/interrupt with the thread and turn IDs. The fixture follows the pending approval across three observations. Pending request and interrupt

  1. The serverRequest/resolved notification carries the original approval request ID and thread ID. This lets the client dismiss the correct pending prompt.
  2. The turn/completed notification reports Interrupted on the thread.
  3. The replayed trace identifies the tool call by item ID (call_sleep_approval) and records execution status Aborted. Notification and trace assertions

These observations answer three different questions. Did the pending request close? How did the turn end? What status was recorded for the command? The fixture interrupts while approval is pending. Interruption after a command has already produced side effects needs its own test.

  1. Which ID prevents a delayed client request from steering a different turn?
  2. Where would you look to establish that the provider received the steering text?

Answers. Use the active turnId as expectedTurnId. Check the user item in the captured provider request.

Continue with Context Compaction and Resume to see how input survives across a different boundary.