Repository navigation
fix: race condition in notebook kernel picker - #341483
Merged
Dmitriy Vasyura (dmitrivMS) merged 1 commit intoNov 11, 2026
Merged
Dmitriy Vasyura (dmitrivMS) merged 1 commit into
Dmitriy Vasyura (dmitrivMS) merged 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The lifecycle and ordering guards correctly address the race, with focused regression coverage and no unresolved issues.
0 open findings
What changed in this PR
Prevents stale asynchronous kernel-source requests from updating a closed or refreshed notebook kernel picker.
Changes:
- Tracks request generations and ignores obsolete results.
- Stops updates after picker completion or closure.
- Adds five regression tests covering request ordering and lifecycle races.
| File | Description |
|---|---|
notebookKernelQuickPickStrategy.ts |
Guards picker updates by request generation and closed state. |
notebookKernelQuickPickStrategy.test.ts |
Tests stale responses, loading state, empty results, and closure. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
November 11, 2026 06:19
Dmitriy Vasyura (dmitrivMS)
approved these changes
Nov 11, 2026
Aiday Marlen Kyzy (aiday-mar)
approved these changes
Nov 11, 2026
Martin Aeschlimann (aeschli)
approved these changes
Nov 11, 2026
auto-merge was automatically disabled
November 11, 2026 09:54
Pull request was closed
Dmitriy Vasyura (dmitrivMS)
merged commit Nov 11, 2026
d2385e5
into
microsoft:main
103 of 105 checks passed
Simon Siefke (SimonSiefke)
deleted the
fix/notebookKernelQuickPick-ordering
branch
November 11, 2026 10:35
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR is needed for #336032
Details
Opening the notebook kernel picker asks extensions which kernel sources are available. The picker can refresh while an earlier request is still running.
If that earlier request finishes last, it can overwrite newer choices or stop the loading indicator too soon. A request can also finish after the picker closes and try to update it.
Change
Only the most recent request can update the choices and loading indicator. Once you select an item, go back, or close the picker, pending results are ignored.
Before
A slow, older response can replace the current choices with outdated ones, or make the picker look finished while the latest request is still loading.
After
The picker keeps the latest choices, shows loading while the current request is pending, and ignores results that arrive after it closes.
All five regression tests fail on the original code and pass with this fix. Also verified in Code OSS, including selecting a source and closing or reopening the picker while requests are pending.
AI disclosure: Model: GPT 6.1 Sol. Worktime: approximately 18 min