From 6e8574bde434d0e58b517c4ab28c789facaccd31 Mon Sep 17 00:00:00 2001 From: Derek Date: Sat, 13 Jun 2026 12:08:18 -0400 Subject: [PATCH] fix(browse): suppress remaining Windows console-window flashes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Windows the browse tool pops console windows during normal use. #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. --- browse/src/browser-manager.ts | 10 ++++++++++ browse/src/cli.ts | 6 ++++-- browse/src/terminal-agent-control.ts | 7 ++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/browse/src/browser-manager.ts b/browse/src/browser-manager.ts index 2bc1c597d..3aa6d806b 100644 --- a/browse/src/browser-manager.ts +++ b/browse/src/browser-manager.ts @@ -369,6 +369,16 @@ export class BrowserManager { console.log(`[browse] Extensions loaded from: ${extensionsDir}`); } + // Windows: the default headless path launches chrome-headless-shell.exe — a + // CONSOLE-subsystem binary that pops a terminal window on every launch. Switch + // to Chrome's "new" headless (full chrome.exe, GUI-subsystem → no console + // window) by launching non-headless with --headless=new. Other platforms keep + // the lighter headless shell (they have no console-window problem). + if (process.platform === 'win32' && useHeadless) { + launchArgs.push('--headless=new'); + useHeadless = false; + } + this.browser = await chromium.launch({ headless: useHeadless, // On Windows, Chromium's sandbox fails when the server is spawned through diff --git a/browse/src/cli.ts b/browse/src/cli.ts index 59327b792..b4b70b1fb 100644 --- a/browse/src/cli.ts +++ b/browse/src/cli.ts @@ -323,9 +323,11 @@ async function startServer(extraEnv?: Record): Promise