Skip to content

Terminal execute strategies leak DisposableStore references across run_in_terminal invocations #313368

Description

@meganrogge

Each call to / creates a per-call DisposableStore and registers it on the strategy via this._register(store) (introduced in #310157 to clean up listeners if the strategy is disposed mid-flight).

Disposable._register calls this._store.add(store), putting the store into the parent's _toDispose Set. The finally { store.dispose(); } block disposes the children but does not remove the entry from the parent Set — only DisposableStore.delete(child) (or deleteAndLeak) does that.

Result: every successful execute() leaves a stale (already-disposed) DisposableStore referenced by the strategy.
Affected files:

  • src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.ts
  • src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.ts

Fix

Track in-flight stores in a dedicated _executionStores DisposableStore field and delete(store) on completion. This keeps the mid-flight disposal cleanup behavior from #310157 while removing the reference once execute() finishes.

Metadata

Metadata

Assignees

Labels

chat-terminalThe run in terminal tool in chatdebtCode quality issuesinsiders-releasedPatch has been released in VS Code Insiders

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions