Skip to content

fix(browse): pass windowsHide in bun-polyfill spawn wrappers (Windows console flash every 60s)#2294

Open
rroojrooj wants to merge 1 commit into
garrytan:mainfrom
rroojrooj:fix/windows-spawn-windowshide
Open

fix(browse): pass windowsHide in bun-polyfill spawn wrappers (Windows console flash every 60s)#2294
rroojrooj wants to merge 1 commit into
garrytan:mainfrom
rroojrooj:fix/windows-spawn-windowshide

Conversation

@rroojrooj

Copy link
Copy Markdown

What

Adds windowsHide: true to the spawn/spawnSync wrappers in browse/src/bun-polyfill.cjs.

Why

On Windows the browse daemon runs under Node via bun-polyfill.cjs (Bun can't drive Playwright's Chromium there — the polyfill's own header cites oven-sh/bun#4253/#9911). The polyfill forwards only {stdio, env, cwd} to child_process and drops windowsHide, so every child process the daemon spawns gets a visible conhost window.

The most user-visible symptom: the terminal-agent watchdog in server-node.mjs respawns bun run terminal-agent.ts every 60s (AGENT_WATCHDOG_TICK_MS default), so users see a bun.exe console window flash roughly once a minute per daemon, indefinitely. I measured two daemons alive concurrently on my machine → a flash every ~30 seconds, all day.

Because the polyfill is the single choke-point every Bun.spawn/Bun.spawnSync call goes through on Windows, fixing it here covers all spawn sites at once (tasklist liveness probes, PowerShell helpers, the terminal-agent, etc.). windowsHide is ignored by Node on non-Windows platforms, so this is a no-op everywhere else.

Note: patching the call sites instead would not work — the options never reach child_process unless the polyfill forwards them.

Testing

  • node --check passes.
  • Applied the same two-line change to a live install (Windows 11 Pro, build 26200): watchdog respawns continue (separate issue, filed with measurements) but no console window is shown.

There's a companion issue with full measurements of the watchdog respawn/leak behavior this change makes invisible but does not fix — the leak itself deserves its own fix.

🤖 Generated with Claude Code

…s don't flash console windows

On Windows the browse daemon runs under Node via bun-polyfill.cjs (Bun
cannot drive Playwright's Chromium there). The polyfill's spawn/spawnSync
forward only stdio/env/cwd and drop windowsHide, so every child process
gets a visible conhost window.

The most user-visible effect: the terminal-agent watchdog respawns
'bun run terminal-agent.ts' every 60s (AGENT_WATCHDOG_TICK_MS), so users
see a bun.exe console window flash roughly once a minute per daemon,
indefinitely. With two daemons alive that's a flash every ~30 seconds.

windowsHide is ignored on non-Windows platforms, so this is a no-op
everywhere else.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@trunk-io

trunk-io Bot commented Jul 18, 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

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