Repository navigation
docs(unstable): describe parent work after the prompt response for subagents - #2896
Merged
Merged
Conversation
…bagents A review of the v1 subagent implementations in claude-agent-acp, codex-acp and Zed found one case the v1 draft Subagents page does not cover and four places where the text is inconsistent. No wire shape changes. - Add "After the parent's prompt response" to the v1 draft Subagents page. When a child that keeps running reports back, the parent can work on the result with no `session/prompt` pending. No prompt response reports that this work stopped, and `session/cancel` for the parent cancels it. - Say that a child's `config_option_update` that arrives before the `session/load` response is historical. The page said this only for `capabilities` and `state`. - Remove "A Client SDK may buffer traffic for a child it does not know yet" from the v1 draft and v2 Subagents pages and the matching sentence from the RFD. How an SDK handles a non-conforming Agent is not protocol behavior. - The tool call pages said a message from a parent to a child is reported "not through a tool call", while the Subagents pages let the tool call's input report it too. They now say that the `session` reference does not report the message. - The v1 idle state descriptions said the child is "ready to process another prompt". A Client cannot prompt a child.
benbrandt
enabled auto-merge (squash)
November 19, 2026 20:42
Merged
benbrandt
added a commit
to agentclientprotocol/claude-agent-acp
that referenced
this pull request
Nov 21, 2026
…nside it (#1685) A child session's `config_option_update` inside a replay describes a past value. Both replays sent each child's `model` option inside the replay, and then dropped the update after the replay when it was the same. A client that follows the ACP rules never got a configuration it may show. Found while reviewing the protocol changes since ACP SDK 2.8.0 (agentclientprotocol/agent-client-protocol#2881 and agentclientprotocol/agent-client-protocol#2896). ## The rules - v2, Replay contents: "Historical `usage_update`, `session_info_update`, `config_option_update`, and `available_commands_update` notifications. They describe past values and **SHOULD NOT** be replayed." - v2, Subagents: "Agents **SHOULD** send a current `config_option_update` for a restored child when it is available." - v1, Subagents: "A child's `config_option_update` that arrives before the `session/load` response is historical. The Client **MUST NOT** present it, or configuration it held before the load or resume, as the child's confirmed current configuration. Agents **SHOULD** send a current `config_option_update` for a restored child when it is available. After `session/load`, they send it after the response." ## Before - v2 (`src/v2/subagent-replay.ts`): the child's `model` went out as a `config_option_update` at its announcement, and again for each response with another model. After the root's `replay_complete`, the current configuration was skipped when it equalled what the replay sent. - v1 (`src/subagent-replay.ts`): the same during the `session/load` replay, and `currentStates` dropped the update after the response when it equalled the replayed one. ## After Both versions behave the same way: - The replay sends no `config_option_update` of a child. It only tracks the model of the child's latest response. - After the boundary, each announced child gets one `config_option_update` when a configuration is known: the configuration of a child that still runs, else its `model` option with the model of the latest response in its transcript, as the session's model list names it. It goes out also when nothing changed. - The boundary is the root's `replay_complete` on v2 and the load response on v1. On a child's own stream on v2 the order is now: history, `replay_complete`, `state_update`, `config_option_update`. On v1, after the load response: the parent's `subagent_update`, then the child's `config_option_update`. `currentChildConfiguration` and `trackResponseModel` in `src/subagent-replay.ts` serve both cores. The replayed-model state that only the dedupe needed is gone (`ReplayChild.model`, `mapsDuringReplay`, `sendModel`, `firstResponseModel`). AIR's draft form (`publishReplayedChildModels`) is unchanged. One thing goes slightly beyond the spec: a child that no longer runs still gets its model after the boundary. The SHOULD names a "restored child". `currentStates` already did this when the model list mapped the model to another entry, and a client has no other way to learn which model a past child ran on. ## Tests - v1 (`src/tests/v1/acp-agent.test.ts`): one replay with four children covers no model before the response, the latest response's model mapped by the model list, an unlisted model sent as its id, a `<synthetic>` response ignored, none for a child without responses, and a live child getting its live configuration. - v2 (`src/tests/v2/acp-v2.test.ts`): the history test pins the configuration after the child's `replay_complete` and state. The live-child test expects the live configuration once. An `it.each` covers the latest of two response models and no update without a response. `npm run build`, `npm run check` and `npm run test:run` pass. The whole suite also passes against the real Claude Code CLI on this branch merged with the SDK 2.9.0 bump and the other replay fix (4,459 passed, 9 skipped). ## Not verified No real client's rendering of a child's model that arrives after the boundary was checked.
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.
Summary
A review of the v1 subagent implementations found one case the v1 draft Subagents page does not cover and four places where the text is inconsistent or says something it should not. This fixes them. No wire shape changes.
The review read claude-agent-acp (
eb4c16f), codex-acp (ad09e0e) and Zed (07278eddc4a) on 2026-11-19.Changes
v1 draft Subagents page
session/promptresponse. When it reports back, the parent can work on the result with nosession/promptpending, and the Agent sends the parent's updates and requests with the parent'ssessionId. No prompt response reports that this work stopped, andsession/cancelfor the parent cancels it.subagents. It ends the parent's turn at its result while background children run, and itssession/cancelhandler interrupts the query whether or not a prompt is pending.config_option_updatethat arrives before thesession/loadresponse is historical. The page said this only forcapabilitiesandstate. The existing MUST NOT on presenting old configuration as current now covers it.Subagents and tool call pages, v1 draft and v2
sessionreference does not report the message, and that the Agent reports it as a session-directed message.v1 schema descriptions
idlevariant ofStateUpdateandIdleStateUpdatesaid "The child is ready to process another prompt". A Client cannot prompt a child. They now say "Foreground work is not in progress. The parent can give the child more work."RFD
Not changed
schema/v1/schema.json.schema/v1/schema.unstable.jsonchanges in two descriptions only.Checks
npm run checkpasses: Clippy, Prettier, the spell check and the tests.