Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
test(maker-core): stabilize concurrent PI resume coverage
davida31308973477
diff --git a/packages/maker-core/src/agents/pi/__tests__/cindySubagentRunner.test.ts b/packages/maker-core/src/agents/pi/__tests__/cindySubagentRunner.test.tsindex fdd55bc247..ae53e5bf95 100644--- a/packages/maker-core/src/agents/pi/__tests__/cindySubagentRunner.test.ts+++ b/packages/maker-core/src/agents/pi/__tests__/cindySubagentRunner.test.ts@@ -323,7 +323,15 @@ if (!process.env.PI_CODING_AGENT_DIR ||process.exit(13);}const subagentRunDir = process.env.CINDY_PI_SUBAGENT_RUN_DIR;-if (!subagentRunDir || path.dirname(subagentRunDir) !== ${JSON.stringify(root)} ||+// A resumed run may reach this same fixture root through a directory link when+// the host-side test models two Cindy instances. Compare filesystem identity,+// not the spelling of the path: a Windows junction keeps the alias in the env+// value even though it points at this exact directory.+let canonicalSubagentRoot = null;+try {+ canonicalSubagentRoot = subagentRunDir ? fs.realpathSync(path.dirname(subagentRunDir)) : null;+} catch (_) { /* rejected by the validation below */ }+if (!subagentRunDir || canonicalSubagentRoot !== fs.realpathSync(${JSON.stringify(root)}) ||!/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(path.basename(subagentRunDir))) {process.exit(12);}@@ -863,27 +871,35 @@ describe('Cindy durable PI Subagent runner', () => {outcome.status === 'rejected'&& !/already resuming this Subagent generation/i.test(String(outcome.reason?.message ?? ''))));- expect(unexpectedRejections, `resume outcomes: ${describeOutcomes()}`).toHaveLength(0);- expect(started, `resume outcomes: ${describeOutcomes()}`).toHaveLength(1);- expect(refusedTheResume, `resume outcomes: ${describeOutcomes()}`).toHaveLength(1);- // Whoever got through, there is never a second live generation over the- // same PI child session — that is what a lost claim has to prevent.- const runs = await listPiSubagentRuns(fixture.root);- const resumedRuns = runs.filter((run) => run.taskId === first.taskId && run.runId !== first.runId);- expect(resumedRuns).toHaveLength(started.length);+ const startedRunIds = started.map((outcome) => (+ (outcome as PromiseFulfilledResult<string>).value+ ));+ try {+ expect(unexpectedRejections, `resume outcomes: ${describeOutcomes()}`).toHaveLength(0);+ expect(started, `resume outcomes: ${describeOutcomes()}`).toHaveLength(1);+ expect(refusedTheResume, `resume outcomes: ${describeOutcomes()}`).toHaveLength(1);+ // Whoever got through, there is never a second live generation over the+ // same PI child session — that is what a lost claim has to prevent.+ const runs = await listPiSubagentRuns(fixture.root);+ const resumedRuns = runs.filter((run) => run.taskId === first.taskId && run.runId !== first.runId);+ expect(resumedRuns).toHaveLength(started.length);- if (started.length === 1) {- const resumedRunId = (started[0] as PromiseFulfilledResult<string>).value;- await controlPiSubagentRuns(fixture.root, resumedRunId, 'stop');- await waitFor(- async () => {- const settledRuns = await listPiSubagentRuns(fixture.root);- const resumed = settledRuns.find((run) => run.runId === resumedRunId);- return resumed && isPiSubagentTerminal(resumed.state) ? resumed : null;- },- undefined,- 'the hung resumed generation to stop',- );+ } finally {+ // Keep a failed assertion from leaking a detached fake runner. On+ // Windows its cwd pins the temporary directory and turns the useful+ // mutual-exclusion failure into a secondary EBUSY teardown failure.+ await Promise.all(startedRunIds.map(async (resumedRunId) => {+ await controlPiSubagentRuns(fixture.root, resumedRunId, 'stop');+ await waitFor(+ async () => {+ const settledRuns = await listPiSubagentRuns(fixture.root);+ const resumed = settledRuns.find((run) => run.runId === resumedRunId);+ return resumed && isPiSubagentTerminal(resumed.state) ? resumed : null;+ },+ undefined,+ 'the hung resumed generation to stop',+ );+ }));}});});