feat: enable concurrent surface support by tracking root IDs per surface#1037
Merged
nan-yu merged 2 commits intogoogle:mainfrom Apr 1, 2026
Merged
feat: enable concurrent surface support by tracking root IDs per surface#1037nan-yu merged 2 commits intogoogle:mainfrom
nan-yu merged 2 commits intogoogle:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the streaming parser to support multiple concurrent surfaces by replacing the single _root_id with a mapping of surface IDs to root IDs and introducing an _unbound_root_id for cases where the root is identified before the surface. Review feedback identifies a regression in handling default root IDs for protocol versions like v0.9 and points out a bug in the metadata sniffing logic where the persistence of surface_id across messages can lead to incorrect root associations.
02f96b2 to
4d93dd7
Compare
This handles cases when parsing multiple A2UI beginRendering payloads back-to-back in the same token stream (as seen in multi_surface.json), the parser mistakenly overwrites the internal root_id tracker. With the new change, the streaming parser is able to cleanly interpret interleaved UI topologies in real-time gracefully.
gspencergoog
approved these changes
Apr 1, 2026
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.
This handles cases when parsing multiple A2UI beginRendering payloads back-to-back in the same token stream (as seen in multi_surface.json), the parser mistakenly overwrites the internal root_id tracker.
With the new change, the streaming parser is able to cleanly interpret interleaved UI topologies in real-time gracefully.
Description
Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.
List which issues are fixed by this PR. For larger changes, raising an issue first helps reduce redundant work.
Pre-launch Checklist
If you need help, consider asking for advice on the discussion board.