Skip to content

Fix skills duplication when Agent Skills Location overlaps with Plugin Locations#307693

Open
Copilot wants to merge 4 commits intomainfrom
copilot/fix-skills-duplication-issue
Open

Fix skills duplication when Agent Skills Location overlaps with Plugin Locations#307693
Copilot wants to merge 4 commits intomainfrom
copilot/fix-skills-duplication-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 3, 2026

Skills appeared multiple times in the slash command list when SKILLS_LOCATION_KEY was configured to a workspace-relative path that overlapped with a plugin location — the same SKILL.md URI would surface via both the file locator and _pluginPromptFilesByType. This affected both the findAgentSkills() path and, critically, the user-facing slash command list built via getPromptSlashCommands()computeSlashCommandDiscoveryInfo()listPromptFiles(PromptsType.skill).

Changes

  • promptsServiceImpl.tscomputeListPromptFiles: Add URI-based deduplication using a ResourceSet so 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.tscomputeSkillDiscoveryInfo: URI-based deduplication using a ResourceSet (instead of Set<string>) checked before parseNew(), 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-relative SKILLS_LOCATION_KEY path (absolute paths are rejected by isValidPromptFolderPath and would not be found by the file locator). Both findAgentSkills() and getPromptSlashCommands() are asserted to return exactly one result, covering both affected code paths.

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
Copilot AI requested a review from connor4312 April 3, 2026 19:17
const uri = skill.uri;
const promptPath = skill;

const uriKey = uri.toString();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@copilot use a ResourceSet. And don't bother logging.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in 86c2a15 — switched to ResourceSet (already imported) and removed the log line.

Copy link
Copy Markdown
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 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 computeSkillDiscoveryInfo using a ResourceSet, so the same URI is 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

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.

Skills duplication when 'Agent Skills Location' overlaps with 'Plugin Locations'

3 participants