Skip to content

fix: add Windows compatibility for browse server - #25

Closed
DanMcInerney wants to merge 1 commit into
garrytan:mainfrom
DanMcInerney:fix/windows-bun-playwright-compat
Closed

DanMcInerney wants to merge 1 commit into
garrytan:mainfrom
DanMcInerney:fix/windows-bun-playwright-compat

Conversation

@DanMcInerney

Copy link
Copy Markdown

Summary

  • Root cause: Bun's subprocess management hangs when Playwright calls chromium.launch() on Windows. Node.js works fine with the same Playwright code.
  • Replace Bun.serve() with node:http createServer() — works in both Bun and Node
  • Replace Bun.serve() port scanning with node:net createServer()
  • On Windows, spawn the server via node:child_process with detached: true running a pre-bundled dist/server.js under Node. On Unix, behavior is unchanged (Bun runs .ts source directly).
  • Fix resolveServerScript() dev-mode path check that excluded Windows paths

How it works

Platform CLI binary Server runtime Server source
Linux/Mac browse (Bun compiled) bun run src/server.ts TypeScript source
Windows browse.exe (Bun compiled) node dist/server.js Pre-bundled JS

The build step now also produces dist/server.js via bun build --target node --packages external for the Windows/Node path.

Test plan

  • Verified chromium.launch() hangs under Bun on Windows, works under Node
  • Rebuilt CLI + server bundle successfully
  • browse goto <url> starts server and navigates
  • Server persists between CLI calls (no "Starting server..." on subsequent commands)
  • browse status, browse text, browse screenshot, browse snapshot -i all work
  • Unix path (Bun) is unchanged — only Windows path diverges

🤖 Generated with Claude Code

Bun's subprocess management hangs when Playwright calls chromium.launch()
on Windows. This replaces Bun-specific APIs with cross-runtime equivalents
so the server works under both Bun (Unix) and Node (Windows):

- Replace Bun.serve() with node:http createServer (works in both runtimes)
- Replace Bun.serve() port scanning with node:net createServer
- On Windows, spawn server via node:child_process with detached:true
  (Bun.spawn + unref doesn't properly orphan on Windows)
- Build step now also bundles server.js for Node via --target node
- Fix resolveServerScript() dev-mode check for Windows paths

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@garrytan

Copy link
Copy Markdown
Owner

Closing — we can't support Windows at this time. The Bun.serve → node:http migration adds significant complexity and a dual-runtime server path. Appreciate the investigation into the Chromium launch hang though.

@garrytan garrytan closed this Mar 13, 2026
Jmeg8r added a commit to Jmeg8r/gstack that referenced this pull request Nov 8, 2026
…sing the snapshot' (garrytan#25) from fix/cso-symlink-alias into main
capy-ai Bot added a commit that referenced this pull request Nov 22, 2026
…ow leads to a /ship sign-off (GST-3546) (#4717)

After a pull request's two review rounds, an approved extra check of the
fixes now ends in a /ship sign-off instead of a dead end.

Why: three projects (gbrain #10068, gskills #23–#25, gstack #4712) had
no way to finish after a ruling at the round limit and skipped the
sign-off or bent their records.

Nothing to do: the next /ship uses it.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/specialist-batched#1 reader=security
Review-Finding: p1/specialist-batched#2 reader=state-machines
Review-Finding: p1/specialist-batched#3 reader=state-machines
Review-Finding: p1/red-team#1 reader=red-team
Review-Finding: p1/red-team#2 reader=red-team
Review-Finding: p2/outside-voice#1 reader=outside-voice
Review-Finding: p2/outside-voice#2 reader=outside-voice
Review-Finding: p2/outside-voice#3 reader=outside-voice
Review-Finding: p2/adversarial-native#1 reader=adversarial-native
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.

2 participants