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 child output before orphan recovery checks

JiangJiahao20c30cbb44da
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..2d6e639331 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 {
+ // CI #6768: the PID is published before the fake child's prompt output.
+ // Killing the runner in that window can make the child exit on EPIPE,
+ // invalidating the live-orphan premise. Wait until the real runner has
+ // persisted the last startup event, so no output races its pipe closing.
+ await waitFor(async () => {
+ const [run] = await listPiSubagentRuns(fixture.root);
+ return run?.state === 'running' && run.tasks[0]?.toolUses === 1 ? true : null;
+ }, undefined, 'the runner to receive the hanging child startup output');
fixture.child.kill('SIGTERM');
await waitForClose(fixture.child, fixture.stderr);
const receipt = JSON.parse(await readFile(path.join(fixture.runDir, 'result.json'), 'utf8'));