Skip to content

Conversation

@alexr00
Copy link
Member

@alexr00 alexr00 commented Jan 27, 2026

Copilot AI review requested due to automatic review settings January 27, 2026 11:51
@alexr00 alexr00 enabled auto-merge (squash) January 27, 2026 11:51
@alexr00 alexr00 self-assigned this Jan 27, 2026
@vs-code-engineering vs-code-engineering bot added this to the January 2026 milestone Jan 27, 2026
Copy link
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

This PR fixes a race condition bug in tree view handling where concurrent getChildren calls could result in "Element with id ... is already registered" errors. The bug occurred when _childrenFetchTokens was cleared during a root refresh, causing multiple in-flight fetches to reset their request IDs and potentially conflict when registering elements.

Changes:

  • Introduced a global monotonically increasing counter (_globalFetchTokenCounter) to replace per-element request ID tracking
  • Added a comprehensive test case that reproduces the race condition scenario with concurrent reveal operations returning different element instances with the same ID

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/vs/workbench/api/common/extHostTreeViews.ts Added global fetch token counter and modified _fetchChildrenNodes to use it instead of per-element counters, ensuring old in-flight fetches never match new fetches after cache clears
extensions/vscode-api-tests/src/singlefolder-tests/tree.test.ts Added regression test that reproduces the race condition with two concurrent reveal operations returning different element instances with the same ID

@alexr00 alexr00 merged commit f89c803 into main Jan 27, 2026
27 of 28 checks passed
@alexr00 alexr00 deleted the alexr00/fluffy-alpaca branch January 27, 2026 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Element with id All Open (URL) is already registered

3 participants