fix(windows): utf-8 subprocess decode across the desktop backend — salvage #61978 + widen to sibling sites - #70850
Merged
Merged
Conversation
…backend sites The salvaged #61978 covers tui_gateway/server.py. The crash reported on Jul 24 came from a sibling site it doesn't touch: the desktop update panel's _recent_upstream_commits() in hermes_cli/web_server.py runs git log with text=True and no encoding. Commit 84db324 put a bug emoji (UTF-8 f0 9f 90 9b) in a subject on main; byte 0x90 is undefined in cp1252, so every Windows desktop install behind that commit crashed in subprocess._readerthread during the update check (#52649). Guard every text=True capture site in the desktop-backend process with encoding='utf-8', errors='replace': - hermes_cli/web_server.py: git log update panel, memory-provider setup runner, WhatsApp bridge npm install, docker probe - hermes_cli/banner.py: all 5 git sites (update check runs at startup) - tui_gateway/host_supervisor.py: build-sha probe, ps probe, compute-host Popen drain threads - tui_gateway/compute_host.py: build-sha probe, ps rss probe
Contributor
૮ >ﻌ< ა ci reviewran on a618210 all good! |
This was referenced Jul 24, 2026
Closed
This was referenced Jul 24, 2026
This was referenced Jul 24, 2026
Closed
This was referenced Jul 24, 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.
Summary
Windows desktop backend no longer crashes with
UnicodeDecodeError: 'charmap' codec can't decode byte 0x90insubprocess._readerthread— every text-mode subprocess capture in the desktop-backend process now decodes as UTF-8 with lossy fallback.Root cause: on Windows,
subprocesswithtext=Trueand no explicitencoding=decodes child output with the ANSI code page (cp1252/GBK/…). cp1252 defines 251 of 256 bytes, so the bug stayed latent for months — until commit84db32484fput a 🐛 emoji (UTF-8f0 9f 90 9b) in a commit subject onmain. Byte0x90is one of only five bytes undefined in cp1252, and the desktop update panel'sgit log HEAD..origin/main(_recent_upstream_commits) started pulling it through the stdlib reader thread on every Windows install behind that commit, crashing the backend (#52649, #53137, #63686, #61595, #58385).Salvages PR #61978 by @Sahil-SS9 (server.py hardening + regression tests, cherry-picked with authorship preserved) and widens the fix to the sibling sites the crash actually came through.
Changes
tui_gateway/server.py(salvaged from fix: harden tui_gateway subprocess reads against Windows locale UnicodeDecodeError (#53137) #61978):encoding="utf-8", errors="replace"on the slash-worker Popen, pdftoppm,cli.exec, quick-command exec, andshell.exec— plus regression tests pinning the kwargshermes_cli/web_server.py: git-log update panel (the site that fired), memory-provider setup runner, WhatsApp bridge npm install, docker probehermes_cli/banner.py: all 5 git sites (startup update check runs in this process)tui_gateway/host_supervisor.py: build-SHA probe, ps probe, compute-host Popen drain threadstui_gateway/compute_host.py: build-SHA probe, ps rss probeerrors="replace"is the load-bearing half: even if a child ever emits genuinely non-UTF-8 bytes, decoding degrades to U+FFFD instead of raising in a daemon thread.Validation
'charmap' ... byte 0x90as reported_recent_upstream_commits+banner._git_stdout0x90through the new pathU+FFFD, no exceptiontests/tui_gateway/+ banner testsCloses #61978 (salvaged with credit). Fixes #52649, #53137 (and duplicates #63686, #61595, #58385).
Infographic