feat: return completed handoffs to Agent Chat (#14408)

Return completed Agent Chat handoffs through a durable outbox and scope each generated update to its supplied tasks. Add recovery, browser delivery, result access, and calibrated quality coverage.

Validated with two consecutive ten-case Claude/Codex campaigns, all CI checks, and a 5/5 review.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip authored and GitHub committed 2026-09-29 10:25:52 -05:00
1 parent 3b4b270650
commit 83076d7e7c
59 files changed
+2696 -83

No files matched your search

@@ -390,6 +390,26 @@ const support = await getEmbeddedPostgresTestSupport();
await db.update(issues).set({ status: "in_progress" }).where(eq(issues.id, issueId));
}
});
it.each(["completed", "cancelled", "ordinary", "unfinished-child"])("admits only verified onboarding result reporting: %s", async kind => {
const [before] = await db.select().from(issues).where(eq(issues.id, issueId));
const childId = randomUUID();
await db.update(issues).set({ status: kind === "cancelled" ? "cancelled" : "done",
originKind: kind === "ordinary" ? "manual" : "onboarding_first_task" }).where(eq(issues.id, issueId));
await db.insert(issues).values({ id: childId, companyId, parentId: issueId, title: "Saved result",
status: kind === "unfinished-child" ? "in_progress" : "done", assigneeAgentId: agentId });
const report = () => buildExecutionContinuation({ db, companyId, issueId, agentId,
context: { wakeReason: "issue_children_completed", completedChildIssueId: childId },
summary: null, exposeLowTrustRaw: false });
try {
if (kind === "completed") await expect(report()).resolves.toMatchObject({ companyId, issueId });
else await expectStaleContinuation(report, "continuation_task_ownership_changed");
expect((await db.select().from(issues).where(eq(issues.id, issueId)))[0].status)
.toBe(kind === "cancelled" ? "cancelled" : "done");
} finally {
await db.delete(issues).where(eq(issues.id, childId));
await db.update(issues).set({ status: before.status, originKind: before.originKind }).where(eq(issues.id, issueId));
}
});
it("rejects another company and an invalidated task owner", async () => {
await expectStaleContinuation(
() =>