diff --git a/packages/testkit/test/reviewer.test.ts b/packages/testkit/test/reviewer.test.ts index af43d9d7..b6f43ebc 100644 --- a/packages/testkit/test/reviewer.test.ts +++ b/packages/testkit/test/reviewer.test.ts @@ -231,7 +231,14 @@ describe("reviewer details", () => { // Queued by an MCP process that died: the watchdog's tick picks it up. const q = await core.queueReview(db, { projectId: t.proj.id, taskId: (await t.ref()).task.id, prNumber: 1, sha: head }); assert.equal(await runner.reviewTick(db), 1); - await t.p.waitLog("agent started with the findings", (e) => e.ev === "prompt" && String(e.prompt).includes("нет проверки доступа к /admin")); + // The tick runs the review in the background; under the full CI load the reviewer process + // and then the agent's start each take seconds — wait for each step on its own, with room. + const finished = await waitFor("queued review finished", async () => { + const r = await core.latestReview(db, (await t.ref()).task.id); + return r?.id === q.id && (r.state === "done" || r.state === "error") ? r : null; + }, 60_000); + assert.deepEqual([finished.state, finished.verdict, finished.error], ["done", "changes", null]); + await t.p.waitLog("agent started with the findings", (e) => e.ev === "prompt" && String(e.prompt).includes("нет проверки доступа к /admin"), 60_000); assert.equal((await core.latestReview(db, (await t.ref()).task.id))?.id, q.id); assert.equal((await t.ref()).task.status, "in_progress"); await stopAll(t);