Skip to content

browse: Bun.spawn pipe hangs on WSL even with successful compile + HTTP proxy intercepts localhost #494

Closed

Description

@FeilixX

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.ts directly: works, state file written in <2s
  • node server-node.mjs directly: 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:

  1. Starts the server via nohup bun run server.ts (avoids Bun.spawn pipe issue)
  2. Polls the state file + health endpoint with --noproxy '*'
  3. 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

  1. For Bun.spawn hang: The build_or_wrap approach in PR fix: fall back to wrappers when bun compile fails #412 partially addresses this. Additionally, the CLI's startServer() could detect WSL (uname -r | grep -i microsoft) and use child_process.spawn with node server-node.mjs instead of Bun.spawn(['bun', 'run', ...]).

  2. For proxy interception: Add --noproxy '*' or no_proxy=127.0.0.1,localhost to all internal HTTP calls (health check, command dispatch). This affects WSL, corporate networks, and any environment with HTTP_PROXY set.

Related

Activity

  1. time-attack commented on Jul 15, 2026

    @time-attack
    Contributor

    @FeilixX WSL browsing still hangs on Bun.spawn pipes, and intercepted localhost traffic remains unresolved until the selected implementation lands.

  2. capy-ai commented on Oct 4, 2026

    @capy-ai
    Contributor

    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.

  3. capy-ai commented on Oct 8, 2026

    @capy-ai
    Contributor

    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).

  4. capy-ai commented on Oct 24, 2026

    @capy-ai
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions