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.
Each call to / creates a per-call
DisposableStoreand registers it on the strategy viathis._register(store)(introduced in #310157 to clean up listeners if the strategy is disposed mid-flight).Disposable._registercallsthis._store.add(store), putting the store into the parent's_toDisposeSet. Thefinally { store.dispose(); }block disposes the children but does not remove the entry from the parent Set — onlyDisposableStore.delete(child)(ordeleteAndLeak) does that.Result: every successful
execute()leaves a stale (already-disposed)DisposableStorereferenced by the strategy.Affected files:
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.tssrc/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.tsFix
Track in-flight stores in a dedicated
_executionStoresDisposableStore field anddelete(store)on completion. This keeps the mid-flight disposal cleanup behavior from #310157 while removing the reference onceexecute()finishes.