singularity-forge/src
deseltrus 5bae521af0 fix: parallel worker PID tracking, spawn-status race, exit persistence (#932)
* 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>
2026-03-17 14:59:05 -06:00
..
resources fix: parallel worker PID tracking, spawn-status race, exit persistence (#932) 2026-03-17 14:59:05 -06:00
tests merge: resolve 12 conflicts with main — integrate continueHere feature into refactored closeoutUnit 2026-03-17 13:20:20 -06:00
app-paths.ts Initial commit 2026-03-10 22:28:37 -06:00
bundled-extension-paths.ts Fix packaging verification and path portability (#378) 2026-03-14 12:28:14 -06:00
cli.ts fix: don't overwrite user's model choice when API key is temporarily unavailable (#910) (#928) 2026-03-17 14:01:51 -06:00
headless.ts feat: headless orchestration skill + supervised mode (#905) 2026-03-17 11:08:15 -06:00
help-text.ts feat: headless orchestration skill + supervised mode (#905) 2026-03-17 11:08:15 -06:00
loader.ts fix: detect broken install and add Windows symlink fallback (#890) 2026-03-17 09:35:57 -06:00
logo.ts fix: abort squash-merge on conflict and stop auto-mode instead of looping (#merge-bug-fix) 2026-03-12 15:32:39 -06:00
mcp-server.ts feat: add VS Code extension scaffold and MCP server compiled module 2026-03-16 16:46:20 -05:00
models-resolver.ts refactor: remove unnecessary 'as any' casts, dead exports, and duplicate code (#786) 2026-03-16 21:47:04 -06:00
onboarding.ts fix: Phase 1 quick wins — bug fixes, security hardening, and performance 2026-03-16 13:18:02 -05:00
pi-migration.ts Merge pull request #151 from dbachelder/fix/pi-provider-reuse-and-extension-loading 2026-03-12 22:25:15 -06:00
remote-questions-config.ts feat: add Telegram as remote questions channel (#645) (#655) 2026-03-16 11:09:39 -06:00
resource-loader.ts refactor: remove unnecessary 'as any' casts, dead exports, and duplicate code (#786) 2026-03-16 21:47:04 -06:00
tool-bootstrap.ts fix: Phase 1 quick wins — bug fixes, security hardening, and performance 2026-03-16 13:18:02 -05:00
update-check.ts feat: interactive update prompt on startup (#770) (#775) 2026-03-16 21:09:33 -06:00
update-cmd.ts feat: add gsd update subcommand for self-update 2026-03-13 18:47:33 -03:00
wizard.ts fix: Phase 1 quick wins — bug fixes, security hardening, and performance 2026-03-16 13:18:02 -05:00