Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

test(pi): wait for prompt response before orphaning child

xuzini-xzne4124d4fe05a
diff --git a/packages/maker-core/src/agents/pi/__tests__/cindySubagentRunner.test.ts b/packages/maker-core/src/agents/pi/__tests__/cindySubagentRunner.test.ts
index 821665fe3e..79bd6950b0 100644
--- a/packages/maker-core/src/agents/pi/__tests__/cindySubagentRunner.test.ts
+++ b/packages/maker-core/src/agents/pi/__tests__/cindySubagentRunner.test.ts
@@ -642,6 +642,14 @@ describe('Cindy durable PI Subagent runner', () => {
return Number.isSafeInteger(pid) && pid > 0 ? pid : null;
});
try {
+ // A PID is published before the fake Pi reads its prompt. Wait until the
+ // runner has consumed its response/tool event before closing that pipe:
+ // otherwise a pending stdout write can kill the intended orphan with
+ // EPIPE, and the recovery scan correctly finds no live child (Linux CI).
+ await waitFor(async () => {
+ const [run] = await listPiSubagentRuns(fixture.root);
+ return (run?.tasks[0]?.toolUses ?? 0) > 0 ? true : null;
+ }, undefined, 'the runner to consume the hanging child prompt response');
fixture.child.kill('SIGTERM');
await waitForClose(fixture.child, fixture.stderr);
const receipt = JSON.parse(await readFile(path.join(fixture.runDir, 'result.json'), 'utf8'));