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.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
fuobe eval: the saved token goes only to the server it was saved for
Claude312ce634fa8a
diff --git a/bin/lib/commands.mjs b/bin/lib/commands.mjsindex 20bf8e2e..535d6bd0 100644--- a/bin/lib/commands.mjs+++ b/bin/lib/commands.mjs@@ -752,8 +752,10 @@ async function evalHarness(ctx) {const entry = new URL("../../scripts/eval/eval.mjs", import.meta.url);if (!fs.existsSync(entry)) throw new ApiError("fuobe eval runs from a Fuobe checkout: scripts/eval isn't next to this CLI (clone the repo and run it there).");const { main: harness } = await import(entry.href);- const env = { ...ctx.io.env, ...(ctx.target.url && !ctx.io.env.FUOBE_URL && { FUOBE_URL: ctx.target.url }), ...(ctx.target.token && !ctx.io.env.FUOBE_TOKEN && { FUOBE_TOKEN: ctx.target.token }) };- return harness(ctx.positionals, { stdout: ctx.io.stdout, stderr: ctx.io.stderr, env, fetch: ctx.io.fetch });+ // The harness finds its server the way this CLI does (--url / --token, FUOBE_URL / FUOBE_TOKEN, then the+ // saved config, from the same home), so the saved token still rides only to the server it was saved for.+ // Handing it over as FUOBE_TOKEN would send it to whatever server a later --url names.+ return harness(ctx.positionals, { stdout: ctx.io.stdout, stderr: ctx.io.stderr, env: ctx.io.env, home: ctx.io.home, fetch: ctx.io.fetch });}/** @type {Record<string, Command>} */diff --git a/scripts/eval/README.md b/scripts/eval/README.mdindex 7eed1bf4..accca683 100644--- a/scripts/eval/README.md+++ b/scripts/eval/README.md@@ -35,8 +35,9 @@ pnpm eval:review latest # rate the pairs blind, wipnpm eval:promote latest # does the recipe win?```-`fuobe eval <command>` runs the same commands from the `fuobe` CLI (from a Fuobe checkout) and uses-the CLI's saved server and token.+`fuobe eval <command>` runs the same commands from the `fuobe` CLI (from a Fuobe checkout). It finds+the server and token the way every `fuobe` command does, so the token `fuobe login` saved goes only to+the server it was saved for, even when `--url` names another one.### Which Fuobe it talks todiff --git a/scripts/eval/eval.mjs b/scripts/eval/eval.mjsindex b7b8c679..0e4936b3 100644--- a/scripts/eval/eval.mjs+++ b/scripts/eval/eval.mjs@@ -70,7 +70,7 @@ function usage() {/*** @param {string[]} argv the arguments after the command name's position (command first)- * @param {{ stdout?: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, env?: Record<string, string | undefined>, fetch?: typeof fetch, signal?: AbortSignal }} [io]+ * @param {{ stdout?: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, env?: Record<string, string | undefined>, home?: string, fetch?: typeof fetch, signal?: AbortSignal }} [io]* @returns {Promise<number>} the exit code*/export async function main(argv, io = {}) {@@ -178,7 +178,7 @@ async function run(args, ctx) {const engine = v.engine ?? before?.engine;if (!["demo", "open", "cloud"].includes(engine)) throw new Usage("Pick --engine demo, open or cloud");const variants = v.variants === "all" ? Object.keys(suite.variants ?? { default: {} }) : list(v.variants);- const { client, target } = connect({ url: v.url, token: v.token }, { env: ctx.env, fetch: ctx.io.fetch });+ const { client, target } = connect({ url: v.url, token: v.token }, { env: ctx.env, home: ctx.io.home, fetch: ctx.io.fetch });const ac = new AbortController();const signal = ctx.io.signal ?? ac.signal;const onInt = () => {diff --git a/tests/eval-harness.test.ts b/tests/eval-harness.test.tsindex b8071947..c6e38071 100644--- a/tests/eval-harness.test.ts+++ b/tests/eval-harness.test.ts@@ -459,6 +459,31 @@ describe("report, blind review, compare and promote", () => {expect(await main(["eval", "history", "--suite", "soul", "--json"], io)).toBe(0);});+ it("fuobe eval sends the saved token only to the server it was saved for, even when --url names another", async () => {+ const { main } = (await import("../bin/lib/cli.mjs")) as { main: (argv: string[], io: object) => Promise<number> };+ const config = path.join(dir, "saved-config.json");+ fs.writeFileSync(config, JSON.stringify({ url: "http://saved.local:3000", token: "SAVED-SECRET-TOKEN" }));+ const calls: string[] = [];+ const stub = async (input: string | URL | Request, init?: RequestInit) => {+ const u = new URL(String(input instanceof Request ? input.url : input));+ const auth = new Headers(init?.headers).get("authorization") ?? "none";+ calls.push(`${u.host} ${u.pathname} ${auth}`);+ const json = (data: unknown) => new Response(JSON.stringify(data), { status: 200, headers: { "content-type": "application/json" } });+ if (u.pathname === "/api/status") return json({ engineMode: "both", demoMode: "auto", providers: {} });+ if (u.pathname === "/api/models") return json({ items: ["oss-trim", "oss-palette-video", "oss-join-clips", "oss-extract-frame", "oss-z-image-turbo"].map((id) => ({ id })) });+ return json({ demo: true, providerId: "mock", costUsd: 0 });+ };+ const io = () => ({ stdout: sink().stream, stderr: sink().stream, env: { PATH: process.env.PATH, FUOBE_EVAL_RESULTS: results, FUOBE_CONFIG: config }, cwd: process.cwd(), home: dir, fetch: stub, columns: 100, stdinIsTTY: false, stderrIsTTY: false, now: Date.now, sleep: async () => {}, onInterrupt: () => () => {}, ask: async () => "", readStdin: async () => "" });+ expect(await main(["eval", "run", "--suite", "selftest", "--engine", "demo", "--dry-run", "--url", "http://other.example:4000"], io())).toBe(0);+ expect(calls.length).toBeGreaterThan(2);+ expect(calls.every((c) => c.startsWith("other.example:4000 ") && c.endsWith(" none")), calls.join("\n")).toBe(true);+ // Without --url the saved server gets its own token, as with every other fuobe command.+ calls.length = 0;+ expect(await main(["eval", "run", "--suite", "selftest", "--engine", "demo", "--dry-run"], io())).toBe(0);+ expect(calls.length).toBeGreaterThan(2);+ expect(calls.every((c) => c.startsWith("saved.local:3000 ") && c.endsWith(" Bearer SAVED-SECRET-TOKEN")), calls.join("\n")).toBe(true);+ });+it("history lists runs, newest first", async () => {const h = await cli(["history", "--json"]);const doc = JSON.parse(h.stdout);