fix: encoding round-trip write side in skills_hub.py (ensure_ascii=False without encoding) - #65440
Closed
AlexFucuson9 wants to merge 1 commit into
Closed
Conversation
… in skills_hub.py 3 write_text calls produce UTF-8 content (ensure_ascii=False) but omit the encoding parameter. On Windows, write_text defaults to the system codepage (cp1252), corrupting non-ASCII skill names and descriptions. PR NousResearch#64822 already fixes the paired read_text calls. This commit fixes the write side to complete the encoding round-trip. - _write_index_cache(): cache_file.write_text (line 1147) - _write_stale_index_cache(): cache_file.write_text (line 3366) - SkillLockStore.save(): self.path.write_text (line 3406)
Contributor
|
Thanks for covering the write-side calls: all three target writes are still unencoded on current main, so the diagnosis is valid. Problems
Suggested changes
Automated hermes-sweeper review. |
This was referenced Jul 24, 2026
Contributor
|
Merged via PR #71078 — your commit was cherry-picked onto current main with your authorship preserved in git log (rebase merge). Your 5-PR series (#50655 was authored under your earlier account, #54241, #56385, #66856, #65440) formed the backbone of the class-wide close-out: 68 of the 139 bare sites came from your commits, and the campaign's structure followed your directory-by-directory split. The remaining 71 sites were swept on top and a CI linter rule now prevents regressions. Thanks for the sustained, methodical work on this class. |
This was referenced Jul 25, 2026
Closed
Closed
This was referenced Aug 3, 2026
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.
Problem
3
write_text()calls intools/skills_hub.pyproduce UTF-8 content viaensure_ascii=Falsebut omit theencoding="utf-8"parameter. On Windows,write_text()defaults to the system codepage (cp1252), which corrupts non-ASCII characters in skill names, descriptions, and metadata.PR #64822 already fixes the read side (
read_text()→read_text(encoding="utf-8")). This PR fixes the write side to complete the encoding round-trip.Why This Matters
Without this fix, the write path produces cp1252-encoded JSON on Windows, while PR #64822 changes the read path to expect UTF-8. This mismatch causes
UnicodeDecodeErroror silent data corruption when reading back cached skill data with non-ASCII content.Files Changed
_write_index_cache()cache_file.write_text(json.dumps(..., ensure_ascii=False))_write_stale_index_cache()cache_file.write_text(json.dumps(..., ensure_ascii=False, default=str))SkillLockStore.save()self.path.write_text(json.dumps(..., ensure_ascii=False) + "\\n")