Skip to content

docs(unstable): describe parent work after the prompt response for subagents - #2896

Merged
benbrandt merged 1 commit into
mainfrom
docs/subagents-v1-review-fixes
Nov 19, 2026
Merged

benbrandt merged 1 commit into
mainfrom
docs/subagents-v1-review-fixes

Conversation

@benbrandt

Copy link
Copy Markdown
Member

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

  • Parent work after the prompt response. New subsection under Work state. A child can keep running after the parent's session/prompt response. When it reports back, the parent can work on the result with no session/prompt pending, and the Agent sends the parent's updates and requests with the parent's sessionId. No prompt response reports that this work stopped, and session/cancel for the parent cancels it.
    • claude-agent-acp already does this for a Client that advertises subagents. It ends the parent's turn at its result while background children run, and its session/cancel handler interrupts the query whether or not a prompt is pending.
  • Replayed configuration. A child's config_option_update that arrives before the session/load response is historical. The page said this only for capabilities and state. The existing MUST NOT on presenting old configuration as current now covers it.

Subagents and tool call pages, v1 draft and v2

  • SDK buffering. Remove "A Client SDK may buffer traffic for a child it does not know yet". How an SDK handles a non-conforming Agent is not protocol behavior, as in docs(unstable): remove malformed-value handling from the spec text #2891.
  • Session references. The tool call pages said a message from a parent to a child is reported "not through a tool call". The Subagents pages say the tool call's input can also report it. The tool call pages now say that the session reference does not report the message, and that the Agent reports it as a session-directed message.

v1 schema descriptions

  • The idle variant of StateUpdate and IdleStateUpdate said "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

  • Remove the sentence on SDKs buffering early traffic.
  • Add revision entries for that removal and for the two new rules on the v1 draft page.

Not changed

  • The wire shapes, the Rust types and schema/v1/schema.json. schema/v1/schema.unstable.json changes in two descriptions only.
  • The stable v1 pages.
  • The v2 rules. The v2 pages change only in the two sentences above.

Checks

  • npm run check passes: Clippy, Prettier, the spell check and the tests.
  • Regenerating the schema a second time gives no diff.

…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
benbrandt requested a review from a team as a code owner November 19, 2026 20:41
@benbrandt
benbrandt enabled auto-merge (squash) November 19, 2026 20:42
@benbrandt
benbrandt merged commit 903e54d into main Nov 19, 2026
13 checks passed
@benbrandt
benbrandt deleted the docs/subagents-v1-review-fixes branch November 19, 2026 20:45
@acp-release-bot acp-release-bot Bot mentioned this pull request Nov 19, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant