Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: wait for Windows detachedSpawn grandchild pid file

atomanticagent61b33e5c5793
diff --git a/server/lib/detachedSpawn.test.js b/server/lib/detachedSpawn.test.js
index 0f8028ba36..eb399bea82 100644
--- a/server/lib/detachedSpawn.test.js
+++ b/server/lib/detachedSpawn.test.js
@@ -584,7 +584,12 @@ describe('spawnDetached', () => {
const beats = async () => (await readFile(heartbeat, 'utf8').catch(() => '')).length;
// Two powershell hops plus a Start-Process, so this is slower than the
- // node-only fixtures above.
+ // node-only fixtures above. Heartbeat can land before Set-Content finishes
+ // writing grandchild-pid — wait for a parseable pid first (CI flake).
+ expect(await waitUntil(async () => {
+ const raw = await readFile(grandchildPidFile, 'utf8').catch(() => '');
+ return Number.parseInt(raw, 10) > 0;
+ }, { timeoutMs: 30000 })).toBe(true);
expect(await waitUntil(async () => (await beats()) > 0, { timeoutMs: 30000 })).toBe(true);
const grandchildPid = Number.parseInt(await readFile(grandchildPidFile, 'utf8'), 10);
expect(grandchildPid).toBeGreaterThan(0);