Fix multi-diff and native host event leaks - #328317
Merged
hediet merged 3 commits intoJul 31, 2026
Merged
Conversation
Wait for both model reference acquisitions and dispose any successful references when the other side fails or the cached item is removed.\n\n(Written by Copilot)\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Makes multi-diff model reference acquisition more failure-safe by ensuring partial successes are disposed when the other acquisition fails, and by handling disposal during in-flight acquisition.
Changes:
- Switched from
Promise.alltoPromise.allSettledfor original/modified model reference acquisition. - Disposes successfully acquired references when the other acquisition fails.
- Disposes acquired references if the parent
storewas disposed while acquisitions were in progress.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditorInput.ts | Ensures model references are cleaned up correctly across partial failures and disposal during acquisition |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 2
- Review effort level: Lite
Preserve handling for synchronous model-reference failures and make rejection selection easier to follow.\n\n(Written by Copilot)\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
hediet
approved these changes
Jul 31, 2026
hediet
marked this pull request as ready for review
July 31, 2026 09:14
hediet
enabled auto-merge (rebase)
July 31, 2026 09:17
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.
Problem
This fixes two independent leaks surfaced by disposable and event-buffer diagnostics.
Failed multi-diff model resolution
Opening the Agents window Changes multi-diff can attempt to resolve entries that cannot be opened as text, such as a directory or binary file. If either
createModelReferencecall rejected, the surroundingPromise.allreturned immediately without disposing the per-itemDisposableStore. A reference acquired by the other call could also be lost without disposal, including when that call completed after its sibling had already rejected.This produced
[LEAKED DISPOSABLE]warnings rooted inMultiDiffEditorInput._createModeland could retain text model references after failed multi-diff item resolution.Unconsumed native host blur buffer
ProxyChannel.fromServiceeagerly subscribes to and buffers service events so startup events can be replayed when an IPC client attaches.onDidBlurMainWindowhas no IPC consumer, so every main-window blur was retained indefinitely and the eager proxy subscription was unnecessary. In dev builds this produced an[Event.buffer][onDidBlurMainWindow] potential LEAK detectedwarning after buffered events remained unconsumed.This is long-standing rather than a recent regression:
42f5594892(2023-11-02) split focus/blur into main-only and main-or-auxiliary events. Renderer consumers moved to the combined event, leaving the main-only blur buffer without an IPC listener.a837f16fbe(2026-02-28) addedEvent.bufferleak diagnostics, making the existing unbounded buffer visible.The main-only focus event remains buffered intentionally because Settings Sync consumes it through the shared-process native host channel.
Fix
Promise.allSettledunbufferedEventsproxy-channel option that subscribes only when an IPC client listensonDidBlurMainWindowlazy/unbuffered while preserving the event API for future consumersCC @hediet, who authored the original multi-diff model-resolution path.
Validation
npm run gulp compilenpm run typecheck-client./scripts/test.sh --run src/vs/base/parts/ipc/test/common/ipc.test.ts(23 passing)npm run precommit(Written by Copilot)