Skip to content

fix(streaming): accumulate container from message_delta in non-beta helper - #1802

Open
Joon-June wants to merge 1 commit into
anthropics:mainfrom
Joon-June:fix/streaming-accumulate-container
Open

fix(streaming): accumulate container from message_delta in non-beta helper#1802
Joon-June wants to merge 1 commit into
anthropics:mainfrom
Joon-June:fix/streaming-accumulate-container

Conversation

@Joon-June

Copy link
Copy Markdown

What

The non-beta streaming accumulator (lib/streaming/_messages.py) does not copy event.delta.container into the message snapshot, while the beta accumulator (lib/streaming/_beta_messages.py) does. As a result, a final message built by client.messages.stream() always has container=None, even when the server delivers the id on message_delta — breaking code-execution container reuse for non-beta streaming users (the id is needed as the container request parameter on follow-up requests).

This PR mirrors the beta accumulator's line into the non-beta accumulate_event, plus a fixture + test asserting the accumulated message carries the container id.

Test

tests/lib/streaming/test_messages.py — new test_container_accumulated_from_message_delta using a fixture whose message_delta carries a container object; full file passes (14/14).

Related

Found while investigating #1801 (server-side: the pause-for-client-tool response omits container entirely). This PR is the independent client-side half: even when the server does send the id, the non-beta helper drops it.

…elper

The beta accumulator copies event.delta.container into the message
snapshot, but the non-beta accumulator does not — so a final message
built by client.messages.stream() loses the container id even when the
server sends it, breaking code-execution container reuse for non-beta
streaming users.
@Joon-June
Joon-June requested a review from a team as a code owner August 5, 2026 07:01
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