Skip to content

Daemon: start every program without a console window on Windows - #157

Merged
svemyh merged 2 commits into
mainfrom
reason/windows-hide-reason-netw-c0fbae74
Oct 27, 2026
Merged

svemyh merged 2 commits into
mainfrom
reason/windows-hide-reason-netw-c0fbae74

Conversation

@reason-machines

@reason-machines reason-machines Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Why

On Windows the daemon runs without a console (daemon --service, relaunched hidden with CREATE_NO_WINDOW), but the console programs it starts were spawned without CREATE_NO_WINDOW, so Windows gave each one a new console window that flashed open and closed. The repeating flash came from reason session list every 15s, plus reason network __relay restarts, curl (update check, relays), reg query (service check), exe tray, exe --version, and agent CLIs for mail.

What

  • util::no_window(cmd) sets CREATE_NO_WINDOW on Windows for both std and tokio Commands. It does nothing on other platforms.
  • Every program started from src/daemon/**, src/relays.rs, and the reg calls in setup.rs that the daemon reaches now goes through it. notify.rs's hand-set flag also goes through the helper now.
  • windows-sys gains the Win32_System_Console feature for the test.
  • No other behavior change. No version bump.

Tests (red, then green)

  • util::tests::every_program_the_daemon_starts_goes_through_no_window (all platforms): scans the daemon's sources for Command::new/Command::from calls that are not wrapped in no_window(. On the red commit it failed on Linux, macOS and Windows with 17 raw spawns.
  • util::tests::a_child_started_without_a_console_gets_no_window (Windows only): starts the test exe with DETACHED_PROCESS (no console, as the daemon runs), and that process starts a child through no_window. The test asserts GetConsoleWindow() is null in the child. On the red commit (helper stubbed as a no-op), windows-latest failed with "the child had a console window".
  • The red commit's CI run on windows-latest showed 245 passed; 2 failed. The commits after it add the fix and normalize CRLF in the scan test, because Windows checks out with CRLF.
  • Local Linux: cargo fmt --check, cargo clippy --all-targets --locked -- -D warnings and cargo test --locked pass (257 + 2). This PR's CI covers Linux, macOS and Windows.

Not verified

No screenshot from an interactive Windows 11 desktop. The windows-latest test checks for the console window directly instead.

Releasing and the monorepo pin bump are left to the engine owner.

Contributors

reason-machines Bot and others added 2 commits October 26, 2026 15:30
…ling)

Co-authored-by: qa-runner2-star <319404260+qa-runner2-star@users.noreply.github.com>
Co-authored-by: qa-runner2-star <319404260+qa-runner2-star@users.noreply.github.com>
@reason-machines
reason-machines Bot marked this pull request as ready for review October 26, 2026 15:37

@svemyh svemyh 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.

Independent review of 9bcbbab: every spawn reachable from the daemon (reason session list every 15 s, the __relay start, mail delivery to agent CLIs, curl, reg, update/--version, notify/ask) now goes through util::no_window; the helper is a no-op off Windows; the Windows CI test proves a DETACHED child gets no console. This is the cause of the console windows flashing every few seconds reported by a Windows/OpenCode user on 10-21 (CLI 0.2.504). Merging.

@svemyh svemyh 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.

Approved after independent review of 9bcbbab (see comment above); all required checks green.

@svemyh
svemyh merged commit 892b740 into main Oct 27, 2026
8 checks passed
@svemyh
svemyh deleted the reason/windows-hide-reason-netw-c0fbae74 branch October 27, 2026 20:33
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.

1 participant