fix(curator): scan nested archive subdirs in restore_skill#17951
Merged
teknium1 merged 1 commit intoNousResearch:mainfrom Apr 30, 2026
Merged
Conversation
restore_skill() in tools/skill_usage.py used archive_root.iterdir(), which
only walked the top level of .archive/. Skills archived under nested layouts
(e.g. .archive/openclaw-imports/<skill>/ from older archive paths or
external imports) were invisible to both the exact-match and prefix-match
candidate scans, surfacing as a misleading "skill '<name>' not found in
archive" error even though the directory existed on disk.
Switch both candidate scans to archive_root.rglob('*') so the lookup
descends into category subdirectories.
Fixes NousResearch#17942
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?
hermes curator restore <skill>was failing withskill '<name>' not found in archivewhenever the archived skill lived under a nested category subdirectory (e.g..archive/openclaw-imports/<skill>/,.archive/hermes-agent/<skill>/). The skill directory existed on disk but was invisible to the lookup becauserestore_skill()walked only the top level of.archive/.tools/skill_usage.py:389,392usedarchive_root.iterdir()for both the exact-name and prefix-match candidate scans. Switching both toarchive_root.rglob("*")makes the lookup descend into nested subdirs while preserving the existingis_dir() and p.name == skill_name(and prefix) filter, so the scan still picks up only matching skill directories.Related Issue
Fixes #17942
Type of Change
Changes Made
tools/skill_usage.py—restore_skill(): switched the exact-match and prefix-match candidate scans fromarchive_root.iterdir()toarchive_root.rglob("*")so nested archive subdirectories are searched.tests/tools/test_skill_usage.py— addedtest_restore_skill_finds_nested_archive_subdir(exact match under a nested category) andtest_restore_skill_finds_nested_timestamped_prefix(timestamped-dupe prefix match under a nested category) to lock in the recursive-walk behaviour.How to Test
hermes curator restore cognitive-empathy— before this patch this returned "not found in archive"; after, the skill is moved back to~/.hermes/skills/cognitive-empathy/and itsstateflips toactive.pytest tests/tools/test_skill_usage.py -q— 37 tests pass (35 prior + 2 new).Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — N/A (no user-visible API change; the docstring onrestore_skillalready covers behaviour)cli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/Arglobispathlib-portable; tests usetmp_pathand avoid OS-specific paths