Skip to content

fix: skip ps.exe on Windows to prevent console window popups - #43933

Closed
bighamx wants to merge 1 commit into
NousResearch:mainfrom
bighamx:fix/windows-ps-popup
Closed

fix: skip ps.exe on Windows to prevent console window popups#43933
bighamx wants to merge 1 commit into
NousResearch:mainfrom
bighamx:fix/windows-ps-popup

Conversation

@bighamx

@bighamx bighamx commented Jun 11, 2026

Copy link
Copy Markdown

Problem

On Windows with Git installed, gateway/status.py's _read_process_cmdline() calls subprocess.run(["ps", "-p", ...]) which finds Git's C:\Program Files\Git\usr\bin\ps.exe in PATH. Each call spawns a visible console window that flashes on screen.

The gateway checks process status periodically, so users see intermittent ps.exe console window popups as long as the gateway is running.

Root Cause

The function tries /proc/<pid>/cmdline first (fails on Windows), then falls through to the ps command — which resolves to Git's ps.exe on Windows. The psutil fallback sits after the ps call and is never reached.

Fix

On win32, skip the ps subprocess call entirely and use psutil directly (already a dependency). Non-Windows platforms are unchanged.

if sys.platform == "win32":
    # use psutil directly
else:
    # existing ps command path

Testing

  • Verified fix on Windows 11 with Git installed — no more ps.exe popup windows
  • Gateway restarts cleanly and process status checks work via psutil
  • No behavior change on Linux/macOS

On Windows, Git ships ps.exe at C:\Program Files\Git\usr\bin\ps.exe.
The gateway's _read_process_cmdline() called subprocess.run(['ps', ...])
which found Git's ps.exe and spawned a visible console window each time
the gateway checked a process status.

Fix: on win32, skip the ps call entirely and use psutil directly (which
is already a dependency). Non-Windows platforms are unchanged.
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery labels Jun 11, 2026

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Verdict: Approved

Fix: Skip ps.exe on Windows to prevent console window popups

  • Problem: On Windows, running ps -p <pid> -o command= invokes Git's bundled ps.exe which pops a visible console window, disrupting the user experience.
  • Fix: On Windows (sys.platform == "win32"), skip the ps subprocess and use psutil directly. On other platforms, use the existing ps subprocess path.
  • Clean, simple fix with no test changes needed (behavioral difference only observable on Windows GUI).

Reviewed by Hermes Agent

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the Windows report and focused fix. This is already implemented on current main by a later, regression-tested change.

  • Automated hermes-sweeper review verified gateway/status.py:195-216: ps runs only when not _IS_WINDOWS, while Windows uses the psutil.Process(pid).cmdline() fallback.
  • tests/gateway/test_status.py:1495-1521 explicitly verifies that Windows does not invoke ps and returns the psutil command line.
  • The implementation landed in 9a0010fd469f0de6c7e2146f955ed9980d02b397 (fix(windows): cover remaining console-flash spawn legs, fix(windows): cover remaining console-flash spawn legs #54417), included in v2026.7.1.

Closing as implemented on main.

@teknium1 teknium1 closed this Jul 14, 2026
@teknium1 teknium1 added sweeper:implemented-on-main Sweeper: behavior already present on current main sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:implemented-on-main Sweeper: behavior already present on current main sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades 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.

4 participants