Resolves overlap between main #1025 (headed browser auto-shutdown fix) and
this wave's #994 (server persists across Bash calls) + our SIGTERM mode-gate
follow-up. Both touch the parent-PID watchdog and SIGTERM handlers.
Mechanical resolution only — test inversion follows in next commit.
CHANGELOG / VERSION:
- main shipped v0.18.1.0 with #1025 while this wave was open. Bumped this
branch to v0.18.2.0 with its own entry on top, per CLAUDE.md branch-scoped
CHANGELOG rules. Both entries preserved, contiguous version sequence.
- package.json synced to v0.18.2.0.
browse/src/server.ts (parent-PID watchdog):
- Combined main's outer env-var gate (BROWSE_HEADED=1 skips the watchdog
entirely) with our inner mode check (when watchdog runs and parent dies,
decision tree by mode: active picker > headed/tunnel > normal).
- Defense-in-depth: env var skips the setInterval cost, runtime mode check
catches anything the env var missed.
browse/src/server.ts (SIGTERM/SIGINT handlers):
- Combined main's lambda wrap (avoids signal name being passed as exitCode
→ NaN → exit 1) with our mode-aware SIGTERM handler. Active picker check
short-circuits regardless of mode.
- Wrapped SIGINT in a lambda too — main's #1025 fix applied to that handler,
but our wave didn't have it. Now SIGINT exits with code 0 reliably.
Note: browse/test/watchdog.test.ts test 3 (added by main) currently FAILS
because main's "watchdog kills on parent death" expectation contradicts
post-#994 "server stays alive on parent death." Inverted in the next commit.