mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-04 02:58:23 +09:00
## Summary Supervise generated preview processes so the CLI terminates the complete owned process tree when an MCP session disconnects, a command finishes, or the owner receives a termination signal. Record owned PIDs and report actionable locked-path recovery when cleanup still fails. Closes #6019 ## Technical choices - Start generated previews through a dedicated supervisor process connected to its CLI/MCP owner over IPC. - Disconnect the supervisor to stop a preview; the supervisor owns all descendant cleanup. - Use Execa `killDescendants` for cross-platform process-tree termination instead of maintaining separate Windows and POSIX kill implementations. - Force-stop the owned tree so a descendant that ignores SIGTERM cannot survive its launcher. - Record supervisor and preview PIDs beside the generated preview directory. - Include the supervisor in the CLI build output. ## Implementation checklist - [x] Add owned preview process-tree supervision. - [x] Dispose previews on MCP completion, failure, disconnect, and signals. - [x] Add scoped locked-path diagnostics and recovery instructions. - [x] Add lifecycle and command regression coverage. - [x] Run the CLI typecheck and broader test suite. - [x] Review authoritative `docs/` content; no user-facing documentation changes are needed. - [ ] Run the complete agent evaluation suite after explicit approval. ## Verification - Preview server and supervisor tests: 42 passed. - Full CLI test suite: passed. - CLI typecheck: passed. - CLI production build: passed. - Package-boundary check: passed. - Targeted lint and formatting: passed. - `git diff --check`: passed. - The supervisor-disconnect regression was verified to fail without the new behavior and pass with it restored. - Agent evaluations were not run because repository policy requires separate explicit approval.