-
Notifications
You must be signed in to change notification settings - Fork 2.5k
FIX: streamify was appending StatusStreamingCallback directly to the shared settings.callbacks list #9073
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
e7a8f45 to
2497b19
Compare
chenmoneygithub
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for spotting the bug and putting up the PR!
|
@chenmoneygithub just bumping this in case you missed the notif about the new commit fixing the issue you brought up |
chenmoneygithub
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the updates and reminder! One comment about the testing, then it should be good to go!
tests/streaming/test_streaming.py
Outdated
|
|
||
|
|
||
| @pytest.mark.anyio | ||
| async def test_default_then_custom_status_message_provider(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to refactor the testing a bit - instead of default => custom, we can put up two threads that apply different MyStatusMessageProvider, and verify that both threads work as expected. Then at the end we verify that the callback is not being modified.
…th original callback verification
|
@chenmoneygithub The latest commit incorporates your feedback on the tests. Please let me know if you see anything else that needs adjustment. Just flagging this touches a production bug -- ie we're running on our fork but looking forward to moving back to main whenever you get a chance to review. |
Fix streaming status message callback mutation
Bug
streamifywas appendingStatusStreamingCallbackdirectly to the sharedsettings.callbackslist.That list was mutated in place and reused across calls, callbacks (and their status message providers) leaked between different
dspy.streamify(...)invocations.Fix
Each call to
streamifynow works on an isolated callback list by copying the global callbacks before modification.This prevents callback leakage between programs, ensures that custom status message providers only affect the specific program they are passed to, and restores the correct, deterministic status message behavior required by the tests.