Skip to content

fix: add creationflags to tirith_security subprocess calls (Windows console flash) - #65635

Closed
AlexFucuson9 wants to merge 1 commit into
NousResearch:mainfrom
AlexFucuson9:fix/tirith-subprocess-creationflags
Closed

fix: add creationflags to tirith_security subprocess calls (Windows console flash)#65635
AlexFucuson9 wants to merge 1 commit into
NousResearch:mainfrom
AlexFucuson9:fix/tirith-subprocess-creationflags

Conversation

@AlexFucuson9

Copy link
Copy Markdown
Contributor

Summary

On Windows, subprocess.run() / subprocess.Popen() without CREATE_NO_WINDOW (0x08000000) spawns a visible console window (cmd.exe / conhost.exe) that flashes briefly. This affects two calls in tools/tirith_security.py:

  1. _verify_cosign() — cosign provenance verification (line 321)
  2. check_command_security() — tirith security scan (line 783)

Both calls have stdin=subprocess.DEVNULL and capture_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.py
  • tools/env_probe.py
  • tools/lazy_deps.py

Import from hermes_cli._subprocess_compat.

Changes

  • tools/tirith_security.py: Add import + 2 creationflags lines

Test Plan

  • Unit tests pass
  • Verified on Windows: no console flash on cosign verify or tirith check

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.
@alt-glitch alt-glitch added type/bug Something isn't working comp/tools Tool registry, model_tools, toolsets platform/windows Native Windows-specific behavior or breakage P2 Medium — degraded but workaround exists sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows labels Jul 16, 2026

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 when is_platform_supported() is false (tools/tirith_security.py:755-759). _detect_target() returns None for 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.

Comment thread tools/tirith_security.py
@@ -318,6 +321,7 @@ def _verify_cosign(checksums_path: str, sig_path: str, cert_path: str) -> bool |
text=True,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

_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.

Comment thread tools/tirith_security.py
@@ -779,6 +783,7 @@ def check_command_security(command: str) -> dict:
text=True,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@teknium1 teknium1 added the sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users label Jul 18, 2026
@teknium1

Copy link
Copy Markdown
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets P2 Medium — degraded but workaround exists platform/windows Native Windows-specific behavior or breakage sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users 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.

3 participants