Repository navigation
Release inline request edit input and listeners when editing finishes - #337895
Merged
Dmitriy Vasyura (dmitrivMS) merged 6 commits intoSep 26, 2026
Merged
Conversation
ChatWidget.createInput registered its listeners and autoruns on the widget store also when creating the inline edit input, so every inline edit kept the disposed input part, its editor and the edited request alive until the widget was disposed. Scope them to the edit. Related to #146841 Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Persistent references and a dynamic autorun can still retain the completed inline edit, while the test bypasses the affected path.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 2
Open (3)
What changed in this PR
Scopes inline request-edit resources to each edit lifecycle to prevent listener and DOM retention.
Changes:
- Adds a per-edit disposable store.
- Disposes edit listeners and services when editing finishes.
- Adds listener cleanup coverage.
| File | Description |
|---|---|
chatWidget.ts |
Scopes inline-edit resources and listeners. |
chatWidget.test.ts |
Adds edit-listener cleanup testing. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…e input holders - createInput subscribes to the input it created instead of the active one, so the main input's autoruns cannot switch to the inline input during an edit - finishedEditing clears the inline input and paste target holders instead of only disposing the input - only the main input gets the getting-started tip presenter - test the inline edit path Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Dmitriy Vasyura (dmitrivMS)
marked this pull request as ready for review
September 25, 2026 21:35
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
September 25, 2026 21:35
Dileep Yavanmandha (dileepyavan)
previously approved these changes
Sep 25, 2026
roblourens
previously approved these changes
Sep 25, 2026
…ne-edit-input # Conflicts: # src/vs/workbench/contrib/chat/browser/widget/chatWidget.ts
Dmitriy Vasyura (dmitrivMS)
dismissed stale reviews from roblourens and Dileep Yavanmandha (dileepyavan)
via
September 26, 2026 19:28
dcd47b4
Bhavya U (bhavyaus)
approved these changes
Sep 26, 2026
Contributor
Screenshot ChangesBase: Changed (2)2 insignificant change(s) omitted (≤20 px, Δ≤2). See CI logs for details. |
Dmitriy Vasyura (dmitrivMS)
deleted the
agents/leak-chat-inline-edit-input
branch
September 26, 2026 20:00
Abdon Morales (abdonmorales)
pushed a commit
to abdonmorales/vscode-utcs
that referenced
this pull request
Sep 27, 2026
…microsoft#337895) * Release inline request edit input and listeners when editing finishes ChatWidget.createInput registered its listeners and autoruns on the widget store also when creating the inline edit input, so every inline edit kept the disposed input part, its editor and the edited request alive until the widget was disposed. Scope them to the edit. Related to microsoft#146841 Co-authored-by: Copilot <[email protected]> * Bind inline edit subscriptions to their own input and clear the inline input holders - createInput subscribes to the input it created instead of the active one, so the main input's autoruns cannot switch to the inline input during an edit - finishedEditing clears the inline input and paste target holders instead of only disposing the input - only the main input gets the getting-started tip presenter - test the inline edit path Co-authored-by: Copilot <[email protected]> * Add the per-edit disposables holder to the inline edit renderer test Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]> (cherry picked from commit f8db09b) Adapted for VSCode-UTCS: this fork has no customization migration notice, so only the getting-started tip is skipped while a request is edited. Upstream's chatWidget.test.ts additions depend on test helpers from features this fork did not take and are left out. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01UoeuD6W9qnRA5qYK2dNZvP
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.


Related to #146841
With the default
chat.editRequests: inline, clicking a request creates an inlineChatInputPartthroughChatWidget.createInput.createInputregisters about 10 listeners and autoruns on the widget's own store (onDidLoadInputState,onDidFocus,onDidAcceptFollowup,inputEditor.onDidChangeModelContent,chatAgentService.onDidChangeAgents,input.onDidChangeCurrentChatMode,contextKeyService.onDidChangeContext, two autoruns, and the scoped instantiation service), andclickedRequestadds 3 more listeners. They were only released when the whole widget was disposed, so every edit left them behind:selectedToolsModel.entriesMap/selectedLanguageModel, keeping them subscribed to the globalLanguageModelToolsService.toolSets, and through them the disposed input part, itsCodeEditorWidget,TextModeland DOM;chatAgentService.onDidChangeAgents,contextKeyService.onDidChangeContext);ChatRequestModel/ChatResponseModelstayed alive too.Edit-only disposables now go into a per-edit
DisposableStore(_editingDisposables), whichcreateInputreceives for the inline input and which is cleared infinishedEditing. The main input keeps using the widget's store.createInputsubscribes to the input part it created rather than the active one (this.input), so the main input's autoruns can't switch to the inline input while an edit is open.finishedEditingclears the inline input and paste-target holders instead of only disposing the input, and only the main input gets the getting-started tip presenter (the tip only applies to the empty state; previously an edit replaced the main input's presenter and left it bound to the disposed inline input).Retainer path (heap snapshot):
LanguageModelToolsService.toolSets._observers → Derived (ChatSelectedTools.entriesMap) → AutorunObserver (ChatWidget._store), andObservableValue (owner ChatInputModelSelectionController) → ChatInputPart.container → <div class="chat-edit-input-container">Measurement
How this was measured
Code OSS (Electron, dev build) with the mock LLM server from
scripts/chat-simulation(no sign-in), driven over CDP with Playwright. After a warm-up round and after each of 4 rounds: 4× forced GC, live instance counts viaRuntime.queryObjectson the class prototypes, andDOM.getDetachedDomNodes(descendants of every detached root, queried from a throwaway CDP session). "Without this change" means only this fix reverted. The retainers were identified from heap snapshot retainer paths.Added a
ChatWidgettest for the inline edit path: it creates the main input, starts and finishes an inline edit, and checks that the inline input, its scoped instantiation service, listeners and autoruns are released, and that the main input keeps its tip presenter (fails without this change).