fix(skills): stop package-internal markdown from shadowing real skills - #110471
Open
kokhlo wants to merge 1 commit into
Open
fix(skills): stop package-internal markdown from shadowing real skills#110471kokhlo wants to merge 1 commit into
kokhlo wants to merge 1 commit into
Conversation
A legacy flat <name>.md candidate is now rejected when any ancestor between it and the discovery root contains SKILL.md, so internal Markdown under any package-owned directory (prompts/, docs/, ...) is material of its package instead of a standalone skill colliding with a real one sharing the basename.
Contributor
Duplicate of #110461 — same fix for #110456 (reject a legacy flat |
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.
What does this PR do?
skill_view("research")used to refuse loading a top-levelresearch/SKILL.mdbecause another skill's package-internalcharacter/example/prompts/research.mdentered the legacy flat<name>.mdcandidate set. The merged support-dir exclusion (#47249) only knows the hard-codedSKILL_SUPPORT_DIRS(references,templates,assets,scripts), so package-internal Markdown under any other directory name still shadowed or collided with real skills.This adds ancestor-
SKILL.mdownership: a legacy flat<name>.mdcandidate is rejected when any ancestor directory between the candidate and the discovery root containsSKILL.md— the fix originally proposed in #35743. Root-level and category-level legacy flat skills (noSKILL.mdancestor) keep resolving.Symptom
skill_view("research")→Ambiguous skill name 'research': 2 skills matchwith a package's internalprompts/research.mdlisted as a second candidate; the suggested categorized-path workaround is unusable for a top-level skill whose lookup path is the bare name.Bug Cause
Trigger:
tools/skills_tool.py_collect_skill_candidates— thesearch_dir.rglob(f"{name}.md")scan filtered candidates only viais_skill_support_path, which recognizes the hard-coded support dir names.Causal chain:
SKILL_SUPPORT_DIRS(e.g.prompts/).Why it is wrong: ownership of internal Markdown follows its ancestor
SKILL.md, not the internal directory's name.Working sibling / contrast:
references/<name>.mdis already excluded by name; this PR generalizes the exclusion to arbitrary directory names.Ruled out: frontmatter cannot distinguish the candidates — the collision fires on basename before frontmatter is read.
Fix
New
is_inside_skill_package(path, root=...)predicate inagent/skill_utils.py: walks ancestors strictly below the discovery root and reports whether one containsSKILL.md. The legacy candidate scan intools/skills_tool.pynow skips such files. Complementary to #109577 (nested support-dir case): that PR ancestor-walks the hard-coded dir names; this one keys off ancestorSKILL.mdownership for any directory name.Related Issue
Fixes #110456
Type of Change
Changes Made
agent/skill_utils.py—is_inside_skill_package(): ancestor-SKILL.mdownership bounded by the discovery root.tools/skills_tool.py— legacy flat<name>.mdscan skips package-internal Markdown.tests/agent/test_skill_utils.py— ownership predicate: package-internal vs root/category flat skills; owners above the discovery root are ignored.tests/tools/test_skills_tool.py— regression:prompts/research.mdno longer collides with a realresearchskill.How to Test
Checklist
Code
Documentation & Housekeeping
pathlib-based, no platform-specific behavior.