Problem
dispose() clears current workers, but spawnProcess() does not check this.disposed. If init() or spawnProcess() is in-flight while dispose() runs, a worker can be added to the pool after disposal and remain orphaned.
Evidence
src/runtime/optimized-node.ts: dispose() sets this.disposed = true and terminates current pool; spawnProcess() has no guard and always pushes to processPool.
Acceptance criteria
spawnProcess() should no-op or throw once disposed is true.
init() should short-circuit when disposed mid-flight.
- Add a test that starts
init(), calls dispose() quickly, and verifies no workers remain.
Problem
dispose()clears current workers, butspawnProcess()does not checkthis.disposed. Ifinit()orspawnProcess()is in-flight whiledispose()runs, a worker can be added to the pool after disposal and remain orphaned.Evidence
src/runtime/optimized-node.ts:dispose()setsthis.disposed = trueand terminates current pool;spawnProcess()has no guard and always pushes toprocessPool.Acceptance criteria
spawnProcess()should no-op or throw oncedisposedis true.init()should short-circuit when disposed mid-flight.init(), callsdispose()quickly, and verifies no workers remain.