Open
Conversation
soulFood5632
previously approved these changes
Mar 12, 2026
Member
soulFood5632
left a comment
There was a problem hiding this comment.
LGTM, thanks for the investigation
…fset" to "callbacks process sequentially"
…7_braodcast_bug
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.
Closes #887
What does this add?
This PR improves the reliability of the pubsub system by changing subscriber execution from concurrent to sequential inside the publisher.
Previously, subscribers were executed using:
During session shutdown, this could result in subscriber tasks being cancelled before completion, causing certain callbacks (e.g., broadcast callbacks used for observability) to silently fail.
This PR changes execution to:
This ensures subscribers complete deterministically and prevents callbacks from being interrupted during shutdown.
Type of changes
Background context
While investigating issues with
rt.broadcast(), we discovered that pubsub subscribers were executed concurrently viaasyncio.gather. During session shutdown this could lead to subscriber tasks being cancelled before they finished executing, causing broadcast callbacks to never trigger.Although
rt.broadcast()is moving away from being exposed as a public API (with the newer Flow-based execution model handling observability), sequential subscriber execution improves overall reliability of the pubsub pipeline and prevents silent callback failures.Checklist for Author
Code Quality
ruff check .andruff format .)Testing
pytest tests)Documentation
Git & PR Management