-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Browse: parent process watchdog kills server between CLI invocations #870
Description
Problem
The browse server's parent process watchdog (server.ts ~lines 700-715) kills the server between CLI invocations, making multi-step workflows (especially authentication) impossible without chaining everything in a single && sequence.
Root cause
Each $B <command> spawns a separate CLI process. The server records the parent PID on startup. The watchdog checks every 15 seconds if the parent is alive. When the CLI process exits after completing a command, the watchdog detects the parent is gone and kills the server + Chromium.
Key detail: headed mode disables the idle timeout but NOT the parent process watchdog. So launching with $B connect (headed) doesn't fix the problem.
Reproduction
$B connect # Start headed browser
# wait 15+ seconds
$B goto https://example.com # Fails — server was killed by watchdogImpact
- Multi-step auth flows are impossible (login → navigate to protected page)
- Any workflow with natural pauses between commands breaks
- Cookie/session state is lost when server restarts
- The only workaround is chaining all commands with
&&and using in-browser JS polling instead of shell sleep
Suggested fix
A few options:
- Detach the server properly — daemonize it so it doesn't depend on a parent PID
- Disable watchdog in headed mode — if the user can see the browser, they can close it themselves
- Use a PID file / lock file instead of parent process tracking, with a
$B disconnectcommand for explicit cleanup - Adopt a client-server model — the server stays running, CLI commands are just HTTP clients that connect to it (this may already be the intent, but the watchdog undermines it)
Option 2 is the smallest change. Option 3 or 4 is the right long-term fix.
Environment
- macOS (Darwin 25.3.0)
- gstack installed at
~/.claude/skills/gstack/ - Browse binary at
~/.claude/skills/gstack/browse/dist/browse