Skip to content

fix: memory leak in chatInputPart - #327157

Open
Simon Siefke (SimonSiefke) wants to merge 3 commits into
microsoft:mainfrom
SimonSiefke:fix/memory-leak-chatInputPart
Open

fix: memory leak in chatInputPart#327157
Simon Siefke (SimonSiefke) wants to merge 3 commits into
microsoft:mainfrom
SimonSiefke:fix/memory-leak-chatInputPart

Conversation

@SimonSiefke

Copy link
Copy Markdown
Contributor

Details

Each tool confirmation carousel registers an onDidEmpty listener. Disposing or replacing the carousel did not dispose that listener, so its callback stayed registered for the lifetime of the chat input part.

Change

The change combines the carousel and its empty listener into one disposable entry so both are disposed together when the carousel is removed or replaced.

Before

When executing a terminal command from chat 37 times, the tool confirmation carousel callback grows each time (outlined in red):

chat-editor-execute-terminal-command-chatInputPart-before

After

No more leak is detected for this callback.

chat-editor-execute-terminal-command-chatInputPart-after

Test Video

chat-terminal-command-7-runs.mp4

Copilot AI review requested due to automatic review settings July 23, 2026 16:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a listener leak in chat tool confirmation carousels by tying listener disposal to carousel lifecycle.

Changes:

  • Stores each carousel with its onDidEmpty listener as one disposable.
  • Disposes both when the carousel is removed, replaced, or the input part is disposed.

…nputPart

# Conflicts:
#	src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants