browse: Bun.spawn pipe hangs on WSL even with successful compile + HTTP proxy intercepts localhost
Summary
On WSL (Ubuntu on Windows), browse goto <url> hangs indefinitely at [browse] Starting server... even though the compiled binary and server are functional individually. Two independent root causes discovered.
Environment
- WSL2 (Ubuntu 24.04) on Windows 11
- gstack v0.11.18.2 (freshly upgraded from 0.3.7)
- Bun 1.3.11
- Chromium (ms-playwright) available and working
Root Cause 1: Bun.spawn stdio pipe hang
The compiled browse binary successfully spawns bun run server.ts (verified via pstree — full process tree with bun + chrome-headless visible). However, the parent process (CLI) never receives the "server ready" signal via the stdio pipe.
Evidence:
bun run server.tsdirectly: works, state file written in <2snode server-node.mjsdirectly: works- Compiled binary's
Bun.spawn(['bun', 'run', SERVER_SCRIPT], { stdio: ['ignore', 'pipe', 'pipe'] }): process tree spawns but CLI hangs waiting on pipe
This appears to be a Bun runtime issue where Bun.spawn inside a bun build --compile binary doesn't properly connect stdio pipes on WSL's filesystem layer.
Root Cause 2: HTTP proxy intercepts localhost health check
WSL environments commonly have HTTP_PROXY set (e.g., for clash/v2ray). The CLI's health check:
curl -sf "http://127.0.0.1:$port/health"
gets routed through the proxy, which returns 502 for localhost. This causes the "wait for healthy" loop to never succeed even if the server is actually running.
Workaround
Replace the compiled binary with a bash wrapper that:
- Starts the server via
nohup bun run server.ts(avoids Bun.spawn pipe issue) - Polls the state file + health endpoint with
--noproxy '*' - Sends commands via HTTP API with
--noproxy '*'
#!/usr/bin/env bash
# Key fixes:
# 1. Use nohup + bun run instead of Bun.spawn
# 2. All curl calls use --noproxy '*'
Full wrapper: ~80 lines, available on request or as PR.
Suggested Fix
-
For Bun.spawn hang: The
build_or_wrapapproach in PR #412 partially addresses this. Additionally, the CLI'sstartServer()could detect WSL (uname -r | grep -i microsoft) and usechild_process.spawnwithnode server-node.mjsinstead ofBun.spawn(['bun', 'run', ...]). -
For proxy interception: Add
--noproxy '*'orno_proxy=127.0.0.1,localhostto all internal HTTP calls (health check, command dispatch). This affects WSL, corporate networks, and any environment with HTTP_PROXY set.
Related
- #407 —
bun build --compilefails on virtiofs (same class of issue) - #412 — PR adding wrapper fallback (partial fix for our scenario)
- #486 — Windows browse server fails (Node.js polyfill race condition)
@FeilixX WSL browsing still hangs on Bun.spawn pipes, and intercepted localhost traffic remains unresolved until the selected implementation lands.
The browse CLI now appends 127.0.0.1,localhost,::1 to your existing NO_PROXY before its first loopback call, so an HTTP_PROXY no longer intercepts the daemon health check. Fixed in v1.91.19.0 (#3025).
We could only test this on Linux, not on WSL, so I'm leaving the issue open until you can confirm. Could you upgrade (run /gstack-upgrade in Claude Code, or on Codex and other env-var hosts cd <source from ./setup --status> && git pull && ./setup --host <host>) and let us know whether it works for you? If you still see this, please add ./setup --status output here.
Thanks for the report. This should be fixed in v1.91.19.0 (#3025): the browse daemon is now spawned detached with log-file stdio (no pipes to hang on), and loopback is appended to NO_PROXY so a proxy no longer intercepts localhost. We couldn't verify it on WSL ourselves.
To confirm, upgrade with /gstack-upgrade (or git pull && ./setup) to v1.91.34.0 or later, retry, and reply here with the result and the output of ~/.claude/skills/gstack/bin/gstack-doctor. If we don't hear back in 14 days, we'll close this as fixed (reopening is always welcome).
Closing: nobody reported this again in the two weeks since the Oct 8 confirm-first note. The fix shipped in v1.91.19.0 (#3025): the browse daemon spawns detached with log-file stdio, so there are no pipes to hang on, and loopback is appended to NO_PROXY so a proxy no longer intercepts localhost. Thanks @FeilixX for the report. If it still happens on the current release (v1.91.186.0 or later), reply with your version and what you saw, and we'll reopen.