Skip to content

fix(hermes): decode rewrite output as UTF-8 - #4527

Open
Hdx123321 wants to merge 1 commit into
rtk-ai:developfrom
Hdx123321:fix/hermes-utf8-output
Open

Hdx123321 wants to merge 1 commit into
rtk-ai:developfrom
Hdx123321:fix/hermes-utf8-output

Conversation

@Hdx123321

@Hdx123321 Hdx123321 commented Oct 12, 2026 •

Copy link
Copy Markdown

Fixes #4525

The Hermes hook invoked rtk rewrite in text mode using the Windows ANSI code page, although RTK emits UTF-8. This caused command paths containing non-GBK characters to fail decoding and made the hook silently skip the rewrite.

The subprocess output is now decoded explicitly as UTF-8 with replacement handling. The hook also treats unavailable captured streams as empty so the fail-open behavior does not create a second plugin error.

Validation:

  • python -m unittest discover -s hooks/hermes (20 passed, 1 skipped)
  • python -m py_compile hooks/hermes/rtk-rewrite/__init__.py
  • git diff --check

@CLAassistant

CLAassistant commented Oct 12, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@rtk-wshm-sync-bot rtk-wshm-sync-bot Bot added bug Something isn't working hooks windows encoding labels Oct 12, 2026
@rtk-wshm-sync-bot

Copy link
Copy Markdown

wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟢 Risk low

Summary

Fixes the Hermes rtk rewrite hook to explicitly decode subprocess output as UTF-8 (with replacement handling) instead of relying on the Windows ANSI code page, which previously broke paths with non-GBK characters. Also hardens the hook so missing/None captured stdout/stderr streams are treated as empty rather than raising a second plugin error during fail-open handling.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Linked issues: #4525


Analyzed automatically by wshm · This is an automated analysis, not a human review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working encoding hooks windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: Hermes plugin decodes rtk output as ANSI (cp936), UnicodeDecodeError leaves stdout=None and silently disables rewriting for non-GBK commands

2 participants