Skip to content

fix(browse): suppress remaining Windows console-window flashes (Chromium headless shell + daemon/agent spawns) - #1998

Closed
KrunchMuffin wants to merge 1 commit into
garrytan:mainfrom
KrunchMuffin:fix/windows-console-windows
Closed

KrunchMuffin wants to merge 1 commit into
garrytan:mainfrom
KrunchMuffin:fix/windows-console-windows

Conversation

@KrunchMuffin

Copy link
Copy Markdown

Problem

On Windows, the browse tool pops console windows during normal use (issue #1952). #1979 fixes one source — the watchdog's tasklist call flashing a conhost.exe window every 60s. This PR addresses the other three sources, which complement that fix.

Sources fixed

Window Cause Fix
chrome-headless-shell.exe (every browse action) The default headless path launches the console-subsystem headless shell, which pops a window on Windows. Force Chrome's --headless=new on Windows → full chrome.exe (GUI-subsystem, no console window). Other platforms keep the lighter shell.
node daemon (Windows detached spawn) detached: true on Windows creates a console window unless windowsHide is set. windowsHide: true on the launcher + the detached server spawn.
bun terminal-agent Spawned via Bun.spawn, whose windowsHide does not reliably suppress the window on Windows. Spawn via Node's child_process.spawn with windowsHide: true (reliable), same unref'd lifecycle.

Changes

  • browse/src/browser-manager.ts — --headless=new on Windows in launch().
  • browse/src/cli.ts — windowsHide on the Windows daemon spawn.
  • browse/src/terminal-agent-control.ts — Node spawn + windowsHide for the terminal-agent.

Source-only; browse/dist is gitignored.

Verification (Windows 11)

  • Process list shows chrome.exe ... --headless=new, no chrome-headless-shell.exe.
  • Screenshots render correctly under new-headless.
  • Single daemon, no stray bun/conhost windows during normal browsing.

Notes

On Windows the browse tool pops console windows during normal use. garrytan#1979 fixes
one source (the watchdog's tasklist → conhost flash every 60s). This addresses
the other three:

- chrome-headless-shell.exe (every browse action): the default headless path
  launches the console-subsystem headless shell, which pops a window. Force
  Chrome's "new" headless (full chrome.exe, GUI-subsystem → no console window)
  on Windows via --headless=new. Other platforms keep the lighter shell.
- node daemon (detached spawn on Windows): detached spawns create a console
  window unless windowsHide is set. Added it to the launcher + the detached
  server spawn.
- bun terminal-agent: spawned via Bun.spawn, whose windowsHide does not
  reliably suppress the window on Windows. Switched to Node's child_process
  .spawn with windowsHide (reliable), same unref'd lifecycle.

Verified on Win11: no chrome-headless-shell process (chrome.exe --headless=new
in the cmdline), screenshots render correctly, single daemon, no stray bun
windows.
@trunk-io

trunk-io Bot commented Jun 13, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@jbetala7

Copy link
Copy Markdown
Contributor

Cross-link: #1983 ("fix browse lifecycle on Windows") independently makes the same two browse/src/cli.ts edits this PR does (lines 326 and 328 on current main) — windowsHide: true on the detached Node daemon spawn and on the Bun.spawnSync(['node', '-e', launcherCode], ...) launcher. Both stem from #1952, so whichever merges first, the other needs a rebase on those exact lines.

This PR is the more focused console-flash fix — it also adds --headless=new and the terminal-agent-control.ts agent-spawn windowsHide that #1983 doesn't touch — while #1983 additionally reworks the status/stop lifecycle and adds a /status endpoint. Flagging the shared spawn edits so the duplicate doesn't get merged twice.

@time-attack

Copy link
Copy Markdown
Contributor

@16francej Please close this because it combines duplicate launcher edits with untested browser-mode and terminal-agent changes; focused rewrites cover the useful parts.

@capy-ai

capy-ai Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Thanks for chasing the console flashes. Superseded: main now sets windowsHide on every spawn (enforced by a sweep test), patches Playwright's spawn, and forwards windowsHide/detached through the Bun polyfill. Closing.

@capy-ai capy-ai Bot closed this Oct 8, 2026
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.

3 participants