Skip to content

Browse: parent process watchdog kills server between CLI invocations #870

@billbox-ai

Description

@billbox-ai

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 watchdog

Impact

  • 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:

  1. Detach the server properly — daemonize it so it doesn't depend on a parent PID
  2. Disable watchdog in headed mode — if the user can see the browser, they can close it themselves
  3. Use a PID file / lock file instead of parent process tracking, with a $B disconnect command for explicit cleanup
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions