Skip to content

fix(win32): add CREATE_NO_WINDOW to all background subprocess calls - #54253

Closed
derek2000139 wants to merge 1 commit into
NousResearch:mainfrom
derek2000139:fix/win32-create-no-window-subprocess
Closed

fix(win32): add CREATE_NO_WINDOW to all background subprocess calls#54253
derek2000139 wants to merge 1 commit into
NousResearch:mainfrom
derek2000139:fix/win32-create-no-window-subprocess

Conversation

@derek2000139

Copy link
Copy Markdown
Contributor

fix(win32): add CREATE_NO_WINDOW to all background subprocess calls

Fixes #53424

Problem

On Windows, every subprocess.run([git, ...]) or subprocess.Popen(...) call without creationflags=CREATE_NO_WINDOW causes a brief conhost.exe console window to flash on screen. While hermes_cli/web_server.py and hermes_cli/banner.py already handle this correctly via windows_hide_flags(), several other modules missed the flag — most critically tui_gateway/git_probe.py, which is the central hub for all gateway git probing and can spawn dozens of git processes per second during sidebar refreshes.

User-visible symptom: Rapid, continuous console window flashing when the Hermes Desktop app is running on Windows, especially on machines with multiple sessions across different working directories.

Root Cause

pythonw.exe (the dashboard process) is windowless by design, but its child processes (git.exe, pdftoppm, python -m hermes_cli.main) are console executables. Without CREATE_NO_WINDOW (0x08000000), Windows allocates a new conhost.exe for each child, producing a visible flash even though the process completes in milliseconds.

The hermes_cli/_subprocess_compat.py module already documents this exact issue and provides windows_hide_flags() — but it was only consumed by web_server.py and banner.py. The gateway, agent, and checkpoint code paths were missed.

Fix

Add creationflags to every subprocess.run / subprocess.Popen call that spawns a console executable:

File Call sites fixed Context
tui_gateway/git_probe.py 1 run_git() — central hub for all gateway git probes
tui_gateway/server.py 7 _SlashWorker Popen, pdftoppm, hermes_cli.main, quick_commands, git rev-parse, git ls-files, shell.exec
agent/coding_context.py 1 _git() — git context probe per coding session
tools/checkpoint_manager.py 2 _run_git() hub + _init_store()

Two styles used to match existing conventions in each file:

  • tui_gateway/ files: git_probe._CREATE_NO_WINDOW (module-level constant, sys.platform-guarded)
  • Standalone modules (agent/, tools/): getattr(subprocess, CREATE_NO_WINDOW, 0) — zero-import, safe on all platforms

Both approaches resolve to 0x08000000 on Windows and 0 elsewhere — no behavioral change on Linux/macOS.

Testing

  • All 4 modified files pass py_compile syntax check (Python 3.11).
  • Manually tested on Windows 10 (build 26200): after patching and clearing __pycache__, the rapid conhost.exe flashing stopped completely. Process monitoring confirmed git.exe calls still succeed (stdout captured correctly).
  • No impact on non-Windows: creationflags parameter is ignored on POSIX, and the flag values resolve to 0.

Notes

hermes_cli/main.py (~43 git calls) and cli.py (~17 git calls) also lack creationflags, but these are CLI-only code paths where the user already has a terminal open, so the flash is not visible. This PR focuses on the background/daemon paths that run headless.

Consider a follow-up to centralize the flag via _subprocess_compat.windows_hide_flags() across all modules for consistency.

@derek2000139

Copy link
Copy Markdown
Contributor Author

Closing in favor of upstream fix cb982ad which covers a broader set of files (10 vs 4) using the centralized windows_hide_flags() helper, plus adds test coverage and fixes a CJK path encoding issue. Thanks!

@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/tools Tool registry, model_tools, toolsets comp/tui Terminal UI (ui-tui/ + tui_gateway/) 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 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/tools Tool registry, model_tools, toolsets comp/tui Terminal UI (ui-tui/ + tui_gateway/) 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

Development

Successfully merging this pull request may close these issues.

[Bug] Windows: rapid conhost.exe window flashing due to missing CREATE_NO_WINDOW in subprocess calls

2 participants