Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
test(B5/A11): child-readiness timeout asserts the confirmed reap
garrytan9325a3a688f3
diff --git a/src/core/minions/child-readiness.ts b/src/core/minions/child-readiness.tsindex 079842eeb7..929d77086a 100644--- a/src/core/minions/child-readiness.ts+++ b/src/core/minions/child-readiness.ts@@ -45,6 +45,18 @@ export function parseChildReadiness(raw: string): { version: string; versionSkewreturn { version: r.version, versionSkew: r.version !== VERSION };}+/**+ * Runs the selected child's readiness handshake under a deadline.+ *+ * Timeout contract: at `timeoutMs - min(250, timeoutMs / 10)` the selected+ * process is SIGKILLed. Beneath tini that means every process group tini+ * started (the selected grandchild), and tini then reaps the grandchild and+ * exits. The confirmed failure ("timed out; no jobs were admitted") settles+ * only from the wrapper's `close`, so the selected process has already exited+ * and been reaped (or is a zombie awaiting its new parent). If `close` does not+ * arrive by `timeoutMs`, the call settles with "cleanup unconfirmed" and makes+ * no claim about the process.+ */export async function checkChildReadiness(options: ChildReadinessOptions): Promise<{ version: string; versionSkew: boolean }> {const timeoutMs = options.timeoutMs ?? CHILD_READINESS_TIMEOUT_MS;if (!Number.isFinite(timeoutMs) || timeoutMs < 1 || timeoutMs > 120_000) throw new Error('Invalid child readiness deadline.');diff --git a/test/child-readiness.test.ts b/test/child-readiness.test.tsindex b9e27f29d3..70b6652dc4 100644--- a/test/child-readiness.test.ts+++ b/test/child-readiness.test.ts@@ -164,7 +164,7 @@ describe('selected child readiness protocol', () => {await fixture(`import {writeFileSync} from 'node:fs';writeFileSync(process.argv[1]+'.pid',String(process.pid));setInterval(()=>{},1000);`, async (invocation) => {- await expect(checkChildReadiness({ invocation, tiniPath, timeoutMs: 500 })).rejects.toThrow('timed out');+ await expect(checkChildReadiness({ invocation, tiniPath, timeoutMs: 2500 })).rejects.toThrow('timed out; no jobs were admitted');const pid = Number(readFileSync(invocation.argsPrefix[0] + '.pid', 'utf8'));try {process.kill(pid, 0);