fix(windows): suppress git-probe console flash + cp950 crash in dashboard - #53184
Closed
kenchan-pixel wants to merge 1 commit into
Closed
fix(windows): suppress git-probe console flash + cp950 crash in dashboard#53184kenchan-pixel wants to merge 1 commit into
kenchan-pixel wants to merge 1 commit into
Conversation
…oard tui_gateway.git_probe.run_git spawned `git` with no creationflags and no explicit encoding. The gateway/dashboard runs windowless (pythonw) and the Projects-tree scan probes git several times per project directory, so each git.exe allocated a fresh console (conhost / Windows Terminal) — dozens of windows flash open on startup for users with many repos. With text=True and no codec, the reader thread also decoded git's UTF-8 output (paths, branch names) with the locale ANSI codepage (cp950 on zh-Hant Windows) and crashed with UnicodeDecodeError on any repo whose path contains non-ASCII characters, spamming gateway-crash _readerthread logs. Add encoding="utf-8" / errors="replace" and creationflags=windows_hide_flags() (CREATE_NO_WINDOW on Windows, 0 elsewhere) at the single run_git choke point, plus unit tests asserting the call wiring. Fixes NousResearch#53178 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jun 27, 2026
Contributor
|
Closing as superseded by the consolidated Windows console-flash work tracked in #54220. The relevant pieces from this PR/cluster have now landed through the targeted follow-up PRs #54236, #53892, and #54417, or are recorded in the umbrella tracker for any remaining native-Windows verification. Keeping this separate PR open would duplicate the tracker and the merged follow-up work. Thanks for digging into this — the reports and PRs in this cluster helped identify the remaining spawn legs. |
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.
What does this PR do?
On Windows,
tui_gateway/git_probe.py::run_gitspawnedgitwith nocreationflagsand no explicitencoding. Two consequences:pythonw.exe), so each baregit.exeallocates a fresh console (conhost.exe, and with Windows Terminal as default terminal anOpenConsole.exewindow). The Projects-tree scanner callsrun_gitseveral times per project directory, so launching the desktop app flashes dozens of console/terminal windows for users with many repos. (Measured on one affected machine: ~118 process spawns in 60s at startup, almost allgit -C <dir> rev-parse ..., each spawning a conhost.)UnicodeDecodeErroron non-ASCII repo paths. Withtext=Trueand no codec, the reader thread decodes git's UTF-8 output with the locale ANSI codepage (cp950on Traditional-Chinese Windows) and crashes on any repo whose path/branch contains non-ASCII (e.g. CJK) characters, spamminggateway-crash/_readerthreadlogs.Fix at the single
run_gitchoke point: addencoding="utf-8"/errors="replace"andcreationflags=windows_hide_flags()(the existinghermes_cli/_subprocess_compat.pyhelper —CREATE_NO_WINDOWon Windows,0elsewhere, so it's a no-op on macOS/Linux).Related Issue
Fixes #53178
Type of Change
Changes Made
tui_gateway/git_probe.py:run_gitnow passesencoding="utf-8", errors="replace"andcreationflags=windows_hide_flags(); import the helper fromhermes_cli._subprocess_compat.tests/tui_gateway/test_git_probe.py(new): asserts the call wiring (no-window flag + utf-8/replace), empty result on non-zero exit, and no spawn for emptycwd. Cross-platform (mockssubprocess.run).How to Test
git.exe → conhost.exe → OpenConsole.exewindows flash; logs show_readerthreadUnicodeDecodeError: 'cp950'...for the non-ASCII repos.run_git/branchprobes (incl. a CJK-path repo) from apythonwparent → 0 new console/OpenConsole windows and no decode crash (returned correct UTF-8 toplevel + branch).tests/tui_gateway/test_git_probe.py→ 3 passed.scripts/check-windows-footguns.py→ clean.Checklist
Code
fix(windows): ...)windows_hide_flags()returns0; explicit utf-8 is safe everywhere).Documentation & Housekeeping
cli-config.yaml.example— N/ACONTRIBUTING.md/AGENTS.md— N/A