process-lifecycle · git:20261004.4bb7222 · 2026-10-04 · sha256 1a710cc1619be130

process-lifecycle git:20261004.4bb7222A

Immutable. This exact content never changes and is served at /api/v1/blob/1a710cc1619be130.

---
description: Cross-platform process identity, adoption, and termination
globs:
  - "internal/platform/**/*.go"
  - "internal/bgtask/**/*.go"
  - "internal/tools/shell/**/*.go"
  - "internal/hooks/**/*.go"
alwaysApply: false
---
# Process lifecycle

- On Windows, process identity is PID plus creation time. Verify it while holding the handle through tree termination, and do not reap legacy rows without identity.
- Unix process-group liveness does not require the original leader.
- On Darwin, EPERM means an empty or zombie-only group only in the termination path, not in liveness checks.
- Every `exec.Cmd` goes through `platform.AdaptCommand` before `Start`.
- A foreground timeout adopts the same process into the existing pool; never restart it through a second scheduler.
- Background starts and adoptions cannot promise that daemon descendants close inherited pipes.
- Process-group changes require real macOS tests.