Repository navigation
fix(plugins): accept str skill paths in register_skill - #104418
Closed
liuhao1024 wants to merge 1 commit into
Closed
liuhao1024 wants to merge 1 commit into
liuhao1024 wants to merge 1 commit into
Conversation
Plugin register() helpers commonly pass the SKILL.md location as a filesystem string (PluginManifest.path itself is stored as str), but register_skill() called path.exists() directly, so a valid string path aborted the whole plugin load with "'str' object has no attribute 'exists'" instead of registering. Coerce to Path up front so the registry entry and find_plugin_skill() keep their Path contract, and a missing location still fails with FileNotFoundError. Fixes NousResearch#104404
2 tasks
Summary
Findings
VerdictMinimal, safe, well-tested. Non-blocking. |
Author
|
Thanks for the review! Agreed on the threat model: the registry already executes arbitrary plugin code at load time, so path containment for the coerced str is a hardening note at most, not a new hole — leaving as-is. |
This was referenced Sep 22, 2026
Collaborator
|
Thanks @liuhao1024 — cherry-picked as-is; resolves #104404. Salvaged into #118841 with your authorship preserved (merge 74f726c). Thank you! |
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?
PluginContext.register_skill()calledpath.exists()directly on itspathargument. Pluginregister()helpers commonly pass the SKILL.md location as a filesystem string (PluginManifest.pathitself is stored asstr, sostr(Path(__file__).parent / "SKILL.md")style helpers producestr), so a valid string path aborted the whole plugin load with'str' object has no attribute 'exists'instead of registering. The load wrapper treats any exception fromregister()as a plugin failure, so the plugin silently never enabled.The fix coerces the argument with
Path(path)up front, so:find_plugin_skill()keep their documentedPathcontract (tools/skills_tool.pyalso calls.exists()on it later),FileNotFoundError, and an unusable type fails with a clearTypeErrorfrom thePath()constructor — neverAttributeError.Related Issue
Fixes #104404
Type of Change
Changes Made
hermes_cli/plugins.py—register_skill()coerces thepathargument toPathbefore the.exists()check and registry entry.tests/test_plugin_skills.py— regression tests: astrSKILL.md path registers (and the registry stores aPath), and a missingstrpath raisesFileNotFoundErrorrather thanAttributeError.How to Test
pytest tests/test_plugin_skills.py -q— Observed result: 31 passed (was 29; the 2 new tests cover the str-path cases).pytest tests/hermes_cli/test_plugin_ownership_ledger.py tests/hermes_cli/test_plugins.py -q— Observed result: all pass, no regressions in the plugin load/registry surface.register(ctx)callsctx.register_skill(name, str(Path(__file__).parent / "SKILL.md"))\) — before this change the load log showsFailed to load plugin ...: 'str' object has no attribute 'exists'; after it, the skill registers and resolves viaskill_view()`.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AFor New Skills