Skip to content

fix: add creationflags to plugins subprocess calls (Windows console flash) - #65660

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

fix: add creationflags to plugins subprocess calls (Windows console flash)#65660
AlexFucuson9 wants to merge 1 commit into
NousResearch:mainfrom
AlexFucuson9:fix/plugins-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. Three plugins have non-interactive subprocess calls missing this flag:

  1. plugins/platforms/telegram/adapter.py — ffprobe duration check (line 353)
  2. plugins/platforms/discord/voice_mixer.py — ffmpeg PCM decode (line 312)
  3. plugins/platforms/raft/adapter.py — raft bridge Popen (line 548)

All three have stdin=DEVNULL and capture_output=True (or are Popen with no interactive I/O), so they should not show a console window.

Fix

Add creationflags=0x08000000 on Windows, same pattern used in:

  • tools/tts_tool.py (6 calls)
  • tools/browser_tool.py (2 calls)
  • tools/tirith_security.py (2 calls)
  • tools/env_probe.py
  • tools/lazy_deps.py

Changes

  • plugins/platforms/telegram/adapter.py: +2 lines
  • plugins/platforms/discord/voice_mixer.py: +2 lines
  • plugins/platforms/raft/adapter.py: +2 lines

Test Plan

  • Unit tests pass
  • Verified on Windows: no console flash on ffprobe, ffmpeg, raft bridge

…lash)

On Windows, subprocess.run()/Popen() without CREATE_NO_WINDOW
(0x08000000) spawns a visible console window that flashes briefly.

Three plugins have non-interactive subprocess calls missing this flag:
- plugins/platforms/telegram/adapter.py: ffprobe duration check
- plugins/platforms/discord/voice_mixer.py: ffmpeg PCM decode
- plugins/platforms/raft/adapter.py: raft bridge Popen

All three have stdin=DEVNULL and capture_output=True (or are Popen
with no interactive I/O), so they should not show a console window.
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/plugins Plugin system and bundled plugins platform/telegram Telegram bot adapter platform/discord Discord bot adapter platform/windows Native Windows-specific behavior or breakage 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 identifying three current Windows subprocess gaps. The premise holds on current main: the ffmpeg, ffprobe, and Raft bridge calls at plugins/platforms/discord/voice_mixer.py:312-324, plugins/platforms/telegram/adapter.py:353-357, and plugins/platforms/raft/adapter.py:548-550 have no creationflags.

Problems

  • The new raw 0x08000000 / sys.platform branches bypass the project helper. hermes_cli/_subprocess_compat.py:186-201 provides windows_hide_flags() specifically for this behavior and returns 0 on POSIX.
  • The sweep leaves current Windows sibling calls uncovered: WhatsApp's taskkill at plugins/platforms/whatsapp/adapter.py:223-228 and Node version probe at :349-354 also have no no-window flag.
  • The diff adds no regression coverage. tests/test_windows_subprocess_no_window_flags.py:304-320 shows the existing mocked assertion pattern.

Suggested changes

  • Use windows_hide_flags() for all three changed calls.
  • Add focused flag-propagation tests, and include or split the verified WhatsApp siblings.

Automated hermes-sweeper review.

capture_output=True,
timeout=timeout,
stdin=subprocess.DEVNULL,
**({"creationflags": 0x08000000} if sys.platform == "win32" else {}),

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.

Please use windows_hide_flags() here (and at the other two new sites) rather than a raw literal/platform branch. hermes_cli._subprocess_compat centralizes this policy and returns 0 on POSIX.

@teknium1 teknium1 added the sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform 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/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have platform/discord Discord bot adapter platform/telegram Telegram bot adapter platform/windows Native Windows-specific behavior or breakage sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform 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