Skip to content

fix(windows): handle OSError from os.kill and add UTF-8 encoding for Windows (#5760, #8978, #7537, #8901)#13986

Closed
zhanggttry wants to merge 1 commit into
NousResearch:mainfrom
zhanggttry:fix/windows-compat-safe
Closed

fix(windows): handle OSError from os.kill and add UTF-8 encoding for Windows (#5760, #8978, #7537, #8901)#13986
zhanggttry wants to merge 1 commit into
NousResearch:mainfrom
zhanggttry:fix/windows-compat-safe

Conversation

@zhanggttry

Copy link
Copy Markdown
Contributor

Summary

Fixes #5760, #8978, #12359, #7537, #8901 — Windows compatibility issues in gateway and CLI.

Changes

gateway/status.py & gateway/run.py

  • os.kill(pid, 0) on Windows raises OSError for non-existent PIDs. Catch OSError alongside ProcessLookupError/PermissionError.

hermes_cli/.py, tools/.py

  • Add explicit encoding='utf-8' to all Path.read_text() and open() calls. On Chinese Windows, default encoding is gbk, causing UnicodeDecodeError on non-ASCII content.

Solution

No ctypes/windll usage — pure Python try/except and explicit encodings only. Safe for Supply Chain Audit.

Related Issues

…g to file reads

- os.kill(pid, 0) on Windows raises OSError (WinError 87) for non-existent
  PIDs instead of ProcessLookupError. Catch OSError everywhere to prevent
  crash on Windows process-existence checks.

- Path.read_text() and open() default to gbk on Chinese Windows. Add
  explicit encoding='utf-8' to all file reads to prevent UnicodeDecodeError
  when config files or skill manifests contain non-ASCII characters.

Files changed:
- gateway/run.py, gateway/status.py (os.kill + read_text)
- hermes_cli/*.py (read_text + open)
- tools/*.py (read_text)

Closes: NousResearch#13587 NousResearch#5762 NousResearch#7835 NousResearch#9024
@zhanggttry

Copy link
Copy Markdown
Contributor Author

Closing as the fixes (OSError handling in os.kill + UTF-8 encoding) have already been merged into main. The changes are functionally identical to what this PR proposed. Thanks!

@zhanggttry zhanggttry closed this Apr 22, 2026
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery comp/cli CLI entry point, hermes_cli/, setup wizard comp/tools Tool registry, model_tools, toolsets labels Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery comp/tools Tool registry, model_tools, toolsets P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: os.kill(pid, 0) raises SystemError/OSError in gateway/status.py

2 participants