Skip to content

fix(skills): force UTF-8 on hub lock/taps/cache JSON I/O - #68674

Closed
smfworks wants to merge 1 commit into
NousResearch:mainfrom
smfworks:fix/skills-hub-utf8-lock-load
Closed

fix(skills): force UTF-8 on hub lock/taps/cache JSON I/O#68674
smfworks wants to merge 1 commit into
NousResearch:mainfrom
smfworks:fix/skills-hub-utf8-lock-load

Conversation

@smfworks

Copy link
Copy Markdown
Contributor

Summary

HubLockFile.save() writes JSON with ensure_ascii=False (real Unicode), but load() used bare Path.read_text() which decodes with the process locale encoding. On Chinese Windows that is GBK/cp936, so a valid UTF-8 lock.json crashes hermes skills check with UnicodeDecodeError.

Fix

  • Force encoding="utf-8" on hub state JSON read/write paths:
    • HubLockFile.load / save
    • TapsManager.load / save
    • index cache helpers that pair ensure_ascii=False writes with bare reads
    • Hermes skills-index cache read/write
  • Catch UnicodeDecodeError alongside existing JSON/OS errors so a truly corrupt file still degrades safely

Test plan

  • TestHubLockFile — locale-default bare read fails, UTF-8 load succeeds
  • TestHubLockFilePath.read_text called with encoding="utf-8"
  • TestHubLockFile — non-ASCII identifier round-trip
  • TestTapsManager — same locale-default survival for taps.json
  • Existing HubLockFile / TapsManager suite green (21 tests)

Closes #68369

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
@alt-glitch alt-glitch added type/bug Something isn't working comp/tools Tool registry, model_tools, toolsets tool/skills Skills system (list, view, manage) platform/windows Native Windows-specific behavior or breakage P3 Low — cosmetic, nice to have sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Jul 21, 2026
@smfworks

Copy link
Copy Markdown
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.

@smfworks smfworks closed this Jul 26, 2026
@smfworks
smfworks deleted the fix/skills-hub-utf8-lock-load branch July 26, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets P3 Low — cosmetic, nice to have platform/windows Native Windows-specific behavior or breakage sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows tool/skills Skills system (list, view, manage) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: hermes skills check crashes on Chinese Windows — HubLockFile.load() bare read_text() decodes UTF-8 lock.json as GBK

2 participants