fix: add creationflags to tirith_security subprocess calls (Windows console flash) - #65635
fix: add creationflags to tirith_security subprocess calls (Windows console flash)#65635AlexFucuson9 wants to merge 1 commit into
Conversation
On Windows, subprocess.run() without CREATE_NO_WINDOW (0x08000000) spawns a visible console window that flashes briefly. This affects the cosign verification and tirith security check commands. Fix: add windows_hide_flags() creationflags on Windows, same pattern used in tts_tool.py, browser_tool.py, and other tools.
teknium1
left a comment
There was a problem hiding this comment.
Thanks for addressing Windows console behavior.
Problems
- The two edited calls are not reachable on native Windows in current main.
check_command_security()returns before spawning Tirith whenis_platform_supported()is false (tools/tirith_security.py:755-759)._detect_target()returnsNonefor Windows (tools/tirith_security.py:245-261), and_install_tirith()therefore returns before it can call_verify_cosign()(tools/tirith_security.py:395-399). The documented behavior is to silently skip Tirith on Windows and use WSL (website/docs/user-guide/security.md:648).
Suggested changes
- Please identify a currently reachable Windows subprocess before applying this pattern; these two additions do not change native-Windows runtime behavior.
Automated hermes-sweeper review.
| @@ -318,6 +321,7 @@ def _verify_cosign(checksums_path: str, sig_path: str, cert_path: str) -> bool | | |||
| text=True, | |||
There was a problem hiding this comment.
_verify_cosign() is only invoked from _install_tirith(), which returns before downloading or verifying on Windows because _detect_target() has no Windows target (tools/tirith_security.py:245-261, 395-399). This flag cannot affect a native-Windows execution path.
| @@ -779,6 +783,7 @@ def check_command_security(command: str) -> dict: | |||
| text=True, | |||
There was a problem hiding this comment.
On Windows, check_command_security() returns at the unsupported-platform guard before reaching this call (tools/tirith_security.py:755-759). The added creation flag is therefore unreachable on the reported platform.
|
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. |
Summary
On Windows,
subprocess.run()/subprocess.Popen()withoutCREATE_NO_WINDOW(0x08000000) spawns a visible console window (cmd.exe / conhost.exe) that flashes briefly. This affects two calls intools/tirith_security.py:_verify_cosign()— cosign provenance verification (line 321)check_command_security()— tirith security scan (line 783)Both calls have
stdin=subprocess.DEVNULLandcapture_output=True, so they're clearly non-interactive and should not show a console window.Fix
Add
windows_hide_flags()creationflags on Windows, same pattern used in:tools/tts_tool.py(6 calls)tools/browser_tool.py(2 calls)tools/process_registry.pytools/env_probe.pytools/lazy_deps.pyImport from
hermes_cli._subprocess_compat.Changes
tools/tirith_security.py: Add import + 2 creationflags linesTest Plan