Repository navigation
feat(v2): serve delivery: "steer" on session/prompt - #1
Merged
Merged
Conversation
Implements the steer half of the prompt delivery RFD (agentclientprotocol/agent-client-protocol#1261, revision 2026-10-24, ee193af). A `session/prompt` with `delivery: "steer"` joins the running turn at SDK priority `next` (`later` while a permission request is open), so running tool calls finish instead of being cancelled. It answers with the steer's `messageId` once Claude Code takes the message in: its echo, its `started` lifecycle frame, or a result that names it. With no turn running it starts one; a steer still waiting when a cancel ends the turn starts the next turn. Other `delivery` values fail with -32602. Advertises `session.prompt.delivery.steer`. SDK 2.4.0 drops unknown `session/prompt` params, so the v2 surface reads `delivery` off the incoming messages until the SDK parses it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A steer whose `session/prompt` request is cancelled (`$/cancel_request`, or its connection closed) before Claude Code takes it in is dropped from Claude Code's queue with `cancelAsyncMessage` and fails with -32800. When Claude Code already dequeued it, the request answers as usual once the steer is inserted, as the RFD's race rule allows. Withdrawal is attempted only while the steered turn's running cycle has no result yet; the turn then settles at the idle after its result, as the steer lane does. Later, the steer stays and is taken in. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the steer half of the prompt delivery RFD (agentclientprotocol/agent-client-protocol#1261, revision 2026-10-24,
ee193af) on the ACP v2 surface, with the RFD's field names.Behavior
next(laterwhile a permission request or question is open). Running tool calls finish; nothing is cancelled. The request answers with the steer'smessageIdonce Claude Code takes it in: its echo, itscommand_lifecyclestartedframe, or a result whoseuser_message_uuidsnames it.session/cancelwhile a steer waits: the steer is dropped from Claude Code's queue and starts the next turn afteridle cancelled.$/cancel_requeston a waiting steer (or its connection closing) drops it from Claude Code's queue (cancelAsyncMessage) and fails it with-32800. If Claude Code already took it, the request answers with itsmessageIdas usual. Only attempted while the turn's running cycle has no result yet; after that the steer stays and is taken in.deliveryvalues (queueincluded):-32602before anything is inserted.session.prompt.delivery.steer: {}._session/steering: unchanged (stillnow/later); it now shares the inject path with v2 steer.Workaround
@agentclientprotocol/sdk2.4.0 has nodeliveryfield and itssession/promptparser drops unknown keys (built-in parsers can't be replaced).src/v2/prompt-delivery.tsreadsdeliveryoff incoming JSON-RPC messages before the SDK parses them; the handler takes it by request id. Remove once the SDK parsesdelivery.Verification
npm run check,tsc,vitest run: 3566 passed.acp-v2.test.ts, doubles modelled on frames Claude Code 2.1.316 sent for anextmessage pushed during a foreground Bash call. Disabling the cancel restart or the result-based insertion fails the matching tests.initializeresponse gainsdelivery: {steer: {}}, nothing else.sleep 6, the tool completed, thenuser_message+ response with the steer'smessageId, answerFIRST SECOND, oneidle end_turn;delivery: "queue"→-32602. Withdrawal end to end:$/cancel_request1 s after the steer →-32800, the tool completed, answerFIRSTonly, oneidle end_turn.🤖 Generated with Claude Code