Repository navigation
fix(stream): preserve explicitly provided empty storage - #3498
Merged
vvlrff merged 5 commits intoOct 25, 2026
Merged
Conversation
BichengWang
suggested changes
Oct 24, 2026
BichengWang
left a comment
Contributor
There was a problem hiding this comment.
The new regression test fails at this head: python -m pytest -q test/stream --ignore=test/stream/redis gives 1 failed, 48 passed. At test/stream/test_custom_storage.py:31, ModelMessage is transient, so the default stream intentionally filters it out before saving. The history assertion therefore gets [] even with the production fix.
Please use a persisted event such as ModelRequest([TextInput("hello")]), or explicitly set persist_all=True. I separately checked a persisted request with both persistence modes and history reuse: those checks fail on main and pass here, so the storage selection change itself addresses the reported bug.
Collaborator
|
@fallintoplace Thanks! |
vvlrff
enabled auto-merge
October 25, 2026 12:36
vvlrff
approved these changes
Oct 25, 2026
5 of 6 tasks
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.
Why are these changes needed?
What: Keep an explicitly supplied storage backend, even when it is empty.
Why: A length-aware storage can be falsy before its first event.
MemoryStreamwould silently replace it with a newMemoryStorage, so events went to the wrong backend.Implementation: Check
storage is not Nonerather than truthiness. Add a regression test with an initially empty storage that implements__len__.Related issue number
None.
Checks
Local validation: reproduced the fallback behavior in isolation and syntax-checked the regression test. Full AG2 tests were not run because project dependencies are unavailable locally.
AI assistance