Skip to content

fix(windows): suppress git-probe console flash + cp950 crash in dashboard - #53184

Closed
kenchan-pixel wants to merge 1 commit into
NousResearch:mainfrom
kenchan-pixel:fix/windows-git-probe-console-flash
Closed

fix(windows): suppress git-probe console flash + cp950 crash in dashboard#53184
kenchan-pixel wants to merge 1 commit into
NousResearch:mainfrom
kenchan-pixel:fix/windows-git-probe-console-flash

Conversation

@kenchan-pixel

Copy link
Copy Markdown

What does this PR do?

On Windows, tui_gateway/git_probe.py::run_git spawned git with no creationflags and no explicit encoding. Two consequences:

  1. Console-window flash per repo. The gateway/dashboard runs windowless (pythonw.exe), so each bare git.exe allocates a fresh console (conhost.exe, and with Windows Terminal as default terminal an OpenConsole.exe window). The Projects-tree scanner calls run_git several 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 all git -C <dir> rev-parse ..., each spawning a conhost.)
  2. UnicodeDecodeError on non-ASCII repo paths. With text=True and no codec, the reader thread decodes git's UTF-8 output with the locale ANSI codepage (cp950 on Traditional-Chinese Windows) and crashes on any repo whose path/branch contains non-ASCII (e.g. CJK) characters, spamming gateway-crash / _readerthread logs.

Fix at the single run_git choke point: add encoding="utf-8" / errors="replace" and creationflags=windows_hide_flags() (the existing hermes_cli/_subprocess_compat.py helper — CREATE_NO_WINDOW on Windows, 0 elsewhere, so it's a no-op on macOS/Linux).

Related Issue

Fixes #53178

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Changes Made

  • tui_gateway/git_probe.py: run_git now passes encoding="utf-8", errors="replace" and creationflags=windows_hide_flags(); import the helper from hermes_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 empty cwd. Cross-platform (mocks subprocess.run).

How to Test

  1. Repro (before): On Windows (default terminal = Windows Terminal) with ~15–20 git project dirs (a couple with CJK paths), launch the desktop app and watch git.exe → conhost.exe → OpenConsole.exe windows flash; logs show _readerthread UnicodeDecodeError: 'cp950'... for the non-ASCII repos.
  2. After: 8 run_git/branch probes (incl. a CJK-path repo) from a pythonw parent → 0 new console/OpenConsole windows and no decode crash (returned correct UTF-8 toplevel + branch).
  3. tests/tui_gateway/test_git_probe.py → 3 passed. scripts/check-windows-footguns.py → clean.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(windows): ...)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix (no unrelated commits)
  • I've added tests for my changes
  • I've tested on my platform: Windows 11 (cp950 locale). The change is a no-op on macOS/Linux (windows_hide_flags() returns 0; explicit utf-8 is safe everywhere).

Note: I ran the new test file (pytest tests/tui_gateway/test_git_probe.py → 3 passed) and scripts/check-windows-footguns.py (clean), not the entire suite locally — CI will run the full suite.

Documentation & Housekeeping

  • Documentation — N/A
  • cli-config.yaml.example — N/A
  • CONTRIBUTING.md/AGENTS.md — N/A
  • Cross-platform impact considered (no-op on non-Windows)

…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>
@alt-glitch alt-glitch added type/bug Something isn't working comp/dashboard Web dashboard / control panel UI (dashboard/, landing) platform/windows Native Windows-specific behavior or breakage sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows P2 Medium — degraded but workaround exists labels Jun 26, 2026
@teknium1

Copy link
Copy Markdown
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.

@teknium1 teknium1 closed this Jun 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/dashboard Web dashboard / control panel UI (dashboard/, landing) P2 Medium — degraded but workaround exists platform/windows Native Windows-specific behavior or breakage sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows type/bug Something isn't working

Projects

None yet

3 participants