fix(skills): prevent frontmatter name from diverging from directory name - #21815
Closed
akimuz wants to merge 1 commit into
Closed
fix(skills): prevent frontmatter name from diverging from directory name#21815akimuz wants to merge 1 commit into
akimuz wants to merge 1 commit into
Conversation
skill_manage(action=create/edit/patch) silently allowed the frontmatter field to differ from the parameter, causing skills_list() to display a different name than what skill_view() and skill_manage look up by directory. Add cross-check to _validate_frontmatter() and wire it through all three write paths so mismatches are explicitly rejected with an actionable error message.
Collaborator
Author
|
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.
Related Issue
Fixes #21782
What changed and why
skill_manage(action="create", name="foo", content="---\nname: bar\n...")silentlycreated a skill whose directory is
foo/but whoseskills_list()display name isbar. The write path never validated that the frontmatternamematches thenameparameter, introducing a dual-namespace problem:
skills_list()shows the frontmatter name →barskill_view("bar")→ not found (directory-name lookup)skill_manage(action="edit", name="foo")→ found (directory-name lookup)Same divergence could be introduced via
editorpatch.Previous fixes (#17914, #18872, #5433, #7669) patched read-path symptoms
(
skill_viewcan't resolve frontmatter name, bundled skill misclassified, etc.).This PR fixes the write-path root cause:
_validate_frontmatter()now accepts anexpected_nameparameter and cross-checks it against the frontmatternamefield.All three write paths (
_create_skill,_edit_skill,_patch_skill) wire thedirectory name through so mismatches are explicitly rejected with an actionable
error message, rather than silently accepted.
Design choice: explicit rejection over silent auto-overwrite — the error message
lets the agent self-correct on the next turn.
How to test
Reproduction (without fix):