Repository navigation
telemetry: report ResizeObserver delivery context - #328065
Merged
Bryan Chen (bryanchen-d) merged 2 commits intoJul 29, 2026
Merged
Conversation
The browser's ResizeObserver loop ErrorEvent contains only a generic message; it does not expose the skipped target or causative callback. Prefixing that warning with the most recently invoked DisposableResizeObserver therefore turned callback order into false causal attribution. Record the wrapped observers that ran in the current rendering frame instead. Context is scoped per window, deduplicated, sorted for stable bucketing, and bounded to the canonical smallest eight names plus an overflow marker. The telemetry prefix explicitly calls these recent wrapped observers rather than an offending consumer. Clear context at the next animation frame, after Blink dispatches any loop warning from the current rendering update. Unit coverage locks deduplication, canonical overflow, window isolation, and frame cleanup; a real Chromium component fixture deliberately triggers a self-resize loop and verifies context survives until the native warning. Co-authored-by: Copilot <[email protected]> Copilot-Session: aacd276e-cf84-48bd-a2ab-6f6a4d4c3431
Dmitriy Vasyura (dmitrivMS)
previously approved these changes
Jul 29, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Replaces misleading ResizeObserver causal attribution with deterministic, per-window delivery context.
Changes:
- Tracks up to eight sorted, distinct wrapped observers per rendering frame.
- Updates telemetry to report observer context rather than the last callback.
- Adds unit and Chromium fixture coverage.
Show a summary per file
| File | Description |
|---|---|
src/vs/base/browser/dom.ts |
Implements bounded per-window observer context. |
src/vs/base/test/browser/dom.test.ts |
Tests sorting, deduplication, overflow, isolation, and clearing. |
src/vs/platform/telemetry/browser/errorTelemetry.ts |
Reports the new context in error telemetry. |
src/vs/workbench/test/browser/componentFixtures/resizeObserver.fixture.ts |
Adds a real ResizeObserver loop probe. |
src/vs/workbench/test/browser/componentFixtures/chat/chatWidget.fixture.ts |
Exposes observer context in the chat harness. |
test/componentFixtures/playwright/tests/resizeObserverContext.spec.ts |
Verifies context survives through browser warning dispatch. |
test/componentFixtures/playwright/tests/chatResizeObserver.spec.ts |
Updates diagnostic logging for the new context. |
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 0
- Review effort level: Medium
ResizeObserverLoopContext already identifies the observer names as non-causal context, so remove the redundant ecentWrappedObservers= label from the emitted error string. Co-authored-by: Copilot <[email protected]> Copilot-Session: aacd276e-cf84-48bd-a2ab-6f6a4d4c3431
Dmitriy Vasyura (dmitrivMS)
approved these changes
Jul 29, 2026
Bryan Chen (bryanchen-d)
deleted the
copilot/vscode/resize-observer-phase-context
branch
July 29, 2026 22:53
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Problem
VS Code currently rewrites Chromium's stackless
ResizeObserver loop completed with undelivered notificationswarning with the name of the most recently invokedDisposableResizeObserver:The telemetry comments call that observer the "offending consumer," but callback order is not causality. A callback can mutate a different observed target, and an unrelated observer can run last before the browser dispatches the warning. This is how a real cross-observer virtualized-row lifecycle bug was attributed to both
ChatInputPart.containerHeightandChatListItemRenderer.itemHeight.The browser cannot provide the missing answer after the fact. Per the ResizeObserver processing model, skipped targets stay in internal
[[skippedTargets]];Deliver Resize Loop Errorcreates anErrorEventwith only the generic message. No observer, target, or causative callback is exposed to JavaScript.Change
Replace false causal attribution with honest delivery context:
CodeWindow, because auxiliary windows have independent documents and delivery loops;<overflow>so output is deterministic and finite;ResizeObserverLoopContextwrapper as the explicit non-causal label.Only
DisposableResizeObserverconsumers are included; rawResizeObserverconsumers remain outside this context.This changes the bucket shape on purpose. Existing per-last-callback buckets should not be interpreted as component failure rates.
Verification
npm run typecheck-client— passes.scripts/test.bat --grep "DisposableResizeObserver"— 10 passing:The fixture stops observation on the first warning so it cannot leak or spin.
Follow-up
This PR makes the cheap signal truthful; it does not claim to recover exact causality. A separate sampled diagnostic can trace callback → changed observed-target geometry/connectivity edges after the first warning. That work needs coverage/confidence gates and should not be mixed into the stable error bucket change.
Related: #293359, #316509, #316501, #327933.