fix(skills): force UTF-8 on hub lock/taps/cache JSON I/O - #68674
Closed
smfworks wants to merge 1 commit into
Closed
Conversation
Bare Path.read_text() uses the locale encoding, so valid UTF-8 lock.json files crash hermes skills check on Chinese Windows (GBK). Pair ensure_ascii=False writers with explicit encoding=utf-8 readers. Closes NousResearch#68369
Contributor
Author
|
Closing as fully superseded by merged #71078 (d372fda). I rechecked current main: every HubLockFile, TapsManager, index-cache, and Hermes-index JSON read/write targeted here now passes explicit UTF-8; no bare read_text()/write_text() calls remain in tools/skills_hub.py. Focused hub state/cache coverage passes (17 tests), and check-windows-footguns.py --all passes across 813 files. Consolidating avoids carrying an empty/conflicting duplicate. |
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
HubLockFile.save()writes JSON withensure_ascii=False(real Unicode), butload()used barePath.read_text()which decodes with the process locale encoding. On Chinese Windows that is GBK/cp936, so a valid UTF-8lock.jsoncrasheshermes skills checkwithUnicodeDecodeError.Fix
encoding="utf-8"on hub state JSON read/write paths:HubLockFile.load/saveTapsManager.load/saveensure_ascii=Falsewrites with bare readsUnicodeDecodeErroralongside existing JSON/OS errors so a truly corrupt file still degrades safelyTest plan
TestHubLockFile— locale-default bare read fails, UTF-8 load succeedsTestHubLockFile—Path.read_textcalled withencoding="utf-8"TestHubLockFile— non-ASCII identifier round-tripTestTapsManager— same locale-default survival for taps.jsonCloses #68369