Fix skills duplication when Agent Skills Location overlaps with Plugin Locations#307693
Open
Fix skills duplication when Agent Skills Location overlaps with Plugin Locations#307693
Conversation
When 'Agent Skills Location' overlaps with 'Plugin Locations', the same skill URI can appear in both discoveredSkills and pluginSkills sources. Add URI-based deduplication (seenUris Set) before processing each skill to prevent the same file from being included multiple times. Also add a test verifying that skills are not duplicated when the same URI appears via both SKILLS_LOCATION_KEY and plugin sources. Agent-Logs-Url: https://github.com/microsoft/vscode/sessions/93df8c49-237a-434e-938e-5ba4e004cfd9 Co-authored-by: connor4312 <2230985+connor4312@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix skills duplication when Agent Skills Location overlaps with Plugin Locations
Fix skills duplication when Agent Skills Location overlaps with Plugin Locations
Apr 3, 2026
connor4312
reviewed
Apr 3, 2026
| const uri = skill.uri; | ||
| const promptPath = skill; | ||
|
|
||
| const uriKey = uri.toString(); |
Agent-Logs-Url: https://github.com/microsoft/vscode/sessions/790cd72e-c8ea-4c81-80c1-e203e1a29ab8 Co-authored-by: connor4312 <2230985+connor4312@users.noreply.github.com>
connor4312
approved these changes
Apr 3, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to prevent the same SKILL.md from being surfaced multiple times when skill discovery sources overlap (notably when SKILLS_LOCATION_KEY points into a plugin’s skills area), which previously led to duplicate entries in user-facing lists.
Changes:
- Add URI-based de-duplication to
computeSkillDiscoveryInfousing aResourceSet, so the sameURIis only parsed once across sources. - Add a unit test for the overlap scenario to ensure a single skill result is returned.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.ts | Adds URI-based de-duplication in skill discovery. |
| src/vs/workbench/contrib/chat/test/common/promptSyntax/service/promptsService.test.ts | Adds a test intended to cover overlap de-duplication. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 2
src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.ts
Show resolved
Hide resolved
src/vs/workbench/contrib/chat/test/common/promptSyntax/service/promptsService.test.ts
Show resolved
Hide resolved
Agent-Logs-Url: https://github.com/microsoft/vscode/sessions/71dad59b-e7d7-4655-8141-a34b5072d905 Co-authored-by: connor4312 <2230985+connor4312@users.noreply.github.com>
connor4312
approved these changes
Apr 4, 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.
Skills appeared multiple times in the slash command list when
SKILLS_LOCATION_KEYwas configured to a workspace-relative path that overlapped with a plugin location — the sameSKILL.mdURI would surface via both the file locator and_pluginPromptFilesByType. This affected both thefindAgentSkills()path and, critically, the user-facing slash command list built viagetPromptSlashCommands()→computeSlashCommandDiscoveryInfo()→listPromptFiles(PromptsType.skill).Changes
promptsServiceImpl.ts—computeListPromptFiles: Add URI-based deduplication using aResourceSetso that when the file locator and plugin registration both return the same URI, only the first occurrence is kept. This fixes the slash-command path (getPromptSlashCommands).promptsServiceImpl.ts—computeSkillDiscoveryInfo: URI-based deduplication using aResourceSet(instead ofSet<string>) checked beforeparseNew(), so the same file path from any number of sources is only processed once. The existing name-based dedup (seenNames) is preserved for catching distinct files that resolve to the same skill name.promptsService.test.ts: Test covering the overlap scenario uses a workspace-relativeSKILLS_LOCATION_KEYpath (absolute paths are rejected byisValidPromptFolderPathand would not be found by the file locator). BothfindAgentSkills()andgetPromptSlashCommands()are asserted to return exactly one result, covering both affected code paths.