mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-09 14:38:59 +02:00
Playwright's default handleSIGINT/handleSIGTERM/handleSIGHUP handlers close Chromium the moment the DAEMON process receives a signal — which fights the deliberate headless SIGTERM-ignore in server.ts (Claude Code's Bash sandbox fires SIGTERM when the parent shell exits between tool invocations; the daemon survives it by design, but Playwright's handler killed its browser out from under it). All three flags are now false at all three launch sites (headless launch, headed launchPersistentContext, handoff relaunch). ENG-OV4: the daemon had NO process-level SIGHUP handler (only SIGINT and the mode-aware SIGTERM handler), so flipping handleSIGHUP:false alone would remove the ONLY Chromium cleanup on hangup. server.ts now routes SIGHUP to activeShutdown — the same shutdown path SIGINT uses (closes Chromium, releases ports, removes the state file). Static tripwire (browse/test/launch-signal-flags.test.ts, house grep-style): every chromium.launch/launchPersistentContext site must carry the three flags (site count pinned at 3 so a NEW launch site trips it), server.ts must keep the SIGHUP→activeShutdown route, and the deliberate headless SIGTERM-ignore must still exist (the reason handleSIGTERM:false is safe — pinned in the test's header comment). Tests: launch-signal-flags 3 pass; browser-manager-unit 28 pass; bridge-chromium-e2e real-launch smoke 3 pass. Fixes #2220. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>