From a8b5bc59ec2af51f7fb21fd861ce38661f88f7fd Mon Sep 17 00:00:00 2001 From: blueverse-hh Date: Fri, 19 Jun 2026 23:05:17 -0400 Subject: [PATCH] fix(browse): stop stray Windows console windows during browse The browse daemon is launched detached (cli.ts startServer), which on Windows gives it NO console. Console children it then spawns -- chrome-headless-shell.exe via Playwright, `bun` skill helpers, the taskkill cleanup -- find no console to inherit, so Windows allocates a fresh VISIBLE console window for each. Users see stray chrome-headless-shell / bun terminal windows during browse use; some linger for the browser's lifetime. Neither the user's default-terminal choice nor a flag on the daemon itself fixes it: a detached process has no console regardless. Verified on Windows 11: a child of a detached/console-less parent is visible without windowsHide and hidden with it (windowsHide => CREATE_NO_WINDOW, which suppresses the window even when the parent has no console). Fix: the daemon defaults windowsHide:true for every child_process spawn (win-console-hide.ts, imported first in server.ts so it patches the child_process singleton before Playwright's first launch()). playwright-core reads spawn via a live `__toESM(require("child_process")).spawn` getter at call time, so patching the singleton covers its browser launch even though spawn options can't be passed through chromium.launch(). gstack's own Bun.spawn skill helpers and the detached launcher / attack-telemetry spawns set windowsHide directly. End-to-end: `browse goto` now starts the daemon and 4 chrome-headless-shell processes with zero visible windows. Adds a static-grep tripwire so the flag and import order can't regress. Co-Authored-By: Claude Opus 4.8 (1M context) --- browse/src/browser-skill-commands.ts | 2 + browse/src/cli.ts | 10 +++- browse/src/security.ts | 4 ++ browse/src/server.ts | 5 ++ browse/src/win-console-hide.ts | 60 +++++++++++++++++++ .../windows-hide-detached-console.test.ts | 60 +++++++++++++++++++ 6 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 browse/src/win-console-hide.ts create mode 100644 browse/test/windows-hide-detached-console.test.ts diff --git a/browse/src/browser-skill-commands.ts b/browse/src/browser-skill-commands.ts index 3c0805f5d..fc7c542f9 100644 --- a/browse/src/browser-skill-commands.ts +++ b/browse/src/browser-skill-commands.ts @@ -190,6 +190,7 @@ async function handleTest(args: string[], ctx: SkillCommandContext): Promise): Promise