Repository navigation
fix: defer terminal tool confirmation editor layout to next animation frame (fixes #333221) - #333227
Open
VS Code PR Bot (vscodebot-pr) wants to merge 2 commits into
Conversation
… frame (fixes microsoft#333221) Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Defers terminal confirmation editor layout to prevent self-feeding ResizeObserver warnings.
Changes:
- Coalesces width updates with
AnimationFrameScheduler. - Disposes the scheduler with the confirmation subpart.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…ondense resize comment to a single line Co-authored-by: Copilot <[email protected]>
Contributor
Driver cycle recordederrors-fix-driver:cycle head:5da7bc8f59e58a77618d8900e124681a7afdbb9d |
Contributor
|
Merge conflicts with |
Contributor
|
Follow-up paused after 40 completed driver attempts; human intervention is required. |
This branch has not been deployed
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.
Summary
ResizeObserver loop completed with undelivered notificationsis firing across the chat confirmation surface. The synthetic browser warning carries only non-causal delivery context (ResizeObserverLoopContext(...)) listing the wrapped observers that ran in the same rendering frame — the browser does not expose the actual observer that skipped a delivery. Among the listed observers, the one that synchronously writes layout back into its own observed element isChatTerminalToolConfirmationSubPart.editor, which callseditor.object.layout(width)inside the resize callback; that write flexes the embedded editor's height back into the observedelements.editor, re-entering the same observation phase and tripping the loop warning under bursty resizes. Impact: noisy unhandled-error telemetry (spike on1.136.0-insider), no functional break.Fixes #333221
Recommended reviewer:
@bryanchen-dCulprit Commit
No single culprit commit introduced this regression. The observers named in the bucket context (
BaseChatConfirmationWidget.message,BaseChatConfirmationWidget.messageContent,ChatInputPart.containerHeight,ChatTerminalToolConfirmationSubPart.editor,ChatThinkingContentPart.wrapper,ChatToolConfirmationCarouselPart.contentExpansion) all pre-date the08d4889f...3fcbd108regression window — a-Ssearch for each name inside the range returns nothing. The[ResizeObserverLoopContext(...)]bucketing format itself was introduced in #328065 (Jul 29), also before the window.This is the same self-feeding pattern previously fixed for
ChatInputPart.containerHeightin #316524 (fixes #316509), recurring in a sibling widget. The spike is best explained by increased exercise of the terminal tool confirmation surface rather than a new triggering commit, so the bug is treated as pre-existing and the fix is applied at the self-feeding write site.Code Flow
sequenceDiagram participant Browser as Browser layout participant Observer as ChatTerminalToolConfirmationSubPart.editor observer participant Editor as editor.object participant Site as elements.editor (observed) Browser->>Observer: deliver resize entry (width) Note over Observer: ⚠️ Root cause:<br/>synchronous editor.object.layout(width) Observer->>Editor: layout(width) Editor->>Site: height flexes back into observed element Site->>Browser: resize re-entered in same phase Note over Browser: 💥 ResizeObserver loop completed<br/>with undelivered notificationsAffected Files
src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.tsnew DisposableResizeObserver('ChatTerminalToolConfirmationSubPart.editor', entries => { ... editor.object.layout(width); })— synchronous layout write into the observed elementsrc/vs/base/browser/dom.tsgetRecentDisposableResizeObserverContextForLoopError— names are delivery context only, "not causal attribution"src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.tsRepro Steps
ChatTerminalToolConfirmationSubPartembedded editor renders.ResizeObserver loop completed with undelivered notificationswarning surface in error telemetry. It is timing-dependent; bursty width changes within a single rendering frame increase the likelihood of the browser skipping a delivery.How the Fix Works
Chosen approach — In
chatTerminalToolConfirmationSubPart.ts, the resize callback no longer callseditor.object.layout(width)synchronously. It records the last observed width and schedules the layout on the next animation frame via anAnimationFrameScheduler(disposed with the part). Deferring the layout write out of the resize-observation phase breaks the self-feeding loop while preserving the resize behavior — the editor still lays out to the observed width, just one frame later. This fixes the problem at the site that produces the feedback write (the self-resizing layout call), not at a crash site or by suppressing the warning, and it reuses the exact pattern already proven forChatInputPart.containerHeightin #316524.Alternatives considered — Wrapping the layout call in
try/catchwas rejected because the warning is delivered as a stacklessErrorEventonwindow, not thrown at the call site, so a local catch would not suppress it and would hide nothing useful. Widening or muting the telemetry context indom.tswas rejected because that helper is intentionally non-causal delivery context and other observers legitimately rely on it.Recommended Owner
@bryanchen-d— authored the precedent fix #316524 and the ResizeObserver delivery-context telemetry (#328065, #2613d4a naming), owns the chat confirmation widget area, and is the current issue assignee.