Skip to content

fix(core): dedupe symlinked skill directories#17245

Open
neriousy wants to merge 1 commit intoanomalyco:devfrom
neriousy:fix/skill-symlink-dedupe
Open

fix(core): dedupe symlinked skill directories#17245
neriousy wants to merge 1 commit intoanomalyco:devfrom
neriousy:fix/skill-symlink-dedupe

Conversation

@neriousy
Copy link
Contributor

Issue for this PR

Closes #17219

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Symlinked skill aliases could cause the same physical skill to be discovered multiple times, which produced duplicate skill directory permission rules.

This PR dedupes skills by canonical path while keeping the existing last-discovered alias behavior.

If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!

How did you verify your code works?

Added some tests

You can run the reproduction steps in the issue mentioned earlier

Screenshots / recordings

If this is a UI change, please include a screenshot or recording.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

Copilot AI review requested due to automatic review settings March 12, 2026 21:36
@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

I found a potentially related PR:

PR #15483: fix: symlink path resolution causing duplicate instances
#15483

This PR appears to address a similar issue - it deals with symlink path resolution causing duplicate instances. While this is a closed/merged PR from earlier, it may be related to the current issue being fixed in PR #17245, particularly around how symlinked paths are being handled to prevent duplicates.

The current PR (#17245) specifically addresses symlinked skill aliases causing duplicate skill discoveries and deduplicates by canonical path. This prior PR seems to have tackled a related symlink duplication problem, so it's worth reviewing to ensure consistency and that the current fix complements or improves upon the previous solution.

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

Fixes duplicate permission rules caused by symlinked skill aliases by deduplicating discovered skill directories using their canonical (real) paths while preserving the existing “later-discovered path wins” behavior.

Changes:

  • Deduplicate skill directory paths by canonical/real path during skill discovery, keeping the later-discovered alias path for permissions.
  • Add coverage for symlinked skill alias deduping at the skill discovery layer.
  • Add coverage ensuring only a single external_directory allow rule is generated for symlinked skill aliases.

Reviewed changes

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

File Description
packages/opencode/src/skill/skill.ts Canonical-path dedupe for skill directories while retaining later-discovered alias path behavior.
packages/opencode/test/skill/skill.test.ts Adds a regression test asserting symlinked aliases produce a single deduped skill directory entry and that the later path is kept.
packages/opencode/test/agent/agent.test.ts Adds a regression test asserting only one external_directory allow rule is produced for symlinked skill aliases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Permission scanner does not deduplicate symlinked skill directories, doubling ruleset size and log volume

2 participants