Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Evaluation: a saved skill's suite is priced by its estimate's total on the cloud again, and one that can't run says why

Claude29399b1d4e96
diff --git a/scripts/eval/lib/run.mjs b/scripts/eval/lib/run.mjs
index 70bb8759..699243e2 100644
--- a/scripts/eval/lib/run.mjs
+++ b/scripts/eval/lib/run.mjs
@@ -460,7 +460,10 @@ async function price(client, job, inputs, ctx) {
const route = job.submit.estimate === false ? null : (job.submit.estimate ?? `${job.submit.route}/estimate`);
if (!route) return { studio: true, costUsd: null, demo: ctx.engine === "demo", modelId: job.model.id };
const e = await client.request("POST", route, { json: body });
- return { studio: true, costUsd: e.costUsd ?? e.totalUsd ?? null, demo: e.demo ?? ctx.engine === "demo", modelId: e.modelId ?? job.model.id, ...(e.modelName && { modelName: e.modelName }), ...(Array.isArray(e.providers) && { providers: e.providers }), notes: e.notes };
+ // A saved skill's estimate (RecipeEstimate, from pnpm eval:from-skill's cases): its total, or why it can't run.
+ if (Array.isArray(e.runs) && e.runnable === false) throw new Error([...(e.errors ?? []), ...e.runs.flatMap((r) => r.errors ?? [])][0] ?? "it can't run");
+ const skillTotal = Array.isArray(e.runs) ? e.total : undefined;
+ return { studio: true, costUsd: e.costUsd ?? e.totalUsd ?? skillTotal ?? null, demo: e.demo ?? ctx.engine === "demo", modelId: e.modelId ?? job.model.id, ...(e.modelName && { modelName: e.modelName }), ...(Array.isArray(e.providers) && { providers: e.providers }), notes: e.notes };
}
const p = await client.request("POST", "/api/generations", { json: { ...job.request, inputs }, query: { preview: 1 } });
return { ...p, ...(p.model?.id && { modelId: p.model.id, modelName: p.model.name }) };
diff --git a/tests/eval-harness.test.ts b/tests/eval-harness.test.ts
index d8094541..87652d87 100644
--- a/tests/eval-harness.test.ts
+++ b/tests/eval-harness.test.ts
@@ -1375,4 +1375,26 @@ describe("what a job measures", () => {
const older = { costUsd: 1, demo: false, modelId: "kling-motion-control" };
expect((await plan(studioStub(older, { fal: { configured: true } }))).jobs[0].skip).toBeUndefined();
});
+
+ it("prices a saved skill's case (pnpm eval:from-skill) by its estimate's total, and skips one that can't run", async () => {
+ const fromSkill = (await import("../scripts/eval/from-skill.mjs")) as { caseFromSkill: (view: object, server: string) => { suite: string } };
+ const view = { name: "promo", title: "Promo", recipe: { params: [{ id: "topic", type: "text", label: "Topic", example: "a desk lamp" }], steps: [{ kind: "generate", request: { modelId: "z-image-turbo-cloud" } }], checks: {} } };
+ const file = path.join(dir, "skill-promo.json");
+ fs.writeFileSync(file, JSON.stringify(fromSkill.caseFromSkill(view, "http://stub.local")));
+ const skillStub = (estimate: Record<string, unknown>) => ({
+ url: "http://stub.local",
+ async request(method: string, p: string) {
+ if (p === "/api/status") return { engineMode: "both", demoMode: "auto", cloudProvider: "auto", providers: { fal: { configured: true } } };
+ if (p === "/api/models") return { items: [{ id: "z-image-turbo-cloud" }] };
+ if (p === "/api/assist/skills/promo/estimate") return estimate;
+ throw new Error(`stub: no ${method} ${p}`);
+ },
+ });
+ const dry = (client: object) => runner.runEval({ suite: cases.loadSuite(file), engine: "cloud", dryRun: true, root: path.join(dir, "skill") }, { client }) as Promise<{ estimateUsd: number; jobs: { skip?: string }[] }>;
+ const priced = await dry(skillStub({ engine: "cloud", total: 0.12, demo: false, runnable: true, errors: [], jobs: [], runs: [{ line: 1, jobs: [], total: 0.12, errors: [] }] }));
+ expect(priced.jobs[0].skip).toBeUndefined();
+ expect(priced.estimateUsd).toBeCloseTo(0.12, 6);
+ const stopped = await dry(skillStub({ engine: "cloud", total: null, demo: false, runnable: false, errors: [], jobs: [], runs: [{ line: 1, jobs: [], total: null, errors: ["Step 1's model is switched off"] }] }));
+ expect(stopped.jobs[0].skip).toBe("the server refused it: Step 1's model is switched off");
+ });
});