fix(open-gstack-browser): disable parent watchdog on connect#963
Open
marksalmon wants to merge 1 commit intogarrytan:mainfrom
Open
fix(open-gstack-browser): disable parent watchdog on connect#963marksalmon wants to merge 1 commit intogarrytan:mainfrom
marksalmon wants to merge 1 commit intogarrytan:mainfrom
Conversation
When Claude Code spawns `$B connect` via a Bash tool call, the bash subprocess exits immediately after connect returns (connect itself doesn't block). The v0.15.15.0+ parent-process watchdog in browse/src/server.ts:740-751 then sees "parent gone" and kills the headed Chromium ~15 seconds later. Symptom: the Chromium window appears for a few seconds then vanishes, and subsequent `$B focus` calls fail with "requires headed mode". Fix: prefix the connect command with `BROWSE_PARENT_PID=0`, which the CLI already honors as "disable watchdog" (browse/src/cli.ts:847). This is the same escape hatch /pair-agent uses for its tunneled sessions. Also swap the verification step from `$B status` to `$B focus`: `status` is not read-only — if no server is running, it silently spawns a new one in default `launched` (headless) mode and reports `healthy`, which masks the exact failure this patch is trying to diagnose. `focus` fails loudly when the headed window is gone and never auto-spawns anything. The Step 3 "Something went wrong" troubleshooting flow is updated for the same reason: check `focus` first, not `status`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
open-gstack-browserskill currently fails its first-run experience inside Claude Code: the headed Chromium window appears for a few seconds then vanishes, and the user has no idea why. Root cause is the v0.15.15.0+ parent-process watchdog killing the browse server because the bash process that spawned$B connecthas already exited.Repro
/open-gstack-browseron a clean machine (no prior browse session)$B connectinside a Bash tool call$B focusreportsfocus requires headed mode. Run $B connect first.Hit this today upgrading from v0.15.15.0 → v0.16.2.0 in a real Claude Code session. Had to reverse-engineer the fix live with the user watching the browser keep disappearing. Not a great first-run.
Root cause
browse/src/server.ts:740-751implements the parent-process watchdog that exits the server when its recorded parent PID dies.browse/src/cli.ts:235records the CLI's own PID asBROWSE_PARENT_PIDwhen spawning the server.$B connectvia a Bash tool call, the bash subprocess is the CLI's parent. Bash exits immediately afterconnectreturns (which it does as soon as Chromium finishes launching), so the watchdog sees its parent gone and kills everything ~15s later.The escape hatch already exists:
browse/src/cli.ts:847-848explicitly honorsBROWSE_PARENT_PID=0from the parent environment as a "disable watchdog" signal./pair-agentuses this inbrowse/src/cli.ts:988.Fix
Two tiny updates to
open-gstack-browser/SKILL.md.tmpl:$B connectwithBROWSE_PARENT_PID=0and add a critical-warning paragraph explaining why, so future skill maintainers don't accidentally remove it.$B statusfor$B focusas the verification command.$B statusis not read-only — if no server is running, it silently spawns a new one in defaultlaunched(headless) mode and reportshealthy, which completely masks the failure this PR is trying to diagnose.$B focusfails loudly when the headed window is gone and never auto-spawns anything, so it's a strictly better diagnostic.Only the template (
SKILL.md.tmpl) is touched. The generatedSKILL.mdwill be regenerated from the template on next./setuprun.Test plan
/open-gstack-browserfrom a clean state. Headed Chromium stayed alive past the 15s window, survived a long session,$B focusand$B snapshot -iworked against the live page.BROWSE_PARENT_PID=0is the documented escape hatch inbrowse/src/cli.ts:847-848../setupregen pipeline produces a SKILL.md that matches the new template.🤖 Generated with Claude Code