Repository navigation
fix: memory leaks in chat widgets - #326876
Merged
Dmitriy Vasyura (dmitrivMS) merged 3 commits intoAug 13, 2026
Merged
Dmitriy Vasyura (dmitrivMS) merged 3 commits into
Dmitriy Vasyura (dmitrivMS) merged 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Prevents chat widget lifecycle listeners from being retained after widgets close.
Changes:
- Adds an
onDidRemoveWidgetlifecycle event. - Disposes per-widget listeners in voice and agent-host controllers.
- Adds focused regression tests and updates mocks.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/vs/workbench/contrib/chat/browser/chat.ts |
Adds the removal event contract. |
src/vs/workbench/contrib/chat/browser/widget/chatWidgetService.ts |
Emits widget removal events. |
src/vs/workbench/contrib/chat/browser/voiceClient/voiceSessionController.ts |
Disposes widget session listeners. |
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostModeSynchronizer.ts |
Disposes widget mode listeners. |
src/vs/workbench/contrib/chat/test/browser/voiceClient/voiceSessionController.test.ts |
Tests voice listener cleanup. |
src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostModeSynchronizer.test.ts |
Tests mode listener cleanup. |
src/vs/workbench/contrib/chat/test/browser/widget/mockChatWidget.ts |
Updates the widget service mock. |
src/vs/workbench/test/browser/workbenchTestServices.ts |
Updates shared test services. |
Collaborator
|
Simon Siefke (@SimonSiefke) Please resolve conflicts. |
Simon Siefke (SimonSiefke)
force-pushed
the
fix/memory-leaks-chat
branch
from
August 13, 2026 10:36
3b425e2 to
2c5c941
Compare
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
August 13, 2026 11:08
Dmitriy Vasyura (dmitrivMS)
approved these changes
Aug 13, 2026
Henning Dieterichs (hediet)
approved these changes
Aug 13, 2026
Dirk Bäumer (dbaeumer)
approved these changes
Aug 13, 2026
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.
Details
When a chat editor is opened, services like
voiceSessionControlleradd event listeners to the chat widgets. But it seems those event listeners are not removed when the chat widget or chat editor closes.Change
The change ensures that chat widgets event listeners like in
voiceSessionControlleror agentHostModeSynchronizerare being removed when the chat widget gets disposed.Before
When opening two chat editors then closing all editors 37 times, the number of various functions seems to grow each time:
After
When opening two chat editors then closing all editors 37 times, all but one function count stay constant:
Test Video
video-edited.mp4