fix(gateway_windows): handle non-UTF-8 schtasks output on localized Windows - #24478
Closed
fatinghenji wants to merge 1 commit into
Closed
fix(gateway_windows): handle non-UTF-8 schtasks output on localized Windows#24478fatinghenji wants to merge 1 commit into
fatinghenji wants to merge 1 commit into
Conversation
…indows On Chinese Windows (and other non-English locales), schtasks.exe outputs status/error messages in the system code page (e.g. GBK). subprocess.run() with text=True defaults to UTF-8 decoding, causing UnicodeDecodeError when the CLI tries to parse schtasks output. Add encoding="utf-8" with errors="replace" to gracefully handle mixed- encoding output from schtasks, allowing gateway status/start/stop/install commands to work correctly on localized Windows systems. Fixes: UnicodeDecodeError when running hermes gateway commands on Chinese Windows
Collaborator
|
Competing with #24417 which addresses the same schtasks UnicodeDecodeError but uses |
tcflying
added a commit
to tcflying/hermes-agent-windows-rust-old
that referenced
this pull request
May 15, 2026
- psutil-based process start time fallback (NousResearch#25502) - ConPTY Bridge for native Windows terminal support - prompt_toolkit Vt100 output fallback for Git Bash - Git Bash path resolution (/d/path -> D:\path) - UTF-8 encoding for subprocess calls (doctor, schtasks) - Bash forward slashes in cron scripts (NousResearch#23404) - schtasks mbcs encoding for non-ASCII task names (NousResearch#24417, NousResearch#24478) - __main__.py launcher for python -m hermes_cli (NousResearch#21465) - shutdown_forensics Windows process snapshot - Comprehensive E2E test suite with 23 tests Fixes Windows native installation without WSL2 requirement. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This was referenced May 29, 2026
Contributor
|
Automated hermes-sweeper review: this schtasks UnicodeDecodeError fix is already implemented on current main. Evidence:
The current implementation uses locale decoding plus replacement rather than forced UTF-8 replacement, which better matches the localized Windows behavior discussed in the PR thread. |
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
On Chinese Windows (and other non-English locales),
schtasks.exeoutputs status/error messages in the system code page (e.g. GBK).subprocess.run()withtext=Truedefaults to UTF-8 decoding, causingUnicodeDecodeErrorwhen the CLI tries to parse schtasks output.This breaks all
hermes gatewaycommands on localized Windows systems:hermes gateway statushermes gateway starthermes gateway stophermes gateway installhermes gateway uninstallError
Fix
Add
encoding="utf-8"witherrors="replace"to_exec_schtasks()ingateway_windows.py. This gracefully handles mixed-encoding output from schtasks by replacing undecodable bytes with replacement characters instead of crashing.Testing
hermes gateway statusnow works without UnicodeDecodeErrorhermes gateway start/stopcommands functional after fixRelated
Fixes encoding issue affecting all Windows users with non-English system locales.