Skip to content

fix(windows): silence conhost flashes from core-side spawns (#731/#1338 follow-up)#1498

Merged
senamakel merged 3 commits into
tinyhumansai:mainfrom
sanil-23:fix/windows-conhost-flashes
May 11, 2026
Merged

fix(windows): silence conhost flashes from core-side spawns (#731/#1338 follow-up)#1498
senamakel merged 3 commits into
tinyhumansai:mainfrom
sanil-23:fix/windows-conhost-flashes

Conversation

@sanil-23
Copy link
Copy Markdown
Contributor

@sanil-23 sanil-23 commented May 11, 2026

Summary

  • Adds CREATE_NO_WINDOW (creation_flags(0x0800_0000)) to every core-side child-process spawn on Windows.
  • Without this flag Windows allocates a conhost for each child via CreateProcess, causing a continuous terminal-flash storm when polled RPCs fan out into native command probes (e.g. local_ai_device_profilenvidia-smi).
  • New helper src/openhuman/local_ai/process_util.rs exposes apply_no_window(&mut tokio::process::Command) so call sites don't repeat the cfg(windows) block.
  • Shell-side spawns were fixed in fix(windows): hide conhost window spawned with core sidecar #731 and fix(windows): suppress console flash for netstat/taskkill spawns #1338; this patch covers the missed core-side sites.
  • 9 files changed, 122 insertions, 45 deletions.

Problem

On a fresh Windows install, any frontend-polled RPC that fans out into a native command probe (e.g. local_ai_device_profilenvidia-smi --query-gpu) caused a continuous conhost flash storm — visible before the auth screen had even rendered.

windows_subsystem = "windows" on the parent process (Tauri shell) prevents that process from inheriting a console, but each CreateProcess call for a child still allocates a new conhost unless CREATE_NO_WINDOW is explicitly passed in dwCreationFlags. #731 fixed the core sidecar spawn; #1338 fixed netstat/taskkill in the shell. The core-side spawns were missed in both passes.

Solution

  • New helper local_ai/process_util::apply_no_window wraps the #[cfg(windows)] + creation_flags(0x0800_0000) detail; callers just call the helper on their Command.
  • For std::process::Command sites and one-off cases, the cfg block is inlined directly.
  • Sites patched:
    • local_ai/install.rs: PowerShell wrapper running OllamaSetup.exe
    • local_ai/service/ollama_admin.rs: ollama --version, ollama serve, command_works candidate probe, taskkill /F /IM ollama.exe
    • local_ai/device.rs: nvidia-smi --query-gpu — re-probed by handle_local_ai_device_profile on every poll (the main visible loop)
    • doctor/core.rs: PowerShell Get-PSDrive for disk space + <cmd> --version for git/curl/etc. in check_command_available
    • node_runtime/resolver.rs: <bin> --version in probe_subcommand_version
    • service/common.rs helpers (run_checked, run_capture, run_best_effort, run_check_silent) — silences every schtasks call at the helper boundary (covers status/start/stop/install/uninstall). Linux systemctl and macOS launchctl go through the same helpers; no_window is a cfg(not(windows)) no-op on those targets.
    • service/windows.rs:is_task_exists_windows: bypasses the common helpers; patched directly with creation_flags.

Submission Checklist

  • Tests added or updated (happy path + at least one failure / edge case) per Testing Strategy
    process_util.rs carries a smoke test asserting apply_no_window is callable on every platform. Assertable behavior beyond that requires inspecting Windows process-creation flags at the OS level, which is not reachable from Rust unit tests.
  • N/A: Diff coverage ≥ 80% — changes are Windows-only conditional-compilation glue around existing tested call sites; no new logic to cover with diff-cover on Linux CI runners.
  • N/A: Coverage matrix updated — behaviour-only change; no feature rows added/removed/renamed.
  • N/A: All affected feature IDs from the matrix are listed under ## Related — no feature-matrix entries touched.
  • No new external network dependencies introduced (mock backend used per Testing Strategy)
  • N/A: Manual smoke checklist updated — invisible-to-user fix; behavior matches the windows_subsystem="windows" linker attribute on the parent.
  • N/A: Linked issue closed via Closes #NNN — the core-side conhost flash bug was not tracked under its own issue; see ## Related for prior-art references.

Impact

Windows-only fix. On Windows, every core-side child-process spawn now sets CREATE_NO_WINDOW; no conhost is allocated. No behavior change on macOS or Linux — the cfg(not(windows)) path is a no-op. No UI surface change, no new API, no migration needed.

Related


AI Authored PR Metadata (required for Codex/Linear PRs)

Linear Issue

  • Key: N/A
  • URL: N/A

Commit & Branch

  • Branch: fix/windows-conhost-flashes
  • Commit SHA: 61c724be51046ece40618811121c6b46791f4c60

Validation Run

  • pnpm --filter openhuman-app format:check
  • pnpm typecheck
  • Focused tests: process_util.rs smoke test (callable on all platforms)
  • Rust fmt/check (if changed): cargo check -p openhuman --target x86_64-pc-windows-msvc clean (only pre-existing warnings in slack_backfill.rs); cargo fmt --check clean
  • N/A: Tauri fmt/check (if changed): N/A — no Tauri shell changes

Validation Blocked

  • command: N/A
  • error: N/A
  • impact: N/A

Behavior Changes

  • Intended behavior change: All core-side child processes on Windows are spawned with CREATE_NO_WINDOW; no conhost window appears for any native probe.
  • User-visible effect: Conhost flash storm gone — confirmed end-to-end on contributor's Windows machine, both with and without Ollama installed.

Parity Contract

  • Legacy behavior preserved: All spawn logic is unchanged on macOS and Linux; apply_no_window and inline cfg blocks are no-ops on non-Windows targets.
  • Guard/fallback/dispatch parity checks: service/common.rs helpers used by Linux systemctl and macOS launchctl are unaffected; creation_flags path is Windows-only.

Duplicate / Superseded PR Handling

  • Duplicate PR(s): none
  • Canonical PR: this PR
  • Resolution (closed/superseded/updated): N/A

Summary by CodeRabbit

  • Bug Fixes
    • Fixed unexpected console windows appearing on Windows during background operations, including system diagnostics, device detection, service management, and installation processes.
    • Enhanced user experience and system responsiveness by eliminating visual interruptions from background processes.
    • Improved overall visual polish for a cleaner, more professional user interface on Windows.

Review Change Stack

@sanil-23 sanil-23 requested a review from a team May 11, 2026 17:56
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 600e47c4-ae81-49eb-8967-e9dddf61bb8c

📥 Commits

Reviewing files that changed from the base of the PR and between 3aa2654 and 84c24b7.

📒 Files selected for processing (9)
  • src/openhuman/doctor/core.rs
  • src/openhuman/local_ai/device.rs
  • src/openhuman/local_ai/install.rs
  • src/openhuman/local_ai/mod.rs
  • src/openhuman/local_ai/process_util.rs
  • src/openhuman/local_ai/service/ollama_admin.rs
  • src/openhuman/node_runtime/resolver.rs
  • src/openhuman/service/common.rs
  • src/openhuman/service/windows.rs
✅ Files skipped from review due to trivial changes (1)
  • src/openhuman/service/windows.rs
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/openhuman/local_ai/device.rs
  • src/openhuman/doctor/core.rs
  • src/openhuman/local_ai/process_util.rs
  • src/openhuman/local_ai/service/ollama_admin.rs

📝 Walkthrough

Walkthrough

Suppresses console windows on Windows for spawned subprocesses by adding a cross-platform helper and applying CREATE_NO_WINDOW across service runners, local-AI probes/installers, diagnostics, node runtime probes, and Windows task queries.

Changes

Windows Process No-Window Suppression

Layer / File(s) Summary
Cross-Platform Process Helper Module
src/openhuman/local_ai/process_util.rs, src/openhuman/local_ai/mod.rs
New module defines Windows CREATE_NO_WINDOW constant and apply_no_window(cmd); Windows implementation sets creation_flags on tokio::process::Command, non-Windows is a no-op. Includes a compile/callability test.
Service Command Execution Helper
src/openhuman/service/common.rs
Adds platform-gated no_window(&mut Command) and calls it from run_checked, run_capture, run_best_effort, and run_check_silent.
Local AI Device and Service
src/openhuman/local_ai/device.rs, src/openhuman/local_ai/service/ollama_admin.rs, src/openhuman/local_ai/install.rs
NVIDIA probe, Ollama --version checks, server spawn/kill, and installer PowerShell command now construct mutable Command instances and apply the no-window helper before executing/spawning.
Diagnostic and Runtime Probes
src/openhuman/doctor/core.rs, src/openhuman/node_runtime/resolver.rs
Disk-space check, generic command-availability check, and node runtime --version probe refactored to build Command and set Windows creation_flags (CREATE_NO_WINDOW) before output/spawn.
Windows Task Existence Check
src/openhuman/service/windows.rs
schtasks /Query now sets creation_flags(0x0800_0000) via CommandExt import to suppress window during task existence checks.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • senamakel

Poem

🐰 Soft paws on keys, I whisper low,

No flashing consoles where processes go.
Flags set in silence, windows stay still,
Commands now tiptoe at my will.
— a rabbit, pleased and quiet 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 63.64% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically identifies the main change: preventing console window flashes on Windows by silencing conhost allocation during spawned processes, with a reference to related issues.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/openhuman/doctor/core.rs`:
- Around line 745-746: The match expression `match child_cmd.output()` in
core.rs is split across two lines causing cargo fmt failure; collapse it so the
opening brace sits on the same line as the match (i.e., `match
child_cmd.output() {`) and then run `cargo fmt` (or `cargo fmt --all` / your
editor formatter) to ensure the rest of the surrounding block (the arms handling
the Result) is properly formatted and passes `cargo fmt --check`.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e289d401-30ea-4c3f-bdad-8de5393a2e52

📥 Commits

Reviewing files that changed from the base of the PR and between fc573b0 and 61c724b.

📒 Files selected for processing (9)
  • src/openhuman/doctor/core.rs
  • src/openhuman/local_ai/device.rs
  • src/openhuman/local_ai/install.rs
  • src/openhuman/local_ai/mod.rs
  • src/openhuman/local_ai/process_util.rs
  • src/openhuman/local_ai/service/ollama_admin.rs
  • src/openhuman/node_runtime/resolver.rs
  • src/openhuman/service/common.rs
  • src/openhuman/service/windows.rs

Comment thread src/openhuman/doctor/core.rs Outdated
sanil-23 and others added 3 commits May 12, 2026 00:23
/tinyhumansai#1338 follow-up)

On Windows, `CreateProcess` allocates a conhost for every child
unless `CREATE_NO_WINDOW` (creation flag `0x0800_0000`) is set. The
shell-side spawns were fixed in tinyhumansai#731 (core sidecar) and tinyhumansai#1338
(netstat/taskkill). The core-side spawns were not — so any
frontend-polled RPC that fans out into a native command (e.g.
`local_ai_device_profile` -> `nvidia-smi`) flashes a console window
on every poll. On a fresh Windows install with no Ollama, the
combined effect was a continuous terminal-flash storm before the
auth screen had even rendered.

Sites covered:

- `local_ai/install.rs`: PowerShell wrapper that runs OllamaSetup.exe
- `local_ai/service/ollama_admin.rs`: `ollama --version`, `ollama serve`,
  candidate probe in `command_works`, `taskkill /F /IM ollama.exe`
- `local_ai/device.rs`: `nvidia-smi --query-gpu` — re-probed by
  `handle_local_ai_device_profile` on every poll
- `doctor/core.rs`: PowerShell `Get-PSDrive` for disk space, and
  `<cmd> --version` for `git` / `curl` / etc.
- `node_runtime/resolver.rs`: `<bin> --version` in `probe_subcommand_version`
- `service/common.rs` helpers (`run_checked`, `run_capture`,
  `run_best_effort`, `run_check_silent`) — silences every Windows
  `schtasks` call at the helper boundary (covers `status`, `start`,
  `stop`, `install`, `uninstall`, `is_task_exists_windows`).
  Linux `systemctl` and macOS `launchctl` callers go through the
  same helpers; `no_window` is a `cfg(not(windows))` no-op for them.

New helper `local_ai/process_util::apply_no_window` keeps the
`cfg(windows)` + `creation_flags` detail out of call sites.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collapse `match child_cmd.output()\n    {` onto a single line as
required by rustfmt. Fixes cargo fmt --check CI failure on this branch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sanil-23 sanil-23 force-pushed the fix/windows-conhost-flashes branch from 22ff225 to 84c24b7 Compare May 11, 2026 18:53
@senamakel senamakel merged commit f0606ba into tinyhumansai:main May 11, 2026
21 checks passed
AusAgentSmith pushed a commit to AusAgentSmith/openhuman that referenced this pull request May 23, 2026
…nsai#731/tinyhumansai#1338 follow-up) (tinyhumansai#1498)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants