fix(cli): force explicit utf-8 encoding for auth.json loading - #7411
Closed
Dusk1e wants to merge 1 commit into
Closed
fix(cli): force explicit utf-8 encoding for auth.json loading#7411Dusk1e wants to merge 1 commit into
Dusk1e wants to merge 1 commit into
Conversation
Collaborator
|
Subset of #15519 which adds encoding='utf-8' to 17 open() calls across 10 files. This PR covers only auth.json. |
Contributor
|
Thanks for the targeted regression coverage. The premise remains true on current main: This is an automated hermes-sweeper review. |
This was referenced Aug 3, 2026
Contributor
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
This PR enforces explicit UTF-8 encoding when reading auth.json, fixing a cross-platform bug where authentication stores appeared empty on certain Windows locales.
Problem
The authentication store loader in hermes_cli/auth.py relied on the system's default locale encoding for reading auth.json. Since Hermes consistently writes this file in UTF-8, any Windows environment with a non-UTF-8 default codepage would fail to decode non-ASCII labels correctly. This resulted in the auth store being silently treated as empty or corrupted, breaking the login flow for international users.
Changes
hermes_cli/auth.py: Updated the read_text() call to explicitly use encoding="utf-8".
tests/hermes_cli/test_auth_provider_gate.py: Added a regression test that simulates a non-UTF8 locale environment to verify that _load_auth_store() only succeeds with explicit UTF-8 decoding.
Verification
The new regression test confirms the failure in the previous implementation and passes with the fix.