fix(core): dedupe symlinked skill directories#17245
fix(core): dedupe symlinked skill directories#17245neriousy wants to merge 1 commit intoanomalyco:devfrom
Conversation
|
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 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. |
There was a problem hiding this comment.
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_directoryallow 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.
Issue for this PR
Closes #17219
Type of change
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
If you do not follow this template your PR will be automatically rejected.