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 follow-up command observation (#4185)

Dante847bd4cbfca0
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 09e78ff36c..a9a8ae46e4 100644
--- a/packages/maker-core/src/agents/pi/__tests__/cindySubagentRunner.test.ts
+++ b/packages/maker-core/src/agents/pi/__tests__/cindySubagentRunner.test.ts
@@ -1374,7 +1374,18 @@ describe('Cindy durable PI Subagent runner', () => {
childId: running.tasks[0]?.childId,
message: 'continue from the completed result',
})).resolves.toBe(1);
- const commands = (await readCommandsIfPresent(fixture.commandsFile)) ?? [];
+ const commands = await waitFor(
+ async () => {
+ const parsed = await readCommandsIfPresent(fixture.commandsFile);
+ return parsed?.some((command) => (
+ command.type === 'follow_up' && command.message === 'continue from the completed result'
+ ))
+ ? parsed
+ : null;
+ },
+ undefined,
+ 'the exact follow-up command to reach the child',
+ );
expect(commands).not.toContainEqual(expect.objectContaining({ type: 'steer', message: 'late correction' }));
expect(commands).toContainEqual(expect.objectContaining({
type: 'follow_up', message: 'continue from the completed result',