Skip to content

Stop logging surface resize traffic in the raw messages panel - #212

Closed
suyangw-g wants to merge 2 commits into
mainfrom
fix/filter-surface-resize-from-raw-messages
Closed

suyangw-g wants to merge 2 commits into
mainfrom
fix/filter-surface-resize-from-raw-messages

Conversation

@suyangw-g

Copy link
Copy Markdown
Contributor

Description

A guest reports SURFACE_RESIZE on every reflow of its content, and each
rendered surface runs its own guest, so a single host layout change — a
window resize, a splitter drag, a scrollbar appearing — emits one message
per surface. During a streaming response these filled the panel's
100 entry window and evicted the RENDER_A2UI and DATA_MODEL_CHANGE
traffic the view exists to show.

The type is now excluded alongside CONSOLE_LOG. The two exclusions were
previously checked in two separate places, once for the live stream and
once for the history replayed when the panel opens; both now read a single
set, so they cannot drift apart.

-    if (envelope.type === PreviewBridgeMessageType.CONSOLE_LOG) {
+    if (EXCLUDED_MESSAGE_TYPES.has(envelope.type)) {
       return;
     }

This hides the resize payloads from the panel entirely rather than offering
a toggle. If those payloads turn out to be worth inspecting — they are the
data you would read to diagnose a host/guest resize feedback loop — a type
filter in the template would be the follow-up.

Verification

yarn prettier:check, yarn lint, yarn tsc and yarn test pass.

Pre-launch Checklist

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

Copy link
Copy Markdown
Contributor

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 excludes high-frequency SURFACE_RESIZE messages from being logged in the raw messages debug panel, updating both the listener and the initial history buffer loading, and adds corresponding unit tests. The review feedback highlights a critical issue: filtering these messages only in the UI does not prevent them from flooding HostCommunication's internal messageHistoryBuffer, which would still evict other important messages. It is recommended to exclude SURFACE_RESIZE messages directly when pushing to the history buffer in HostCommunication.

@github-actions

github-actions Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

⚡ A2UI Composer PR Preview

Your automated preview is successfully live (commit 1394c02):
👉 Launch PR Preview

Note: This environment will be wiped automatically when the PR is merged or closed.

A guest reports SURFACE_RESIZE on every reflow of its content, and each
rendered surface runs its own guest, so one host layout change emits a
message per surface. During a streaming response these filled the
panel's 100 entry window and evicted the protocol traffic the view
exists to show.

The type is now excluded alongside CONSOLE_LOG through a single set,
applied both to the live stream and to the history replayed when the
panel opens.

HostCommunication keeps its own 100 entry buffer to seed that history,
so filtering in the panel alone would leave it showing nothing. Resize
messages are kept out of that buffer too, while still being broadcast
on messageStream$ because RenderedFrame uses them to size its iframe.
@suyangw-g
suyangw-g force-pushed the fix/filter-surface-resize-from-raw-messages branch from 91c13f4 to e958f94 Compare September 12, 2026 06:36
@suyangw-g
suyangw-g requested a review from jgindin September 12, 2026 07:10
Keep `ignores SURFACE_RESIZE messages completely` focused strictly on
ignoring `SURFACE_RESIZE` (mirrors `CONSOLE_LOG`). Add a companion test
that emits all non-excluded `PreviewBridgeMessageType` values to ensure
none are accidentally ignored. Also replace `POST_MSG_1` in the seeded
history test with `PreviewBridgeMessageType.RENDER_A2UI`.
@suyangw-g
suyangw-g requested a review from jgindin September 15, 2026 23:43

@jgindin jgindin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm absolutely in favor of this change.

However, there's an actual bug that I'm looking into, where we get into a storm of these resize messages. I'd like to hold off on this PR until after that gets fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants