fix(skills): follow symlinks during skill discovery (#35184) - #35213
fix(skills): follow symlinks during skill discovery (#35184)#35213Tranquil-Flow wants to merge 1 commit into
Conversation
Automated Triage: Competing PRs DetectedThree PRs are independently fixing the same issue (symlink-discovery in skills, #35184):
They all modify |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for targeting a confirmed residual skill-discovery path. Current main still uses rglob("SKILL.md") in tools/skill_manager_tool.py:597 and tools/skill_manager_tool.py:661, while agent/skill_utils.py:796 already provides the intended symlink-following traversal.
Problems
tests/tools/test_skill_symlink_discovery.py:42callsos.symlinkwithout handling unavailable symlink privileges. Existing tests skip cleanly onOSError/NotImplementedErrorintests/tools/test_skills_tool.py:47-55.iter_skill_index_files()follows links atagent/skill_utils.py:796but has no visible cycle guard. A cyclic directory link could make the newly migrated management lookups non-terminating.- The same direct lookup pattern remains in
tools/skill_usage.py:841andtools/skill_usage.py:858; assess whether those curator/usage paths should share the iterator too.
Suggested changes
- Make the regression test skip when symlink creation is unavailable.
- Add cycle protection in the shared iterator and cover it with a regression test before extending its use.
Automated hermes-sweeper review.
|
|
||
| # Symlink the external category into skills dir | ||
| symlink = skills_dir / "linked-cat" | ||
| os.symlink(symlinked_cat, symlink, target_is_directory=True) |
There was a problem hiding this comment.
Please handle OSError and NotImplementedError here and skip when symlinks are unavailable. The established helper in tests/tools/test_skills_tool.py:47-55 keeps these tests portable to restricted Windows environments.
What does this PR do?
Skill discovery (
_find_skillintools/skill_manager_tool.py) usesPath.rglob()which does not follow symlinks into directories. Skillsstored under symlinked category directories were invisible to the agent.
Fix: Replace
Path.rglob()withos.walk(followlinks=True)via theexisting
iter_skill_index_files()helper in the same module.Related Issue
Fixes #35184
Type of Change
Changes Made
tools/skill_manager_tool.py: ReplacePath.rglob()call withiter_skill_index_files()(which usesos.walk(followlinks=True))for symlink-aware directory traversal.
tests/tools/test_skill_symlink_discovery.py: New — regressiontest that creates a symlinked category directory and verifies skills
under it are discovered.
How to Test
python3 -m pytest tests/tools/test_skill_symlink_discovery.py -vChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests pass