Skip to content

feat: enable concurrent surface support by tracking root IDs per surface#1037

Merged
nan-yu merged 2 commits intogoogle:mainfrom
nan-yu:streaming-parser
Apr 1, 2026
Merged

feat: enable concurrent surface support by tracking root IDs per surface#1037
nan-yu merged 2 commits intogoogle:mainfrom
nan-yu:streaming-parser

Conversation

@nan-yu
Copy link
Copy Markdown
Collaborator

@nan-yu nan-yu commented Mar 30, 2026

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.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@nan-yu nan-yu force-pushed the streaming-parser branch from 02f96b2 to 4d93dd7 Compare March 31, 2026 16:59
nan-yu added 2 commits April 1, 2026 16:49
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.
@nan-yu nan-yu force-pushed the streaming-parser branch from 4d93dd7 to 4e63b75 Compare April 1, 2026 16:50
@nan-yu nan-yu merged commit 6884048 into google:main Apr 1, 2026
11 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in A2UI Apr 1, 2026
@nan-yu nan-yu deleted the streaming-parser branch April 1, 2026 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants