Repository navigation
docs(unstable-v2): say replay should not include past session state updates - #2881
Merged
Merged
Conversation
…pdates The session setup page said Agents "need not" replay historical `usage_update`, `session_info_update`, `config_option_update` and `available_commands_update` notifications, which still allowed it. An Agent that replayed old ones and sent no current value could leave the Client showing an old title or cost. Move the four update types into the "Replay does not include" list and say they SHOULD NOT be replayed, like notices. The rules for sending current values after a replay are unchanged.
benbrandt
enabled auto-merge (squash)
November 19, 2026 09:15
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
On a resume with replay, four update types describe session state, not conversation history:
usage_update,session_info_update,config_option_updateandavailable_commands_update. The session setup page said Agents "need not" replay historical ones, which still allowed it.Config options and commands are safe either way, because the
session/resumeresponse carries the current lists. Session info and usage have no such backstop: a currentsession_info_updateafter the replay is a SHOULD and a currentusage_updateis a MAY. An Agent that replayed old ones and sent no current value could leave the Client showing an old title or cost.Change
The four update types move into the "Replay does not include" list, next to
state_updateand notices, and SHOULD NOT be replayed. The standalone "Agents need not replay" paragraph is removed. Changed in the stable page and itsdraft/copy.The rules for sending current values after a replay are unchanged.
Implementations
Checked on 2026-11-18 against the default branch of each repository.
codex-acpexcludesusage_updateandsession_info_updatefrom history. It holds them during a replay and sends them afterreplay_complete.claude-agent-acpsends only replayed history between the request andreplay_complete, and holds every other update until after it.Checks
typospass on the changed files.