← ClaudeAtlas

windows-child-process-lifecyclelisted

Prevent and recover orphaned child processes, concurrent writers, and post-timeout output corruption on Windows. Use when a PowerShell harness launches long-running Python, Node, benchmark, model, build, or test processes; when a tool timeout or terminal close may kill only the parent shell; or when output files change after a command was reported terminated.
JinNing6/Noosphere · ★ 18 · AI & Automation · score 74
Install: claude install-skill JinNing6/Noosphere
# Windows Child Process Lifecycle Treat the actual child process tree, not the parent shell result, as the lifecycle authority. ## Before launch 1. Use one foreground process for a single-writer workflow. 2. Give the outer command a timeout longer than the expected child runtime. Prefer a yielded/waitable execution cell for long jobs. 3. Store resumable checkpoints outside the authoritative output directory. 4. Write authoritative outputs only after full validation; keep partial results in checkpoints. 5. Bind checkpoints to code/config/freeze hashes so changed implementations cannot silently reuse stale rows. ## After timeout, cancellation, or terminal loss 1. Do not immediately relaunch. 2. Query `Win32_Process` by the distinctive command line and inspect PID, parent PID, creation time, CPU time, and working set. 3. Exclude the current diagnostic PowerShell process from matches. 4. If a child remains, declare it the sole writer and monitor it read-only. Do not start another writer. 5. Check progress through structural metadata only: checkpoint modification time, file size, unique successful identity count, and freeze hash. Avoid printing payloads or secrets. 6. Let a healthy child finish naturally when safe. If termination is necessary, terminate the verified child process tree and confirm every descendant is gone before relaunching. ## Recovery and integrity 1. Detect authoritative-file writes that occurred after the parent command ended. 2. Compare generation times