fix: hide Windows console-flash on 3 new/untreated subprocess spawn sites - #85243
Open
pierrenode wants to merge 1 commit into
Open
pierrenode wants to merge 1 commit into
pierrenode wants to merge 1 commit into
Conversation
…ites Three call sites shell out without hiding their console window on Windows, using the established creationflags=windows_hide_flags() pattern this repo already applies to short-lived console subprocess spawns elsewhere: - hermes_cli/session_lost_and_found.py (new file): the sqlite3-CLI .recover capability probe (subprocess.run) and the dump/load Popen pair that streams page-level recovery output. - tools/subagent_worktree.py (new file): _run_git(), the single chokepoint all 7 worktree-isolation git calls go through. - hermes_cli/plugins_cmd.py: 6 git subprocess.run sites (clone, fetch, checkout --detach, remote set-url, HEAD rev-parse, and the shared plugin-update _run_plugin_git helper). None change behavior on non-Windows (windows_hide_flags() returns 0 there) or alter stdio/timeout/env handling on any platform.
fix: hide Windows console-flash on 3 new/untreated subprocess spawn sites Solid, low-risk change —
|
This branch has not been deployed
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.
Summary
This repo has an established, well-tested convention (
hermes_cli/_subprocess_compat.py::windows_hide_flags(),tests/test_windows_subprocess_no_window_flags.py) for hiding the console window a short-lived console subprocess would otherwise flash on Windows. Three spawn sites don't follow it:hermes_cli/session_lost_and_found.py(brand-new file, last-resort page-level session-DB salvage):_cli_supports_recover()'s capability probe (subprocess.run) andrun_cli_lost_and_found_recover()'s dump/loadPopenpair. This feature (hermes sessions recover --allow-partial) is meant to work cross-platform — thesqlite3CLI it shells out to ships for Windows too — and has no platform guard restricting it to POSIX.tools/subagent_worktree.py(brand-new file, opt-in per-subagent git-worktree isolation):_run_git(), the single chokepoint all 7 call sites (rev-parse --show-toplevel,rev-parse HEAD,worktree add,rev-list --count,status --porcelain,worktree remove,branch -D) go through. Fires once per delegated subagent whendelegation.worktree_isolationis enabled, so the flash frequency here is higher than the other two sites.hermes_cli/plugins_cmd.py: 6 gitsubprocess.runsites (clone, fetch--depth 1,checkout --detach,remote set-urlcredential-scrub, HEAD rev-parse, and the shared_run_plugin_githelper used by plugin-pack update flows) — otherwise carefully hardened (noninteractive_git_env(),stdin=DEVNULL, credential-scrubbed error text, timeouts) but missing this one flag.Fix
Add
creationflags=windows_hide_flags()to all 9 spawn sites across the 3 files, matching the exact pattern already used throughouttools/browser_tool.py,tools/env_probe.py,tools/lazy_deps.py, etc.windows_hide_flags()returns0on non-Windows, so this is a no-op there.Testing
tests/test_windows_subprocess_no_window_flags.py(the repo's existing, growing audit suite for exactly this bug class), following its establishedmonkeypatch.setattr(<module>, "windows_hide_flags", lambda: _CREATE_NO_WINDOW)+ fakesubprocess.run/Popen+ assert-on-creationflagspattern:test_session_lost_and_found_recover_probe_hides_console_windowtest_session_lost_and_found_recover_run_hides_console_window(covers bothPopencalls in the dump/load pipeline)test_subagent_worktree_run_git_hides_console_windowtest_plugins_cmd_git_helpers_hide_console_window(spot-checks the two standalone chokepoints,_git_head_revisionand_run_plugin_git)windows_hide_flagsto monkeypatch before the fix, since it isn't imported yet.tests/test_windows_subprocess_no_window_flags.py: 11 passed, 3 skipped (unrelatedwindows_only-marked tests).test_session_recovery_lost_and_found.py,test_session_recovery.py,test_subagent_worktree.py,test_plugins_cmd.py,test_plugins_cmd_category_discovery.py,test_plugins_cmd_list.py,test_plugins_cmd_enable_disable_nested.py): 95/95 passed.ruff checkclean on all 4 touched files.No behavior change on non-Windows or to stdio/timeout/env handling on any platform.