fix(skills): use bundle_content_hash in lock to prevent perpetual update_available - #41199
Open
liuhao1024 wants to merge 2 commits into
Open
fix(skills): use bundle_content_hash in lock to prevent perpetual update_available#41199liuhao1024 wants to merge 2 commits into
liuhao1024 wants to merge 2 commits into
Conversation
…ate_available install_from_quarantine() stored content_hash(install_dir) in the lock, but check_for_skill_updates() compares against bundle_content_hash(bundle). The two hash routines can diverge when disk-only files (e.g. .DS_Store) are present or when write_text/read_bytes round-trip encoding differs from the in-memory bundle content. This caused hermes skills update to reinstall files correctly but leave a stale content_hash in lock.json, so check_for_skill_updates() kept reporting update_available forever (issue NousResearch#41176). Fix: store bundle_content_hash(bundle) in the lock so the comparison is guaranteed to match after installation. Includes regression test.
This was referenced Jun 28, 2026
Contributor
|
Thanks for targeting the lock/hash comparison boundary. The write-side normalization remains needed on current main: Problems
Suggested changes
Automated hermes-sweeper review. |
19 tasks
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?
Fixes a bug where
hermes skills updatereinstalls files correctly but leaves a stalecontent_hashin.hub/lock.json, causinghermes skills checkto perpetually reportupdate_availableeven though the installed content is byte-for-byte identical to the latest bundle.The root cause:
install_from_quarantine()storedcontent_hash(install_dir)in the lock, butcheck_for_skill_updates()compares againstbundle_content_hash(bundle). These two hash routines can diverge when disk-only files (e.g..DS_Store) are present or whenwrite_text/read_bytesround-trip encoding differs from the in-memory bundle content.Fix: store
bundle_content_hash(bundle)in the lock so the comparison is guaranteed to match after installation.Related Issue
Fixes #41176
Type of Change
Changes Made
tools/skills_hub.py: Changedinstall_from_quarantine()to usebundle_content_hash(bundle)instead ofcontent_hash(install_dir)when recording the lock entry and audit log. This ensures the stored hash is always consistent with whatcheck_for_skill_updates()computes.tests/tools/test_skills_hub.py: Addedtest_install_from_quarantine_records_bundle_hash_in_lockregression test that verifies the lock hash matchesbundle_content_hash(bundle)after installation.How to Test
content_hashis stale (predates current bundle hash)hermes skills check→ skill showsupdate_availablehermes skills update <name>→ reportsUpdated 1 skill(s).hermes skills checkagain → skill now showsup_to_date(previously it would still showupdate_available)pytest tests/tools/test_skills_hub.py::TestInstallPathSafety::test_install_from_quarantine_records_bundle_hash_in_lock -vChecklist
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/ACode Intelligence
install_from_quarantine(callers: 3 —do_install,do_snapshot_import, web API; flows: 4)bundle_content_hashandcontent_hashare documented as needing to stay symmetric (line 772–775 intools/skills_guard.py). This fix ensures we always use the bundle-side hash in the lock, eliminating the divergence path entirely.