test: settle delegated chat completion before plan assertions

Handle completion notifications in the deterministic agent instead of replaying the original plan command. Wait for the real completion turn and retain exact plan revision, output, project, and assignee assertions.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-10-30 22:10:55 -05:00
1 parent 5e0f8aab76
commit 804a64a842
2 files changed
+7

No files matched your search

+3
View File
@@ -459,12 +459,15 @@ test("plan approval hands the preserved revision to an assigned project task", a
{ timeout: 60_000 },
)
.toBe(1);
// Task completion is delivered back to the chat as another real turn.
await idle(request, f.chatPath, 3);
const task = (
await json(await request.get(`/api/companies/${f.company.id}/issues`))
)[0];
expect(task.parentId).toBeNull();
expect(task.projectId).toBeTruthy();
expect(task.assigneeAgentId).toBe(f.agent.id);
await expect(page.getByText(`Delegated work completed: ${task.identifier}`, { exact: true })).toBeVisible();
const plan = await json(
await request.get(`/api/issues/${task.id}/documents/plan`),
);
+4
View File
@@ -36,6 +36,10 @@ if (!task.conversationAgentId) {
});
process.exit(0);
}
if (ctx.wakeReason === "chat_task_completed") {
await comment(`Delegated work completed: ${ctx.chatCompletionUpdates.map((update) => update.identifier).join(", ")}`);
process.exit(0);
}
const comments = await api(`/issues/${task.id}/comments?order=asc`);
const current =
comments.find((c) => c.id === ctx.wakeCommentId) ??