fix: serialize concurrent marketplace repo clones via SequencerByKey#301289
Merged
connor4312 merged 4 commits intomainfrom Mar 13, 2026
Merged
fix: serialize concurrent marketplace repo clones via SequencerByKey#301289connor4312 merged 4 commits intomainfrom
connor4312 merged 4 commits intomainfrom
Conversation
…tplace repo Co-authored-by: connor4312 <2230985+connor4312@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix error creating work tree dir for plugin marketplace
fix: serialize concurrent marketplace repo clones via SequencerByKey
Mar 12, 2026
connor4312
approved these changes
Mar 12, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Prevents race conditions when multiple callers attempt to clone the same plugin marketplace repository concurrently by serializing ensureRepository work, and adds a regression test around concurrent calls.
Changes:
- Add a
SequencerByKey<string>to serialize concurrentensureRepositorycalls. - Wrap
ensureRepositoryclone flow inside the sequencer queue. - Add a browser test that fires concurrent
ensureRepositorycalls and asserts clone happens once.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/browser/agentPluginRepositoryService.ts | Serializes ensureRepository to avoid concurrent git clone into the same target directory. |
| src/vs/workbench/contrib/chat/test/browser/plugins/agentPluginRepositoryService.test.ts | Adds a concurrent-call test asserting _git.cloneRepository is invoked only once. |
You can also share your feedback on Copilot code review. Take the survey.
src/vs/workbench/contrib/chat/test/browser/plugins/agentPluginRepositoryService.test.ts
Show resolved
Hide resolved
src/vs/workbench/contrib/chat/browser/agentPluginRepositoryService.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
pwang347
approved these changes
Mar 13, 2026
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.
Adding a new plugin marketplace could trigger concurrent
ensureRepositorycalls for the same repo. Both would see the directory missing, both would attemptgit clone, and the second would fail withfatal: could not create work tree dir '...': File exists.AgentPluginRepositoryService: add_cloneSequencer: SequencerByKey<string>and wrapensureRepositorybody in_cloneSequencer.queue(marketplace.canonicalId, ...). Concurrent calls for the same canonical ID are serialized — the second waits for the first, then finds the directory already exists and returns early.ensureRepositorycalls for the same marketplace and asserts_git.cloneRepositoryis invoked exactly once.📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.