Skip to content

fix: task system readiness races - #342418

Merged
Megan Rogge (meganrogge) merged 4 commits into
microsoft:mainfrom
SimonSiefke:fix/task-system-readiness-races
Oct 30, 2026
Merged

Megan Rogge (meganrogge) merged 4 commits into
microsoft:mainfrom
SimonSiefke:fix/task-system-readiness-races

Conversation

@SimonSiefke

@SimonSiefke Simon Siefke (SimonSiefke) commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

This PR is needed for #331198


Details

A task-system change notification can arrive before the required task systems are ready. Readiness can also change before an awaiting callback resumes, or the automatic-task contribution can be disposed while it waits. These cases can start task discovery too early or after disposal.

Change

Wait for notifications that satisfy hasTaskSystemInfo, recheck readiness after each wait, and dispose pending listeners with their owner. Stop automatic-task startup when the contribution has been disposed.

Before

Four readiness regression tests fail on the base branch: a removal notification resolves readiness too early, automatic tasks start before remote readiness, and pending startup work continues or leaves a listener after disposal.

After

All five readiness tests pass, including local startup, changes before remote readiness, and disposal before or immediately after readiness.

Test Video

test-video.webm

AI disclosure: Model: GPT-6.1 Sol. Worktime: 13 min

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.

🟡 Changes recommended

The new test fixtures leave global command handlers registered against disposed services, compromising test isolation.

1 open issue
What changed in this PR

Fixes task-system readiness races that can occur when registrations are removed, supporting the linked extension-host cleanup change.

Changes:

  • Filters readiness notifications and ties listeners to owner disposal.
  • Rechecks readiness and disposal before automatic-task discovery.
  • Adds regression coverage for local, remote, and disposal scenarios.
File Description
src/​vs/​workbench/​contrib/​tasks/​test/​browser/​taskSystemReadiness.test.ts Adds readiness and disposal regression tests.
src/​vs/​workbench/​contrib/​tasks/​browser/​runAutomaticTasks.ts Guards automatic-task startup while waiting.
src/​vs/​workbench/​contrib/​tasks/​browser/​abstractTaskService.ts Filters readiness events and owns listener cleanup.

Review effort: Balanced

@dmitrivMS Dmitriy Vasyura (dmitrivMS) added tasks Task system issues freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues labels Oct 23, 2026

@meganrogge Megan Rogge (meganrogge) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you!

@meganrogge
Megan Rogge (meganrogge) merged commit f41e6f5 into microsoft:main Oct 30, 2026
55 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.145.0 milestone Oct 30, 2026
@SimonSiefke
Simon Siefke (SimonSiefke) deleted the fix/task-system-readiness-races branch October 30, 2026 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues tasks Task system issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants