Repository navigation
fix: defer ChatInputPart carousel max-height update to next animation frame (#316509) - #316524
Merged
Bryan Chen (bryanchen-d) merged 1 commit intoMay 15, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a Chromium ResizeObserver loop completed with undelivered notifications warning by deferring a descendant layout write (tool-confirmation carousel max-height) out of the ResizeObserver delivery phase, reducing re-entrant resize notifications under bursty input. The PR also includes a small terminal teardown/resizing hardening change to avoid re-entrant resizes during disposal.
Changes:
- Defer
ChatInputPart.updateToolConfirmationCarouselMaxHeight()to the next animation frame from theChatInputPart.containerHeightResizeObserver callback usingdom.AnimationFrameScheduler. - Make
TerminalProcessManager.setDimensionsa no-op when the manager is already disposed, and throw a clearer error when called beforeptyProcessReadyis initialized. - Dispose
TerminalInstance’s resize debouncer before disposing the process manager to prevent resize callbacks from running against torn-down process state.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts | Guard setDimensions against disposal re-entrancy and add a clearer pre-init failure mode. |
| src/vs/workbench/contrib/terminal/browser/terminalInstance.ts | Dispose _resizeDebouncer earlier in dispose() to prevent late resize callbacks during teardown. |
| src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.ts | Defer carousel max-height updates out of ResizeObserver callback via AnimationFrameScheduler. |
Copilot's findings
- Files reviewed: 3/3 changed files
- Comments generated: 1
Bryan Chen (bryanchen-d)
force-pushed
the
brchen/fix-chat-input-resize-loop-316509
branch
from
May 15, 2026 00:11
202918d to
4b0aa24
Compare
Bryan Chen (bryanchen-d)
marked this pull request as ready for review
May 15, 2026 00:13
Justin Chen (justschen)
approved these changes
May 15, 2026
Justin Chen (justschen)
left a comment
Collaborator
There was a problem hiding this comment.
ah gotcha. thanks for giving this a look!
Bryan Chen (bryanchen-d)
deleted the
brchen/fix-chat-input-resize-loop-316509
branch
May 15, 2026 17:06
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.
Summary
Fixes the
ResizeObserver loop completed with undelivered notificationswarning attributed to[DisposableResizeObserver(ChatInputPart.containerHeight)]in error telemetry.The
ChatInputPart.containerHeightresize observer's callback calledupdateToolConfirmationCarouselMaxHeight()synchronously. That writesstyle.maxHeighton the tool-confirmation carousel — a descendant of the observedthis.container. Under flexbox, the descendant's height change flexes back up into the observed container, causing the browser to re-queue a notification for the same observer. When external mutations (rapid type+Enter) keep arriving during the next observation phases, Chromium's loop algorithm exhausts its depth budget and emits the synthetic warning.This change defers only the carousel max-height write to the next animation frame via
AnimationFrameScheduler. Publishingthis.heightvia the observable stays synchronous because its autorun consumers re-layout siblings/ancestors of the input container (the message list, welcome container, view pane), not the container itself, so they do not feed back into the same observation phase.Fixes #316509
Trigger scenarios
maxHeight - otherInputHeight).setMaxHeightinside the RO callback to materially shrink the carousel, which propagates back up tothis.container, which the browser flags as an undelivered notification.Code flow diagram
sequenceDiagram participant User participant Browser participant Observer participant InputPart participant Carousel participant Flex User->>Browser: rapid type plus Enter Browser->>Browser: container resizes Browser->>Observer: deliver notification at depth D Observer->>InputPart: updateToolConfirmationCarouselMaxHeight InputPart->>Carousel: setMaxHeight budget minus otherInputHeight Carousel->>Flex: write style maxHeight and carousel shrinks Flex->>Browser: container offsetHeight changed at depth D Browser->>Browser: active observation pending at depth not greater than D Note over Browser: another external resize arrives before phase drains Browser->>User: dispatches ResizeObserver loop completed with undelivered notificationsHow the fix works
src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.tsupdateToolConfirmationCarouselMaxHeight()in anAnimationFrameSchedulerso the descendant write that flexes back up into the observed container happens outside the resize-observation phase.this.height.set(newHeight, undefined)synchronous so parent layout (message list, welcome container) tracks the input height with no perceptible 1-frame lag.Manual validation steps
Run Devtask).ResizeObserver loop completed with undelivered notifications, surfaced as an error-telemetry event with attribution[DisposableResizeObserver(ChatInputPart.containerHeight)].