fix(terminal): hide console windows on Windows backend probes (#62734) - #66605
fix(terminal): hide console windows on Windows backend probes (#62734)#66605TheSmokeDev wants to merge 1 commit into
Conversation
…search#62734) The docker-version and apptainer/singularity-version probes in check_terminal_requirements(), plus the sudo -n probe in _sudo_nopasswd_works() (same class, same file — Windows 11 ships sudo.exe), called subprocess.run without CREATE_NO_WINDOW, so each probe flashed a visible console window on native Windows. Apply the existing house pattern from hermes_cli._subprocess_compat (windows_hide_flags(), already used at 8 call sites in agent/, cron/, gateway/ — its docstring names version probes as the intended use): creationflags passed only when IS_WINDOWS, byte-identical POSIX behavior. Four regression tests: each probe asserts creationflags on Windows, plus a POSIX no-creationflags guarantee. All four fail without the fix; full file 13 passed.
|
Good triage link. Credit where due: #62761 (@liuhao1024) was first to the docker/singularity probe sites, and since What this PR carries beyond #62761:
Either resolution works for me: take this as the superset, or if #62761 lands first I'll rebase this down to the sudo site + the test file on top of it. Maintainers' call. |
|
Thanks for covering all three direct probe spawns. Current main still has unflagged Problems
Suggested changes
Automated hermes-sweeper review. |
|
Closing after the class-level fix in PR #70205 (commit 0dbf639): Windows console flashes were caused by Hermes daemons running console-less (pythonw / DETACHED_PROCESS parents), forcing every console-subsystem child to allocate its own visible window. Main now launches every daemon (gateway, Scheduled Task, UAC handoff, dashboard, desktop backend) with a hidden console that all descendants inherit — so the spawn sites this PR flags no longer have a reachable flash under any shipped launch path (interactive terminals never flashed; children inherit the visible console there). The sites you patched were genuinely unflagged, and the diagnosis was sound against the old launch topology — the ground just moved under it. Rather than keep growing per-site flags across an unbounded set of leaf spawns, we're standardizing on the parent-console fix. If a flash reappears on current main under a shipped launch path, that's a new bug — please file it with the flashing process name. Thanks for the contribution and the Windows attention; sorry this one got mooted at the root. |
Closes #62734 (claimed there earlier today).
Problem
Three
subprocess.runprobe sites intools/terminal_tool.pylaunch withoutCREATE_NO_WINDOW, so each flashes a visible console window on native Windows:check_terminal_requirements()— the dockerversionprobe and the apptainer/singularity--versionprobe (the two named in the issue)_sudo_nopasswd_works()— thesudo -n trueprobe: same class, same file, and Windows 11 shipssudo.exenow. Included; say the word and I'll split it out.Fix
The house pattern, verbatim:
hermes_cli._subprocess_compat.windows_hide_flags()— already used at 8 call sites inagent/,cron/,gateway/, and whose docstring names version probes as the intended use.creationflagspassed only whenIS_WINDOWS; POSIX behavior byte-identical.Verification (native Windows 11, CPython 3.13)
Four regression tests appended to
tests/tools/test_terminal_requirements.py(existing conventions: module handle + monkeypatch, recorder stand-in forsubprocess.run):creationflagson Windowscreationflagson Windowscreationflags(the compat module's no-damage guarantee)creationflagson WindowsA/B: all four fail without the fix (stash check), full file 13 passed with it.
ruffclean.Note: running this file through
scripts/run_tests.shon native Windows requires the hermetic-env fix in #66496 (USERPROFILEpassthrough — the file is uncollectable under the wrapper without it; receipt over there). Direct pytest + the wrapper-with-#66496 both green.