* fix: parallel worker PID tracking, spawn-status race, exit persistence
Three bugs in parallel-orchestrator.ts that cause workers to appear
permanently stuck in "running" or silently lose state on exit:
1. Worker PID initialized to coordinator's process.pid instead of 0.
Session status files recorded wrong PID, breaking stale detection
(isPidAlive returns true for the coordinator, not the dead worker).
2. Session status written with "running" BEFORE spawn attempt. If spawn
fails, status file stays "running" indefinitely. Now spawns first,
then writes status with actual state (running or error).
3. Worker exit handler updates session status but didn't call
persistState(), so orchestrator.json got out of sync. Next
coordinator restart could adopt already-dead workers.
Closes#672 (partial — worker lifecycle hardening)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* test: adapt lifecycle tests for spawn-aware session status
Tests now handle both outcomes: when spawnWorker() succeeds (running
state) and when it fails in CI (error state, no GSD binary available).
The lifecycle logic under test — session status writes, stop, pause,
resume — works correctly in both cases.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>