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 events before orphan receipt check

ylliuuu6631eeb6502aa9
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..c44056a34d 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,13 @@ describe('Cindy durable PI Subagent runner', () => {
return Number.isSafeInteger(pid) && pid > 0 ? pid : null;
});
try {
+ // PID publication precedes prompt handling. Closing the runner sooner can
+ // make the child's initial stdout writes fail with EPIPE, so it exits
+ // before the inventory even though the injected kill attempts fail.
+ await waitFor(async () => {
+ const transcript = await readFile(path.join(fixture.runDir, 'transcript.jsonl'), 'utf8').catch(() => '');
+ return transcript.includes('"type":"tool_execution_start"') ? true : null;
+ }, undefined, 'the initial child events to reach the runner before signalling');
fixture.child.kill('SIGTERM');
await waitForClose(fixture.child, fixture.stderr);
const receipt = JSON.parse(await readFile(path.join(fixture.runDir, 'result.json'), 'utf8'));