diff --git a/lib/hosts/update-worker.test.mjs b/lib/hosts/update-worker.test.mjs index 66f77279f..004f459a3 100644 --- a/lib/hosts/update-worker.test.mjs +++ b/lib/hosts/update-worker.test.mjs @@ -1104,7 +1104,15 @@ test("a pending stop reconciles an exit during the asynchronous start-identity r }); test("a pending stop whose process identity changes retains recovery-required state and its claim", { skip: windows ? "delayed SIGTERM shutdown is POSIX behaviour" : false, timeout: 90_000 }, async () => { - const f = await fixture("unreconciled-stop", { shutdownDelay: 11_000 }); + // The daemon must still be alive when reconciliation reads its identity: the stop wait is 10 s, so an 11 s + // shutdown left a ~1 s margin, and a loaded runner (a slow identity read, a stalled worker) observed the + // daemon as already gone — reconcilePendingStop then returned success, the worker rolled back and a + // replacement started beside the uncertain original (health.json appeared, :1127 failed on Ubuntu and macOS). + // 60 s keeps the daemon alive through reconciliation with a wide margin; the test still ends at ~11 s + // because the identity mismatch fails reconciliation on its first read, and the after-hook SIGKILLs the + // lingering daemon. The neighbouring delayed-stop / stop-identity-exit-race tests keep 11 s on purpose: + // they need the daemon to exit for their own reconciliation path. + const f = await fixture("unreconciled-stop", { shutdownDelay: 60_000 }); const lock = join(stateRoot, "lock.json"); writeFileSync(lock, JSON.stringify({ id: "unreconciled-stop", pid: process.pid, at: Date.now() }), { mode: 0o600 }); const copy = updates.copyHostWorkerSources(fileURLToPath(new URL("./update-worker.ts", import.meta.url)), f.attempt);