Fix supervisor and supervisorClient behavior to support usage in SEA binary
Merged
PI
9mo ago+700+700+012345678901234567890123456789-128-128-012345678901234567890123456789
why
what changed
test plan
Summary by cubic
Make the shutdown supervisor work inside the SEA server binary and improve cleanup reliability. Use a stdin lifeline and a CLI/SEA entrypoint so local Chrome and Browserbase sessions are cleaned up when the parent dies or Chrome exits.
-
Bug Fixes
- Supervisor uses stdin as the lifeline; no IPC or “ready” handshake; idempotent cleanup.
- Added Stagehand CLI and SEA entrypoint to run the supervisor via --supervisor and a single --supervisor-config JSON arg (includes parentPid).
- SupervisorClient re-execs the SEA binary in SEA or uses the CLI outside SEA; spawns with stdin as the lifeline.
- Safer kill flow: SIGTERM then SIGKILL (7s), treat only ESRCH as “gone,” and never re-kill once confirmed dead; PID polling triggers cleanup when Chrome exits.
- Browserbase cleanup requests session release on shutdown when used.
- Added SEA integration tests covering local Chrome cleanup, supervisor lifecycle, and Browserbase session release.
-
Migration
- Removed keepAlive from ShutdownSupervisorConfig; only start the supervisor when keepAlive=false.
- ShutdownSupervisorHandle no longer exposes ready; there is no handshake—start and continue.