Skip to content

Fix disposed SCM source control retention#311284

Merged
lszomoru merged 2 commits intomainfrom
roblou/fix-scm-source-control-disposal
Apr 20, 2026
Merged

Fix disposed SCM source control retention#311284
lszomoru merged 2 commits intomainfrom
roblou/fix-scm-source-control-disposal

Conversation

@roblourens
Copy link
Copy Markdown
Member

This fixes an extension-host SCM bookkeeping leak where disposed source controls remained reachable from ExtHostSCM after they had been unregistered from the main thread.

Disposed source controls are now removed from both handle-based and extension-based bookkeeping when onDidDispose fires. This allows disposed Git repositories and their refs/history/artifact state to be collected instead of staying alive through stale SCM provider references.

Fixes #311282

Validation:

  • VS Code - Build task output was clean for Core Transpile, Core Typecheck, Ext Build, and Copilot Build.
  • Focused unit test passed: disposed source controls are removed from extension bookkeeping.
  • Hygiene passed for the changed TypeScript files with only the existing TypeScript-version warning from @typescript-eslint/typescript-estree.

(Written by Copilot)

Remove disposed source controls from extension-host SCM bookkeeping so they no longer retain repository state after unregistering from the main thread.

(Written by Copilot)
Copilot AI review requested due to automatic review settings April 20, 2026 00:43
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 20, 2026

Screenshot Changes

Base: 12dce43c Current: 3610c6fc

Changed (1)

editor/inlineCompletions/other/JumpToHint/Dark
Before After
before after

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes an extension-host SCM retention/leak by ensuring disposed SourceControl instances are removed from ExtHostSCM bookkeeping, allowing disposed repositories and related state to be garbage-collected.

Changes:

  • Remove disposed source controls from both handle-based (_sourceControls) and extension-based (_sourceControlsByExtension) maps on onDidDispose.
  • Add a regression unit test asserting disposed source controls no longer appear in extension bookkeeping (getLastInputBox becomes undefined).
Show a summary per file
File Description
src/vs/workbench/api/common/extHostSCM.ts Hooks onDidDispose to delete disposed providers from ExtHostSCM maps to prevent retention.
src/vs/workbench/api/test/common/extHostSCM.test.ts Adds a focused regression test validating extension bookkeeping is cleared after disposal.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

@lszomoru lszomoru marked this pull request as ready for review April 20, 2026 10:53
@lszomoru lszomoru enabled auto-merge (squash) April 20, 2026 10:53
@lszomoru lszomoru added this to the 1.118.0 milestone Apr 20, 2026
@lszomoru lszomoru added the scm General SCM compound issues label Apr 20, 2026
@lszomoru lszomoru merged commit eb9cbc5 into main Apr 20, 2026
26 checks passed
@lszomoru lszomoru deleted the roblou/fix-scm-source-control-disposal branch April 20, 2026 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scm General SCM compound issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disposed SCM source controls remain retained in extension host bookkeeping

4 participants