mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-30 09:05:15 +01:00
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:
1 parent
3b4b270650
commit
83076d7e7c
59 files changed
+2696
-83
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { reserveCompletionQuality } from "./completion-quality.js";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
aggregateCampaignBilling,
|
||||
@@ -28,6 +29,15 @@ function result(overrides: Partial<RunnerE2EResult> = {}): RunnerE2EResult {
|
||||
}
|
||||
|
||||
describe("runner E2E billing summaries", () => {
|
||||
it("counts completion judge reservations and preserves unknown spend after interruption", () => {
|
||||
const pending = { ...reserveCompletionQuality({ sourceId: "chat", marker: "x", worker: { id: "task", status: "done", completedAt: "2026-09-01" }, documents: [{ id: "doc", issueId: "task", body: "result" }], comments: [{ id: "reply", issueId: "chat", authorAgentId: "agent", createdAt: "2026-09-02", body: "ready" }], runs: [] }, 0.5), name: "completion", expectedPass: true };
|
||||
const unknown = summarizeExecutionBilling(result({ completionQuality: [pending] }));
|
||||
expect(unknown.judge?.reservedCostUsd).toBe(pending.reservedCostUsd);
|
||||
expect(unknown.observedAndEstimatedCostUsd).toBeNull();
|
||||
expect(unknown.complete).toBe(false);
|
||||
const known = summarizeExecutionBilling(result({ completionQuality: [{ ...pending, status: "completed", inputTokens: 100, outputTokens: 50, estimatedCostUsd: 0.001 }] }));
|
||||
expect(known.judge).toMatchObject({ inputTokens: 100, outputTokens: 50, estimatedCostUsd: 0.001 });
|
||||
});
|
||||
it("summarizes provider-reported token usage and cost", () => {
|
||||
const billing = summarizeExecutionBilling(
|
||||
result({
|
||||
|
||||
Reference in new issue
Block a user