fix(streaming): accumulate container from message_delta in non-beta helper - #1802
Open
Joon-June wants to merge 1 commit into
Open
fix(streaming): accumulate container from message_delta in non-beta helper#1802Joon-June wants to merge 1 commit into
Joon-June wants to merge 1 commit into
Conversation
…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.
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.
What
The non-beta streaming accumulator (
lib/streaming/_messages.py) does not copyevent.delta.containerinto the message snapshot, while the beta accumulator (lib/streaming/_beta_messages.py) does. As a result, a final message built byclient.messages.stream()always hascontainer=None, even when the server delivers the id onmessage_delta— breaking code-execution container reuse for non-beta streaming users (the id is needed as thecontainerrequest 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— newtest_container_accumulated_from_message_deltausing a fixture whosemessage_deltacarries acontainerobject; full file passes (14/14).Related
Found while investigating #1801 (server-side: the pause-for-client-tool response omits
containerentirely). This PR is the independent client-side half: even when the server does send the id, the non-beta helper drops it.