fix(cli): resolve symlinked skill paths in gateway slash-command menu#39632
Open
fa1k3 wants to merge 1 commit into
Open
fix(cli): resolve symlinked skill paths in gateway slash-command menu#39632fa1k3 wants to merge 1 commit into
fa1k3 wants to merge 1 commit into
Conversation
_collect_gateway_skill_entries builds its allowed prefixes from SKILLS_DIR.resolve() (symlinks followed) but get_skill_commands() stores skill_md_path unresolved. When a profile's skills dir is a symlink to a shared source (e.g. ~/.hermes/profiles/<p>/skills -> external), the startswith() prefix check fails for every skill and the entire skill tier is silently dropped from the Telegram/Discord slash-command menu, while /skill-name dispatch still works. Normalize skill_path with os.path.realpath so both sides are compared in the same symlink-resolved namespace. Adds a regression test. Fixes NousResearch#8108. Extends NousResearch#8110 (external_dirs prefix widening). Complements NousResearch#27662 (symlinked dispatch loading).
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.
Summary
Fixes #8108 (profile gateways register only the core command set instead of the full skill menu) for the case where a profile's skills directory is a symlink.
gateway's_collect_gateway_skill_entries(inhermes_cli/commands.py) builds its allowed-prefix set fromSKILLS_DIR.resolve()(symlinks followed), butget_skill_commands()stores eachskill_md_pathunresolved. When the profile skills dir is a symlink to a shared source — e.g.~/.hermes/profiles/<profile>/skills -> /some/shared/skills— theskill_path.startswith(prefix)check isFalsefor every skill, so the entire skill tier is silently dropped from the Telegram/Discord slash-command menu. Dispatch is unaffected (resolve_skill_command_keydoes not do this prefix check), so/skill-namekeeps working while the menu shows nothing — which is what makes it easy to misdiagnose.Fix
Normalize
skill_pathwithos.path.realpathbefore the prefix and.hubchecks, so both sides are compared in the same symlink-resolved namespace. One line; the.hubexclusion andexternal_dirsmatching are unaffected (both already resolved).Test
Adds
tests/hermes_cli/test_gateway_skill_menu_symlink.py:SKILLS_DIRnow appears in the menu (the regression), and.hubskill under a symlinkedSKILLS_DIRstays excluded (proves the exclusion survives normalization).Verified red-without / green-with the fix.
Related
external_dirsprefix-widening fix) to the symlinked-SKILLS_DIRcase._load_skill_payload/skill_view; this addresses the gateway menu filter, a separate code path.