Skip to content

docs(unstable-v2): say replay should not include past session state updates - #2881

Merged
benbrandt merged 1 commit into
mainfrom
docs/v2-replay-session-state-updates
Nov 19, 2026
Merged

benbrandt merged 1 commit into
mainfrom
docs/v2-replay-session-state-updates

Conversation

@benbrandt

Copy link
Copy Markdown
Member

Summary

On a resume with replay, four update types describe session state, not conversation history: usage_update, session_info_update, config_option_update and available_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/resume response carries the current lists. Session info and usage have no such backstop: a current session_info_update after the replay is a SHOULD and a current usage_update is 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_update and notices, and SHOULD NOT be replayed. The standalone "Agents need not replay" paragraph is removed. Changed in the stable page and its draft/ 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-acp excludes usage_update and session_info_update from history. It holds them during a replay and sends them after replay_complete.
  • claude-agent-acp sends only replayed history between the request and replay_complete, and holds every other update until after it.

Checks

  • Prettier and typos pass on the changed files.
  • All links and anchors in the changed files resolve.

…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
benbrandt requested a review from a team as a code owner November 19, 2026 09:14
@benbrandt
benbrandt enabled auto-merge (squash) November 19, 2026 09:15
@benbrandt
benbrandt merged commit c93a8d9 into main Nov 19, 2026
10 checks passed
@benbrandt
benbrandt deleted the docs/v2-replay-session-state-updates branch November 19, 2026 09:18
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