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
Runs on our GPUs: plain failure words, engine detail kept for the owner
Adarsh81f88a388865
diff --git a/bin/lib/worker/run.mjs b/bin/lib/worker/run.mjsindex be638c63..daeb47a4 100644--- a/bin/lib/worker/run.mjs+++ b/bin/lib/worker/run.mjs@@ -228,6 +228,8 @@ async function work(saved, deps, owner) {}const index = deps.requirements ?? loadRequirements();const { ComputerRunner } = deps.ComputerRunner ? { ComputerRunner: deps.ComputerRunner } : await import("./dist/computer-runner.mjs");+ // What takes this PC's folders out of the words it sends the studio (the job runner does it for every job report).+ const redact = deps.redact ?? (await import("./dist/engine-error.mjs").then((m) => m.withoutLocalPaths).catch(() => undefined));const site = cfg.site.replace(/\/+$/, "");const f = folders(cfg.workDir);fs.mkdirSync(cfg.workDir, { recursive: true });@@ -589,7 +591,7 @@ async function work(saved, deps, owner) {// The text slot: its own claims for the studio's text jobs, beside the GPU's job and the CPU slot's.const textCfg = textSlotOf(cfg.textSlot);if (textCfg?.problem) log(`${textCfg.problem}: its text slot is off.`);- const text = textCfg && !textCfg.problem ? (deps.textSlot ?? new TextSlot(textCfg, { call, log, workDir: cfg.workDir, home: deps.home, now, sleep, env: deps.env, ...deps.text })) : null;+ const text = textCfg && !textCfg.problem ? (deps.textSlot ?? new TextSlot(textCfg, { call, log, workDir: cfg.workDir, home: deps.home, now, sleep, env: deps.env, redact, ...deps.text })) : null;const gpuTotalMb = text ? await (deps.readGpuTotal ?? (deps.readGpu ? async () => null : () => readGpuTotal(cfg.nvidiaSmi)))().catch(() => null) : null;let lastUsedMb = null;/** Where a new start of the text slot's server may run: the GPU while nothing else holds it and there is room, else the CPU. */diff --git a/bin/lib/worker/text.mjs b/bin/lib/worker/text.mjsindex 1ebd8ed9..9b21897e 100644--- a/bin/lib/worker/text.mjs+++ b/bin/lib/worker/text.mjs@@ -339,8 +339,10 @@ export class TextSlot {this.lastJobAt = this.now();// The person went: the studio ended the job, so there is nothing to send.if (e instanceof Stopped) return true;- answer = { error: String(e.message ?? e).slice(0, 200) };- this.log(`Text job ${job.id} has no answer: ${answer.error}`);+ const why = String(e.message ?? e);+ this.log(`Text job ${job.id} has no answer: ${why}`);+ // The studio hears why without this PC's folders (deps.redact: engine-error.ts withoutLocalPaths).+ answer = { error: (this.d.redact ? this.d.redact(why) : why).slice(0, 200) };}this.lastJobAt = this.now();const sent = await this.d.call(`/api/gpu/computer/text/${encodeURIComponent(job.id)}`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ lease: job.lease, ...answer }) });diff --git a/scripts/lib/worker-build.mjs b/scripts/lib/worker-build.mjsindex a1ddcf5e..6765b564 100644--- a/scripts/lib/worker-build.mjs+++ b/scripts/lib/worker-build.mjs@@ -27,7 +27,7 @@ import { unruledPathInputs } from "./catalog-checks.mjs";import { allowedNodeList, filePins, inputRules, missingRules, readCatalog } from "./worker-catalog.mjs";export const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..");-export const SOURCES = ["computer-runner", "comfy-guard", "comfy-ws", "fetch-within", "local-comfy", "relay", "lanes", "worker-hours", "finish-ticket", "camera-path", "path-splat", "scene3d"];+export const SOURCES = ["computer-runner", "engine-error", "comfy-guard", "comfy-ws", "fetch-within", "local-comfy", "relay", "lanes", "worker-hours", "finish-ticket", "camera-path", "path-splat", "scene3d"];/*** What the worker learns from the catalog: its node allowlist, its input rules and its file pins. Throws when an inputdiff --git a/src/components/run-details.tsx b/src/components/run-details.tsxindex eec149cb..97d5c4fa 100644--- a/src/components/run-details.tsx+++ b/src/components/run-details.tsx@@ -176,6 +176,11 @@ export function RunDetailsView() {</Fact>)}{g.error && g.error !== d.stored.error && <Fact label="Error (as the account read it)">{g.error}</Fact>}+ {d.stored.detail && (+ <Fact label="Technical detail">+ <span className="whitespace-pre-wrap">{d.stored.detail}</span>+ </Fact>+ )}{d.trouble && (<><Fact label="Cause">diff --git a/src/lib/computer-runner.ts b/src/lib/computer-runner.tsindex 289bcb3c..c2bac8f1 100644--- a/src/lib/computer-runner.ts+++ b/src/lib/computer-runner.ts@@ -8,6 +8,7 @@* a socket and a clock, and the tests drive it from Node against a stand-in ComfyUI.*/import { isGuard } from "./comfy-guard";+import { withoutLocalPaths } from "./engine-error";import { FINISH_RUN_MS, finishProblem, type FinishResult, type FinishStats } from "./finish-ticket";import { fetchWithin } from "./fetch-within";import { parseComfyBinary, parseComfyText } from "./comfy-ws";@@ -311,6 +312,27 @@ const retryAfter = (res: Response) => Math.min(30, Math.max(1, Number(res.headerconst hasPrefix = (prompt: unknown, prefix: string) =>!!prompt && typeof prompt === "object" && Object.values(prompt as Record<string, { inputs?: Record<string, unknown> }>).some((n) => n?.inputs?.filename_prefix === prefix);+/** Every string inside a value with its absolute paths as base names (engine-error.ts). */+function pathsOut<T>(v: T, depth = 0): T {+ if (typeof v === "string") return withoutLocalPaths(v) as T;+ if (!v || typeof v !== "object" || depth > 24) return v;+ if (Array.isArray(v)) return v.map((x) => pathsOut(x, depth + 1)) as T;+ return Object.fromEntries(Object.entries(v as Record<string, unknown>).map(([k, x]) => [k, pathsOut(x, depth + 1)])) as T;+}++/**+ * A worker's report as it leaves the worker: ComfyUI's words (each entry's status messages, a refusal's answer) never+ * name a folder of the worker's PC (its work folder, its ComfyUI, its models): each path goes as its file's name only.+ * Results (outputs) and progress go as they are.+ */+export function withoutWorkerPaths(e: ReportEvent): ReportEvent {+ const entry = (x: HistoryEntryLike): HistoryEntryLike => (x.status ? { ...x, status: pathsOut(x.status) } : x);+ if (e.event === "finished") return { ...e, entry: entry(e.entry) };+ if (e.event === "passes") return { ...e, entries: e.entries.map(entry) };+ if (e.event === "refused") return { ...e, body: pathsOut(e.body) };+ return e;+}+/** A history entry as the server needs it: status and outputs (not the whole graph again). */const slim = (e: HistoryEntryLike & { prompt?: unknown[] }): HistoryEntryLike => ({ prompt: e.prompt ? [e.prompt[0], e.prompt[1]] : undefined, status: e.status, outputs: e.outputs });@@ -517,6 +539,8 @@ export class ComputerRunner {/** A report about a job (its token in a header, so the studio checks it before it reads the report). */private async report(t: ClaimedTask, e: ReportEvent): Promise<{ wanted?: WantedFile[]; follow?: string; stop?: boolean; state?: RelayState }> {+ // A worker program never sends its own folders (a browser tab is the person's own computer: its words stay its own).+ if (this.deps.worker) e = withoutWorkerPaths(e);// A busy studio (429) is waited out, for a while; other failures are tried a few times.const until = this.now() + 2 * 60_000;for (let i = 0; ; ) {diff --git a/src/lib/engine-error.ts b/src/lib/engine-error.tsnew file mode 100644index 00000000..99c7c282--- /dev/null+++ b/src/lib/engine-error.ts@@ -0,0 +1,252 @@+/**+ * An engine's own error text (ComfyUI, a node's exception, ffmpeg's output, a provider's answer) made fit to keep and+ * to show. Two parts:+ *+ * - `cleanEngineText`: the technical detail with the machine taken out. Absolute paths become the file's base name (a+ * folder becomes "[folder]"), internal addresses become "[address]", run ids are left out, and tool banners (ffmpeg's+ * version, copyright, build and configuration lines, its stream listing), stack traces and long dumps are dropped.+ * What is left is one line, cut short. The owner reads it; a person running on their own GPU may read it too.+ * - `plainEngineFailure`: what a person sees when a run on our GPUs fails: one plain sentence for each kind of failure,+ * never the engine's own words.+ *+ * Pure, with no imports: the server and the worker program (scripts/lib/worker-build.mjs) share it. The worker takes its+ * own folders out of every report with `withoutLocalPaths` before it sends anything.+ */++/** Unix folders an absolute path starts with on a server, a container or a worker. */+const UNIX_ROOTS =+ "home|root|var|tmp|opt|usr|srv|mnt|media|etc|workspace|workspaces|app|apps|data|run|proc|Users|Volumes|private|nix|snap|content|kaggle|lib|lib64|bin|sbin|dev|sys|boot|storage|models|comfyui|ComfyUI|fuobe|scratch|cache|output|input";++/** A character a path's segment may hold (no space, no quote, no separator). */+const SEG = String.raw`[^\s\\/"'<>|:*?,;()\[\]{}]`;++/** A Windows path: a drive or a UNC share, its folders (a folder may hold a few spaces), and its last part. */+const WINDOWS_PATH = new RegExp(+ String.raw`(?<![\w])(?:[A-Za-z]:[\\/]|\\\\${SEG}+\\${SEG}+\\?)(?:${SEG}+(?: ${SEG}+){0,3}\\|${SEG}+/)*${SEG}*`,+ "g",+);+/** A file:// link. */+const FILE_URL = /\bfile:\/\/\/?[^\s"'<>]+/gi;+/** A Unix path under one of the usual roots, or under the home folder (~/…). */+const UNIX_PATH = new RegExp(String.raw`(?<![\w.~:/\\-])(?:/(?:${UNIX_ROOTS})|~)(?:/${SEG}*)+`, "g");++/** The last part of a path: a file's name, or "[folder]" for a folder. */+function baseOf(path: string): string {+ const parts = path.split(/[\\/]+/).filter(Boolean);+ const last = parts[parts.length - 1] ?? "";+ return /\.[A-Za-z0-9]{1,12}$/.test(last) && !/^[A-Za-z]:$/.test(last) ? last : "[folder]";+}++/** Each absolute path in a text as its base name (a sentence's last full stop stays where it was). */+export function withoutLocalPaths(text: string): string {+ const swap = (m: string) => {+ const tail = /[.]+$/.exec(m)?.[0] ?? "";+ const path = tail ? m.slice(0, -tail.length) : m;+ return path ? baseOf(path) + tail : m;+ };+ return text.replace(FILE_URL, swap).replace(WINDOWS_PATH, swap).replace(UNIX_PATH, swap);+}++/**+ * Paths inside the given folders (this server's own) as their base names, other paths as they are: a person's own GPU+ * keeps its own folders in its details line, never the server's.+ */+export function withoutFolders(text: string, folders: readonly string[]): string {+ let out = text;+ for (const f of folders) {+ const root = f.replace(/[\\/]+$/, "");+ // Never a drive or the whole disk ("/", "C:").+ if (root.replace(/^[A-Za-z]:/, "").split(/[\\/]/).filter(Boolean).length < 1) continue;+ const either = root+ .split(/[\\/]+/)+ .map((p) => p.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"))+ .join(String.raw`[\\/]+`);+ const re = new RegExp(String.raw`${either}(?:[\\/]+${SEG}+)*[\\/]*`, "gi");+ out = out.replace(re, (m) => baseOf(m.replace(/[.]+$/, "")) + (/[.]+$/.exec(m)?.[0] ?? ""));+ }+ return out;+}++/** A loopback or private address (with its port, and the rest of its link). */+const PRIVATE_HOST = String.raw`(?:localhost|127(?:\.\d{1,3}){3}|0\.0\.0\.0|10(?:\.\d{1,3}){3}|192\.168(?:\.\d{1,3}){2}|172\.(?:1[6-9]|2\d|3[01])(?:\.\d{1,3}){2}|\[::1?\]|host\.docker\.internal)`;+const INTERNAL_URL = new RegExp(String.raw`\b(?:https?|wss?):\/\/${PRIVATE_HOST}(?::\d{1,5})?[^\s"'<>]*`, "gi");+const INTERNAL_HOST = new RegExp(String.raw`(?<![\w.])${PRIVATE_HOST}(?::\d{1,5})?(?![\w.])`, "gi");+/** Any IPv4 address with a port. */+const IP_PORT = /(?<![\w.])\d{1,3}(?:\.\d{1,3}){3}:\d{1,5}(?![\w.])/g;++/** A run's ids: a UUID (ComfyUI's prompt id), and "prompt_id: …"/"node_id: …" pairs. */+const UUID = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi;+const ID_PAIR = /\b(?:prompt|node|client)[_ ]id['"]?\s*[:=]\s*['"]?[\w-]+['"]?,?/gi;++/** A line of ffmpeg's (or ffprobe's) banner. */+const BANNER_LINE =+ /^\s*(?:(?:ffmpeg|ffprobe|ffplay) version\b|Copyright \(c\)|built with\b|configuration:|lib(?:avutil|avcodec|avformat|avdevice|avfilter|swscale|swresample|postproc)\s+\d)/i;+/** Where a banner starts inside a line ("…from clip.mp4: ffmpeg version 7.1 …"). */+const BANNER_START = /\b(?:ffmpeg|ffprobe|ffplay) version \S+/i;+/** After a banner, the lines that say what went wrong (the stream listing and the rest are left out). */+const TOOL_PROBLEM = /error|invalid|does not contain|matches no streams|no such file|not found|failed|unsupported|could not|cannot|unable|unknown|corrupt|truncated|moov atom|no (?:audio|video)?\s*stream|permission denied|out of memory/i;+/** Where a tool's output on one line splits into its own lines: its listing's headings, and a sentence's end. */+const TOOL_PIECES = /(?=\b(?:Input|Output) #\d)|(?=\bStream #\d)|(?=\bStream map(?:ping)?\b)|(?=\bMetadata:)|(?=\bDuration:)|(?=\bSide data:)|(?<=[.!])\s+(?=[A-Z])/;+/** Banner pieces left on one line (a text whose line breaks were lost). */+const BANNER_BITS = [+ /\b(?:ffmpeg|ffprobe|ffplay) version \S+/gi,+ /Copyright \(c\) \d{4}(?:-\d{4})? the FFmpeg developers/gi,+ /\bbuilt with (?:gcc|clang|Apple clang|Microsoft|MSVC|mingw)[^:]*?(?=\s+configuration:|\s+lib(?:av|sw|post)\w*\s+\d|$)/gi,+ /\bconfiguration:(?:\s+--\S+)+/gi,+ /\blib(?:avutil|avcodec|avformat|avdevice|avfilter|swscale|swresample|postproc)\s+\d+\.\s*\d+\.\s*\d+\s*\/\s*\d+\.\s*\d+\.\s*\d+/gi,+];++/** A stack trace's lines: Python's and JavaScript's. */+const TRACE_HEAD = /^\s*Traceback \(most recent call last\):?\s*$/;+const TRACE_FRAME = /^\s*(?:File "[^"]*", line \d+|at (?:async )?[\w.$<>[\]]*\s*\(?(?:file:|node:|[\w./\\-]+:\d+)|at \S+:\d+:\d+)/;+const TRACE_MARK = /^\s*[\^~]+\s*$/;+/** Trace pieces left on one line. */+const TRACE_BITS = [/Traceback \(most recent call last\):?/g, /File "[^"]*", line \d+(?:, in [\w<>.]+)?/g, /\bat (?:async )?[\w.$<>]+ \([^)]*:\d+:\d+\)/g, /\bat (?:file|node):\S+:\d+:\d+/g];++/** How much of the technical detail is kept. */+export const ENGINE_DETAIL_MAX = 600;++/** The lines of an engine's text worth keeping: a tool's banner and listing, and stack traces, left out; paths as base names. */+function keptLines(text: string): string[] {+ // Line by line first: a banner starts a tool's own output, and only its problem lines are kept after it.+ const lines: string[] = [];+ let inTool = false;+ let afterFrame = false;+ for (let line of text.replace(/\r\n?/g, "\n").split("\n")) {+ const at = line.search(BANNER_START);+ if (at > 0) {+ const before = line.slice(0, at);+ if (before.trim()) lines.push(withoutLocalPaths(before));+ line = line.slice(at);+ }+ if (at >= 0) inTool = true;+ if (TRACE_HEAD.test(line) || TRACE_MARK.test(line)) continue;+ if (TRACE_FRAME.test(line)) {+ afterFrame = true;+ continue;+ }+ // The code line Python prints under each frame (indented).+ if (afterFrame && /^\s{2,}\S/.test(line)) {+ afterFrame = false;+ continue;+ }+ afterFrame = false;+ // Banner pieces (also on one line, when a text's line breaks were lost), then what is left of a banner line.+ for (const bit of [...BANNER_BITS, ...TRACE_BITS]) line = line.replace(bit, " ");+ if (!line.trim() || BANNER_LINE.test(line)) continue;+ if (inTool) {+ // Only the tool's problem lines: its listing (inputs, metadata, streams) goes, also when it is on one line.+ line = line+ .split(TOOL_PIECES)+ .filter((piece) => TOOL_PROBLEM.test(piece))+ .join(" ")+ // "[aac @ 0x55d…] Error …": the decoder's tag goes.+ .replace(/\[[\w-]+ @ 0x[0-9a-f]+\]\s*/gi, "");+ }+ line = withoutLocalPaths(line);+ if (line.trim()) lines.push(line);+ }+ return lines;+}++/** What a cut leaves behind: an empty pair of quotes, a space before a colon, a colon next to a colon, a dangling colon. */+const tidy = (line: string) =>+ line+ .replace(/[ \t]+/g, " ")+ .replace(/''|""|\(\s*\)|\[\s*\]/g, "")+ .replace(/ {2,}/g, " ")+ .replace(/ +([:,.])/g, "$1")+ .replace(/:(?: *:)+/g, ":")+ .replace(/[\s:,;-]+$/, "")+ .trim();++const cut = (text: string, max: number) => (text.length > max ? `${text.slice(0, Math.max(1, max - 1)).trimEnd()}…` : text);++/**+ * An engine's error text, fit to keep: paths as base names, internal addresses and run ids out, banners, stack traces+ * and stream listings dropped, one line, at most `max` characters.+ */+export function cleanEngineText(raw: unknown, max = ENGINE_DETAIL_MAX): string {+ const text = typeof raw === "string" ? raw : raw == null ? "" : String(raw);+ if (!text.trim()) return "";+ const one = keptLines(text)+ .join(" ")+ .replace(INTERNAL_URL, "[address]")+ .replace(INTERNAL_HOST, "[address]")+ .replace(IP_PORT, "[address]")+ .replace(ID_PAIR, " ")+ .replace(UUID, "")+ .replace(/\s+/g, " ");+ return cut(tidy(one), max);+}++/** Signs of a machine's own words in a text: a path, a tool's banner, a stack trace. */+const SUSPECT = [new RegExp(WINDOWS_PATH.source), new RegExp(UNIX_PATH.source), /\bfile:\/\//i, BANNER_START, /Traceback \(most recent call last\)|File "[^"]*", line \d+|\bat \S+:\d+:\d+/];++/** How long a run's stored error may be. */+export const STORED_ERROR_MAX = 2000;++/**+ * A run's error as it is stored (every failure goes through it, src/server/generations.ts): a text with a path, a tool's+ * banner or a stack trace is cleaned as cleanEngineText cleans it, keeping its lines; any other text stays as it is.+ * Both are cut to `max` characters.+ */+export function storedErrorText(raw: string, max = STORED_ERROR_MAX): string {+ if (!SUSPECT.some((re) => re.test(raw))) return cut(raw, max);+ return cut(keptLines(raw).map(tidy).filter(Boolean).join("\n"), max);+}++// ---------------------------------------------------------------------------+// What a person sees when a run on our GPUs fails++/** The kinds of failure a run on our GPUs is told apart by. */+export type EngineFailureKind = "no-sound" | "unreadable-input" | "out-of-memory" | "timeout" | "missing-on-gpu" | "gpu-stopped" | "unknown";++/**+ * What each kind says to the person who ran it (an account, a guest, or the owner on our GPUs): what happened and what+ * to do next, never a dead end. No place name (the install names its GPUs itself), no machinery (not even "GPU"), no+ * "Press Retry" (tests/hosted-words.test.ts, tests/pool-account-runs.test.ts); the tile's own Retry is beside it.+ */+export const ENGINE_WORDS: Record<EngineFailureKind, string> = {+ "no-sound": "This clip has no sound for this run to use. Try a clip with sound.",+ "unreadable-input": "A file in this run couldn't be read. Try another file, or run it again.",+ "out-of-memory": "This run needed more memory than was free. Try a smaller size or a shorter clip.",+ timeout: "This run took too long to finish. Try a shorter clip or a smaller size.",+ "missing-on-gpu": "This run couldn't start just now. Run it again in a few minutes.",+ "gpu-stopped": "This run stopped before it finished. Run it again.",+ unknown: "This run couldn't finish. Run it again, or try other settings.",+};++const KINDS: [EngineFailureKind, RegExp][] = [+ ["out-of-memory", /out of memory|OutOfMemoryError|allocation on device|CUDA error: out of memory|not enough memory|MemoryError/i],+ ["no-sound", /no audio stream|has no (?:audio|sound)|failed to extract audio|does not contain any (?:audio )?stream|stream map '[^']*:a[^']*' matches no streams|matches no streams|no sound to work with|without (?:audio|sound)/i],+ [+ "unreadable-input",+ /invalid data found|moov atom not found|cannot identify image file|could not (?:open|read|decode|load) (?:the )?(?:file|video|image|audio|clip|input)|failed to (?:open|read|decode|load) (?:the )?(?:file|video|image|audio|clip|input)|corrupt|truncated|unsupported (?:file|format|codec|image)|no frames exist|failed to slice video|failed to trim video|couldn't be read|unreadable|end of file|EOFError|decoding error|not a valid (?:image|video|audio)/i,+ ],+ ["missing-on-gpu", /missing_node_type|node pack|is not installed|not in list|value not in list|missing model|model file|couldn't find (?:the )?model|no such node|unknown node|needs one add-on|refused it|prompt outputs failed validation|couldn't start (?:it|this run)/i],+ ["timeout", /timed? ?out|took too long|deadline|didn't answer in time/i],+ ["gpu-stopped", /interrupted|restarted|lost this run|stopped answering|stopped before|stopped while|connection (?:reset|refused|closed)|ECONNRESET|ECONNREFUSED|socket hang up|isn't running|went away|no longer has|kept stopping/i],+];++/** Which kind of failure a run's error text is (its fix code first, when it has one). */+export function engineFailureKind(raw: unknown, fixCode?: string): EngineFailureKind {+ if (fixCode === "comfy_missing_node" || fixCode === "comfy_missing_model") return "missing-on-gpu";+ const text = typeof raw === "string" ? raw : raw == null ? "" : String(raw);+ for (const [kind, re] of KINDS) if (re.test(text)) return kind;+ return "unknown";+}++/**+ * A failed run on our GPUs: the plain sentence the person sees, its kind, and the technical detail for the owner only+ * (cleaned as cleanEngineText cleans it; none when there is nothing beyond the sentence).+ */+export function plainEngineFailure(raw: unknown, fixCode?: string): { kind: EngineFailureKind; words: string; detail?: string } {+ const kind = engineFailureKind(raw, fixCode);+ const words = ENGINE_WORDS[kind];+ const detail = cleanEngineText(raw);+ return { kind, words, ...(detail && detail !== words && { detail }) };+}++/** Is this one of the plain sentences above. */+export const isEngineWords = (text: string | null | undefined): boolean => !!text && (Object.values(ENGINE_WORDS) as string[]).includes(text);diff --git a/src/server/account-admin.ts b/src/server/account-admin.tsindex d08b30a3..3b063c77 100644--- a/src/server/account-admin.ts+++ b/src/server/account-admin.ts@@ -214,11 +214,15 @@ function asAccountRun(g: Generation, emails: Map<string, string>, showEmails: boreturn { ...g, outputs: withStates(g.outputs), account, ...poolDetail(g), ...declinedCardsIn(g.id) };}-/** A failed run on this install's GPUs: the stored reason, when it isn't the plain sentence the account reads. */+/**+ * A failed run on this install's GPUs: its technical detail (the engine's words, cleaned), else the stored reason when it+ * isn't the plain sentence the account reads.+ */function poolDetail(g: Generation): { detail?: string } {if (g.place !== "pool" || !g.error) return {};- const e = (db().prepare("SELECT error FROM generations WHERE id = ?").get(g.id) as { error: string | null } | undefined)?.error;- return e && e !== g.error ? { detail: e } : {};+ const row = db().prepare("SELECT error, detail FROM generations WHERE id = ?").get(g.id) as { error: string | null; detail: string | null } | undefined;+ if (row?.detail) return { detail: row.detail };+ return row?.error && row.error !== g.error ? { detail: row.error } : {};}/** One account's run as the list gives it (null: no such run, or it is the owner's own). */diff --git a/src/server/db.ts b/src/server/db.tsindex d71ad8dd..2c10d3bd 100644--- a/src/server/db.ts+++ b/src/server/db.ts@@ -1014,6 +1014,8 @@ const HOOK_COLUMNS: [string, string, string][] = [["run_requests", "tries", "INTEGER NOT NULL DEFAULT 0"],["run_requests", "starting", "INTEGER NOT NULL DEFAULT 0"],["run_requests", "answer_json", "TEXT"],+ // A failed run's technical detail, for the owner only, when the person read a plain sentence (generations.ts Row.detail).+ ["generations", "detail", "TEXT"],];/**diff --git a/src/server/generations.ts b/src/server/generations.tsindex c8a661ce..0079e39a 100644--- a/src/server/generations.ts+++ b/src/server/generations.ts@@ -2,6 +2,7 @@ import "server-only";import { AsyncLocalStorage } from "node:async_hooks";import crypto from "node:crypto";import fs from "node:fs";+import os from "node:os";import path from "node:path";import { nanoid } from "nanoid";import { getModel, getPreset } from "@/lib/catalog";@@ -59,7 +60,7 @@ import {type Preset,type ProviderId,} from "@/lib/catalog/types";-import { db } from "./db";+import { DATA_DIR, db } from "./db";import { keepVoiceEmbedding, savedVoiceFor } from "./voices";import { listElements } from "./elements";import { markStale } from "./gpu/snapshots";@@ -109,7 +110,8 @@ import {type TroubleCause,} from "@/lib/diagnose";import { draining } from "./shutdown";-import { keptText, networkCode, recordOwnRun, type HostKind } from "./run-events";+import { keptText, networkCode, recordOwnRun, recordRunEvent, type HostKind } from "./run-events";+import { cleanEngineText, isEngineWords, storedErrorText, withoutFolders } from "@/lib/engine-error";import { CONNECT_GPU_MESSAGE, GUEST_RUN_MESSAGE, OWN_GPU_TOOL_MESSAGE } from "@/lib/guest-access";import { MODEL3D_SETUP, ownSetupLabel } from "@/lib/own-setup";import { outsideTenant, runAsTenant, tenant, tenantAccount } from "./tenant";@@ -194,6 +196,11 @@ interface Row {fix_json?: string | null;/** NULL, or "checking": its outputs wait for the moderation service (output-checks.ts). */stage?: string | null;+ /**+ * A failed run's technical detail, for the owner only (the engine's own words, cleaned: src/lib/engine-error.ts), when+ * the person read a plain sentence in `error` instead. Never part of a Generation.+ */+ detail?: string | null;}/** Trash and folder columns, joined onto every library read. */@@ -361,7 +368,7 @@ function poolMessage(r: Pick<Row, "status" | "message">, ready = false): string*/function poolError(id: string, error: string | null, charged: boolean): string | null {if (!error) return error;- if (PLAIN_POOL_ERRORS().has(error) || /^Your files have reached \d+ GB\b/.test(error)) return error;+ if (PLAIN_POOL_ERRORS().has(error) || isEngineWords(error) || /^Your files have reached \d+ GB\b/.test(error)) return error;const checked = db().prepare("SELECT 1 FROM output_checks WHERE generation_id = ? AND state IN ('hidden', 'unchecked') LIMIT 1").get(id);if (!checked) return POOL_WORDS.failed;return charged ? error : error.replace(/\s*Not charged\.$/, "");@@ -629,7 +636,21 @@ function turnTaken(id: string): boolean {/** A row still waiting for its hand-over (queued or running, no job yet): only then is it changed. */const PENDING = "status IN ('queued', 'running') AND external_id IS NULL";-function update(id: string, fields: Partial<Row>): void {+/**+ * Fields as they are written: a run's error never keeps a machine's path, a tool's banner or a stack trace, and its+ * owner-only detail is cleaned the same way (src/lib/engine-error.ts).+ */+function storedFields(fields: Partial<Row>): Partial<Row> {+ if (typeof fields.error !== "string" && typeof fields.detail !== "string") return fields;+ return {+ ...fields,+ ...(typeof fields.error === "string" && { error: storedErrorText(fields.error) }),+ ...(typeof fields.detail === "string" && { detail: cleanEngineText(fields.detail) || null }),+ };+}++function update(id: string, given: Partial<Row>): void {+ const fields = storedFields(given);const keys = Object.keys(fields);if (!keys.length) return;db()@@ -2838,9 +2859,17 @@ function ownFailed(id: string, account: string | undefined, f: RunFacts, cause:}}-/** generations.fix_json: what the GPU was missing (GenerationFix) and, for an account, what its GPU or key ran into. */+/** This server's own folders: never named in a run's details line (src/lib/engine-error.ts withoutFolders). */+const serverFolders = () => [DATA_DIR, process.cwd(), os.tmpdir(), os.homedir()];++/**+ * generations.fix_json: what the GPU was missing (GenerationFix) and, for an account, what its GPU or key ran into. Its+ * details line keeps the person's own GPU's words, without this server's folders.+ */const keptFix = (fix: GenerationFix | undefined, trouble: Diagnosis | undefined): string | undefined =>- fix || trouble ? JSON.stringify({ ...(fix ?? {}), ...(trouble && { trouble: troubleOf(trouble) }) }) : undefined;+ fix || trouble+ ? JSON.stringify({ ...(fix ?? {}), ...(trouble && { trouble: troubleOf(trouble.details ? { ...trouble, details: withoutFolders(trouble.details, serverFolders()) } : trouble) }) })+ : undefined;/** Where an account's GPU is, as the log says it: a RunPod pod, a tunnel, a web address, or the person's own computer. */function hostKindOf(gpu: AccountGpu | null | undefined): HostKind | undefined {@@ -4388,7 +4417,9 @@ async function pollOne(r: Row): Promise<void> {return;}const kept = keptFix(res.fix, undefined);- updateLive(r.id, { status: "failed", error: res.error, completed_at: Date.now(), message: null, ...(kept && { fix_json: kept }) });+ // On this install's GPUs the person reads a plain sentence; the engine's own words are the owner's (the column and the log).+ const saved = updateLive(r.id, { status: "failed", error: res.error, completed_at: Date.now(), message: null, ...(kept && { fix_json: kept }), ...(res.detail && { detail: res.detail }) });+ if (saved && res.detail) recordRunEvent("gpu-run-failed", { run: r.id, ...(account && { account }), provider: r.provider, model: r.model_id, op: r.op ?? undefined, words: res.error, detail: cleanEngineText(res.detail) }, "warn");// (A run on this install's GPUs says nothing about the account's own GPU.)if (res.fix && !onPool) markStale(account ? `acct:${account}` : "install");return;@@ -4594,7 +4625,8 @@ async function pollOne(r: Row): Promise<void> {* person canceled) meanwhile back to an earlier state, and never fails a run another process is saving. `extra`: more of* the WHERE clause (it may read @__me, @__quiet and @__now, and its own `params`). Returns whether the change was made.*/-export function updateLive(id: string, fields: Partial<Row>, extra = "", params: Record<string, unknown> = {}): boolean {+export function updateLive(id: string, given: Partial<Row>, extra = "", params: Record<string, unknown> = {}): boolean {+ const fields = storedFields(given);const keys = Object.keys(fields);if (!keys.length) return false;const now = Date.now();diff --git a/src/server/providers/comfyui.ts b/src/server/providers/comfyui.tsindex f6a91010..349a3885 100644--- a/src/server/providers/comfyui.ts+++ b/src/server/providers/comfyui.ts@@ -54,7 +54,9 @@ import { hfPage } from "@/lib/gpu/plan";import { fileTitle } from "@/lib/gpu/readiness";import { formatBytes } from "@/lib/gpu/requirements";import type { FileKey } from "@/lib/gpu/types";+import { isEngineWords, plainEngineFailure } from "@/lib/engine-error";import {+ FILE_TROUBLE_WORDS,makingWords,META_BATCH_HISTORY,POOL_WORDS,@@ -1839,6 +1841,7 @@ async function pollComputer(principal: Principal, meta: Record<string, unknown>,// line after an attempt (a worker paused, went quiet, gave it back), it shows its kept place as any waiting run does,// and once a worker has it again, the usual words: never a restart.const res: PollResult = t.state === "waiting" ? { state: "queued", message: poolWaitWords(t) } : await pollTask(principal, t, meta, manifest, made);+ if (res.state === "failed") return poolFailure(res);if (res.state !== "queued" && res.state !== "running") return res;const deadline = attemptDeadline(t);const clocks = { ownClocks: true as const, ...(deadline && { deadline }) };@@ -1847,6 +1850,32 @@ async function pollComputer(principal: Principal, meta: Record<string, unknown>,return t.state === "waiting" ? { state: "queued", message: POOL_WORDS.inLine, ...clocks } : { state: "running", progress: res.progress, message: POOL_WORDS.working, ...clocks };}+/**+ * Words a failed run on the workers keeps as they are: about the person's own files, their own stop or their files'+ * room, or already one of the plain sentences (src/lib/engine-error.ts).+ */+function poolKeeps(error: string): boolean {+ return (+ error === RELAY_WORDS.stopped ||+ (Object.values(FILE_TROUBLE_WORDS) as string[]).includes(error) ||+ (Object.values(ACCOUNT_MESSAGES) as string[]).includes(error) ||+ /^Your files have reached \d+ GB\b/.test(error) ||+ isEngineWords(error)+ );+}++/**+ * A failed run on this install's GPUs (an account's, a guest's, or the owner's own on the workers): the person reads one+ * plain sentence for its kind of failure, never the engine's words (a node's name, a worker's folder, ffmpeg's output).+ * The engine's words, cleaned, go in `detail`: the owner's only (generations.detail, the log). What the GPU was missing+ * stays as the owner's "Fix it".+ */+export function poolFailure(res: Extract<PollResult, { state: "failed" }>): PollResult {+ if (poolKeeps(res.error)) return { state: "failed", error: res.error, ...(res.fix && { fix: res.fix }), ...(res.lost && { lost: true as const }) };+ const plain = plainEngineFailure(res.error, res.fix?.code);+ return { state: "failed", error: plain.words, ...(plain.detail && { detail: plain.detail }), ...(res.fix && { fix: res.fix }), ...(res.lost && { lost: true as const }) };+}+/** Where a task is (on someone's computer, or with a worker), in the words its tile shows. */async function pollTask(principal: Principal, t: TaskRow, meta: Record<string, unknown>, manifest: ManifestWorkflow | undefined, made: string | undefined): Promise<PollResult> {const p = taskProgress(t);diff --git a/src/server/providers/types.ts b/src/server/providers/types.tsindex dbb8c2ff..2efc79bf 100644--- a/src/server/providers/types.ts+++ b/src/server/providers/types.ts@@ -56,7 +56,7 @@ export type PollResult =* `trouble`: an account's own GPU, why in plain words with what helps (src/lib/diagnose.ts). `lost`: its ComfyUI* restarted and forgot the job, so the runner may send it once more.*/- | { state: "failed"; error: string; fix?: GenerationFix; trouble?: Diagnosis; lost?: true };+ | { state: "failed"; error: string; fix?: GenerationFix; trouble?: Diagnosis; lost?: true; detail?: string };export interface PollContext {externalId: string;diff --git a/src/server/run-details.ts b/src/server/run-details.tsindex c0b0f9b1..abc2a2e3 100644--- a/src/server/run-details.ts+++ b/src/server/run-details.ts@@ -102,8 +102,11 @@ export interface NearRun {export interface RunDetails {/** The run as the account's own feed has it (its words, trouble, buttons), with whose it is and each result's state. */run: AccountRun;- /** The stored status words and error (the account may have read a plainer sentence: a hosted run's), without addresses or credentials. */- stored: { message: string | null; error: string | null };+ /**+ * The stored status words and error (the account may have read a plainer sentence: a hosted run's), without addresses+ * or credentials. `detail`: the engine's own words (cleaned) behind a plain sentence, for the owner only.+ */+ stored: { message: string | null; error: string | null; detail?: string };/** What a failed run's GPU was missing, and what its GPU or key ran into (stored even where the account wasn't shown it). */fix: { code?: string; workflowId?: string; items?: { folder?: string; file?: string; class?: string; pack?: string }[] } | null;trouble: RunTrouble | null;@@ -252,6 +255,8 @@ interface RawRow {external_meta_json: string | null;provider_input_json: string | null;fix_json: string | null;+ /** The owner-only technical detail of a failed run whose person read a plain sentence. */+ detail: string | null;}const parse = (json: string | null | undefined): unknown => {@@ -704,7 +709,7 @@ export function runDetails(id: string, o: { emails?: boolean } = {}): RunDetailsconst run = accountRunById(id, o.emails ?? true);if (!run) return null;const account = run.account.id;- const raw = db().prepare("SELECT request_json, message, error, external_id, external_meta_json, provider_input_json, fix_json FROM generations WHERE id = ?").get(id) as RawRow | undefined;+ const raw = db().prepare("SELECT request_json, message, error, external_id, external_meta_json, provider_input_json, fix_json, detail FROM generations WHERE id = ?").get(id) as RawRow | undefined;if (!raw) return null;const gpu = gpuNow(account);const scrub = (t: string | null) => (t ? redactText(t, { url: gpu.url }) : t);@@ -747,7 +752,7 @@ export function runDetails(id: string, o: { emails?: boolean } = {}): RunDetails...(run.trouble && { trouble: safeTrouble(run.trouble, gpu.url) }),...(run.waiting && { waiting: safeTrouble(run.waiting, gpu.url) }),},- stored: { message: scrub(raw.message), error: scrub(raw.error) },+ stored: { message: scrub(raw.message), error: scrub(raw.error), ...(raw.detail && { detail: scrub(raw.detail) ?? undefined }) },fix: Object.keys(fixRest).length ? (redactValue(fixRest, { url: gpu.url }) as RunDetails["fix"]) : null,trouble,where: whereOf(run, raw, gpu),diff --git a/tests/engine-error.test.ts b/tests/engine-error.test.tsnew file mode 100644index 00000000..f5fdcdb6--- /dev/null+++ b/tests/engine-error.test.ts@@ -0,0 +1,169 @@+import { describe, expect, it } from "vitest";+import { cleanEngineText, ENGINE_WORDS, engineFailureKind, isEngineWords, plainEngineFailure, storedErrorText, withoutFolders, withoutLocalPaths } from "@/lib/engine-error";+import { withoutWorkerPaths } from "@/lib/computer-runner";+import type { ReportEvent } from "@/lib/relay";++/*+ * An engine's own error text (ComfyUI, a node's exception, ffmpeg's output) is cleaned before it is kept, and a run on+ * our GPUs shows the person a plain sentence for its kind of failure: never a path, a node's name, a tool's banner or a+ * stack trace (src/lib/engine-error.ts). The worker takes its own folders out before it reports (computer-runner.ts).+ */++/** What a worker's VHS_LoadVideo said for a clip with no sound (the ffmpeg banner as ffmpeg prints it). */+const VHS_NO_AUDIO = [+ "VHS failed to extract audio from X:\\fuobe-worker\\work\\input\\fuobe_HFpqXpUDFs__.mp4:",+ "ffmpeg version 7.1-full_build-www.gyan.dev Copyright (c) 2000-2026 the FFmpeg developers",+ " built with gcc 14.2.0 (Rev1, Built by MSYS2 project)",+ " configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --enable-libx264 --enable-cuda-llvm",+ " libavutil 59. 39.100 / 59. 39.100",+ " libavcodec 61. 19.100 / 61. 19.100",+ "Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'X:\\fuobe-worker\\work\\input\\fuobe_HFpqXpUDFs__.mp4':",+ " Metadata:",+ " major_brand : isom",+ " Duration: 00:00:05.00, start: 0.000000, bitrate: 2400 kb/s",+ " Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1080x1920, 30 fps",+ "Stream map '0:a:0' matches no streams.",+ "To ignore this, add a trailing '?' to the map.",+ "Failed to set value '0:a:0' for option 'map': Invalid argument",+ "Error parsing options for output file /tmp/out.wav.",+].join("\n");++/** The same text with its line breaks lost (as the owner's page showed it). */+const VHS_ONE_LINE = `VHS_LoadVideo: ${VHS_NO_AUDIO.replace(/\s*\n\s*/g, " ")}`;++const LEAKS = [/[A-Za-z]:\\/, /fuobe-worker/, /\\work\\input/, /ffmpeg version/i, /Copyright/i, /configuration:/i, /--enable/, /libavutil/i, /built with/i, /\/tmp\//];++describe("cleanEngineText", () => {+ it("keeps what went wrong, without the worker's folders or ffmpeg's banner", () => {+ for (const raw of [`VHS_LoadVideo: ${VHS_NO_AUDIO}`, VHS_ONE_LINE]) {+ const out = cleanEngineText(raw);+ for (const leak of LEAKS) expect(out, `${leak}`).not.toMatch(leak);+ expect(out).toContain("VHS failed to extract audio from fuobe_HFpqXpUDFs__.mp4");+ expect(out.length).toBeLessThanOrEqual(600);+ expect(out).not.toContain("\n");+ }+ // The multi-line text keeps ffmpeg's own problem lines, not its stream listing.+ const lines = cleanEngineText(`VHS_LoadVideo: ${VHS_NO_AUDIO}`);+ expect(lines).toContain("matches no streams");+ expect(lines).not.toMatch(/Metadata|major_brand|Duration|Stream #0/);+ });++ it("takes out paths of every kind as the file's name", () => {+ expect(withoutLocalPaths("from C:\\Program Files\\ComfyUI\\models\\checkpoints\\flux1-dev.safetensors: bad")).toBe("from flux1-dev.safetensors: bad");+ expect(withoutLocalPaths("at \\\\nas01\\share\\clips\\a b.mov failed")).toContain("[folder]");+ expect(withoutLocalPaths("open /home/fuobe/app/data/uploads/abc.png")).toBe("open abc.png");+ expect(withoutLocalPaths("in /workspace/ComfyUI/models/loras/")).toBe("in [folder]");+ expect(withoutLocalPaths("read file:///D:/work/x.wav now")).toBe("read x.wav now");+ expect(withoutLocalPaths("cache ~/.cache/huggingface/hub/model.bin.")).toBe("cache model.bin.");+ expect(withoutLocalPaths("D:/fuobe-work/input/clip.mp4")).toBe("clip.mp4");+ });++ it("leaves links, relative folders and plain words alone", () => {+ const plain = [+ "Get it from https://huggingface.co/Comfy-Org/flux1-dev/resolve/main/flux1-dev.safetensors then put it in ComfyUI/models/checkpoints",+ "Plan A: try a 16/9 picture and/or a shorter clip.",+ "Start ComfyUI with a higher --max-upload-size, or use a smaller file.",+ "Set the LoRA folder in Settings → LoRAs and Fuobe downloads LoRAs before a run",+ ];+ for (const t of plain) {+ expect(withoutLocalPaths(t)).toBe(t);+ expect(storedErrorText(t)).toBe(t);+ }+ });++ it("drops stack traces, internal addresses and run ids", () => {+ const raw = [+ "Traceback (most recent call last):",+ ' File "/opt/ComfyUI/execution.py", line 327, in execute',+ " output_data = get_output_data(obj, input_data_all)",+ ' File "C:\\ComfyUI\\nodes.py", line 12, in load',+ " raise RuntimeError(msg)",+ "RuntimeError: can't reach http://127.0.0.1:8188/prompt (prompt_id: 6f1c2b7e-1d2a-4c8e-9f00-1234567890ab) on 192.168.1.20:8189",+ " at runJob (file:///srv/fuobe/worker.mjs:10:5)",+ ].join("\n");+ const out = cleanEngineText(raw);+ expect(out).toBe("RuntimeError: can't reach [address] on [address]");+ });++ it("cuts long text short", () => {+ const out = cleanEngineText("x".repeat(5000), 100);+ expect(out.length).toBe(100);+ expect(out.endsWith("…")).toBe(true);+ });+});++describe("storedErrorText", () => {+ it("cleans a machine's words and keeps the lines of the rest", () => {+ const out = storedErrorText(`VHS_LoadVideo: ${VHS_NO_AUDIO}`);+ for (const leak of LEAKS) expect(out, `${leak}`).not.toMatch(leak);+ expect(out.split("\n")[0]).toBe("VHS_LoadVideo: VHS failed to extract audio from fuobe_HFpqXpUDFs__.mp4");+ const listed = "Missing models:\n checkpoints/flux1-dev.safetensors\n loras/a.safetensors";+ expect(storedErrorText(listed)).toBe(listed);+ expect(storedErrorText("y".repeat(3000)).length).toBe(2000);+ });+});++describe("withoutFolders", () => {+ it("takes out only the given folders", () => {+ const text = "Couldn't read /var/lib/fuobe/data/uploads/a.png; your file C:\\ComfyUI\\input\\b.png is fine";+ expect(withoutFolders(text, ["/var/lib/fuobe/data"])).toBe("Couldn't read a.png; your file C:\\ComfyUI\\input\\b.png is fine");+ expect(withoutFolders("C:\\Users\\me\\x.png", ["/", "C:\\"])).toBe("C:\\Users\\me\\x.png");+ });+});++describe("what the person reads for each kind of failure", () => {+ it("tells the kinds apart", () => {+ expect(engineFailureKind(VHS_ONE_LINE)).toBe("no-sound");+ expect(engineFailureKind("torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 2.00 GiB")).toBe("out-of-memory");+ expect(engineFailureKind("Invalid data found when processing input")).toBe("unreadable-input");+ expect(engineFailureKind("moov atom not found")).toBe("unreadable-input");+ expect(engineFailureKind("Timed out after 45 minutes")).toBe("timeout");+ expect(engineFailureKind("whatever", "comfy_missing_model")).toBe("missing-on-gpu");+ expect(engineFailureKind("Value not in list: ckpt_name: 'x.safetensors' not in []")).toBe("missing-on-gpu");+ expect(engineFailureKind("ComfyUI restarted and lost this run. Press Retry.")).toBe("gpu-stopped");+ expect(engineFailureKind("KSampler: mat1 and mat2 shapes cannot be multiplied")).toBe("unknown");+ });++ it("the example: a plain sentence for the person, the cleaned words for the owner", () => {+ const f = plainEngineFailure(VHS_ONE_LINE);+ expect(f.kind).toBe("no-sound");+ expect(f.words).toBe(ENGINE_WORDS["no-sound"]);+ expect(f.words).toBe("This clip has no sound for this run to use. Try a clip with sound.");+ expect(f.detail).toMatch(/^VHS_LoadVideo: VHS failed to extract audio from fuobe_HFpqXpUDFs__\.mp4/);+ for (const leak of LEAKS) expect(f.detail!, `${leak}`).not.toMatch(leak);+ });++ it("every sentence is plain: no path, node, engine or dead end", () => {+ for (const w of Object.values(ENGINE_WORDS)) {+ expect(isEngineWords(w)).toBe(true);+ expect(w).not.toMatch(/ComfyUI|GPU|worker|node|ffmpeg|VHS|support|Press Retry|[\\/]/i);+ // What to do next is always said.+ expect(w).toMatch(/Try|Run it again/);+ }+ expect(isEngineWords("VHS_LoadVideo: x")).toBe(false);+ });+});++describe("a worker's reports", () => {+ it("never name the worker's folders: ComfyUI's words and a refusal's answer go with file names only", () => {+ const finished: ReportEvent = {+ event: "finished",+ entry: {+ prompt: [1, "p"],+ status: { status_str: "error", messages: [["execution_error", { node_type: "VHS_LoadVideo", exception_message: VHS_NO_AUDIO, current_inputs: { video: ["X:\\fuobe-worker\\work\\input\\fuobe_HFpqXpUDFs__.mp4"] } }]] },+ outputs: { "9": { gifs: [{ filename: "fuobe_out_00001.mp4", subfolder: "", type: "output" }] } },+ },+ };+ const out = JSON.stringify(withoutWorkerPaths(finished));+ expect(out).not.toMatch(/fuobe-worker|X:\\\\/);+ expect(out).toContain("fuobe_HFpqXpUDFs__.mp4");+ // Results go as they were.+ expect((withoutWorkerPaths(finished) as Extract<ReportEvent, { event: "finished" }>).entry.outputs).toEqual(finished.entry.outputs);+ const refused: ReportEvent = { event: "refused", status: 400, body: { error: { message: "Prompt outputs failed validation" }, node_errors: { "4": { errors: [{ details: "/home/worker/ComfyUI/models/checkpoints/a.safetensors missing" }] } } } };+ expect(JSON.stringify(withoutWorkerPaths(refused))).not.toContain("/home/worker");+ const passes: ReportEvent = { event: "passes", running: false, entries: [finished.entry] };+ expect(JSON.stringify(withoutWorkerPaths(passes))).not.toContain("fuobe-worker");+ const running: ReportEvent = { event: "running", value: 1, max: 2, node: "4" };+ expect(withoutWorkerPaths(running)).toBe(running);+ });+});diff --git a/tests/helpers/run-watch.ts b/tests/helpers/run-watch.tsindex 629f7bcb..1c029325 100644--- a/tests/helpers/run-watch.ts+++ b/tests/helpers/run-watch.ts@@ -5,6 +5,7 @@* the place it had. No error, no word about the machines, no pause. A look that can't find the run (an error answer, a* run gone from the list) breaks the rule too, and so does the run showing to anyone but its own account.*/+import { isEngineWords } from "@/lib/engine-error";import { POOL_WORDS } from "@/lib/relay";/** A run as the studio answers it (GET /api/generations/<id>, a list item, getGeneration). */@@ -114,14 +115,15 @@ export class RunWatch {}/**- * A run that truly can't finish: one plain sentence (`words`: the failure sentence, or one about the person's own files),- * nothing about the machines, and "Not charged" only when its hold set something aside (`charged`). A free run says- * nothing about a charge.+ * A run that truly can't finish: one plain sentence (`words`: one about the person's own files; else the failure+ * sentence or its kind's), nothing about the machines, and "Not charged" only when its hold set something aside+ * (`charged`). A free run says nothing about a charge.*/export function plainFailure(g: RunLike, o: { charged: boolean; words?: string }): string[] {const out: string[] = [];if (g.status !== "failed") out.push(`it is ${g.status}, not failed`);- if (g.error !== (o.words ?? POOL_WORDS.failed)) out.push(`its words are ${JSON.stringify(g.error)}`);+ // (Without `words`: the failure sentence, or the plain sentence for its kind of failure, src/lib/engine-error.ts.)+ if (o.words ? g.error !== o.words : g.error !== POOL_WORDS.failed && !isEngineWords(g.error)) out.push(`its words are ${JSON.stringify(g.error)}`);if (g.fix) out.push("it offers a fix");if (o.charged && !g.notCharged) out.push("it doesn't say Not charged");if (!o.charged && g.notCharged) out.push("it says Not charged, but nothing was set aside");diff --git a/tests/hosted-words.test.ts b/tests/hosted-words.test.tsindex 316736aa..45a5d7e6 100644--- a/tests/hosted-words.test.ts+++ b/tests/hosted-words.test.ts@@ -41,6 +41,7 @@ const { OWN_GPU_TOOL_HOSTED } = await import("@/lib/guest-access");const { SITE_HIDDEN_WORDS } = await import("@/server/output-checks");const { SITE_FAILED_WORDS } = await import("@/lib/comfy-compose");const { FILE_TROUBLE_WORDS, POOL_WORDS } = await import("@/lib/relay");+const { ENGINE_WORDS } = await import("@/lib/engine-error");const { notePlaceName, placeOf } = await import("@/lib/place-name");const { runPlace } = await import("@/lib/run-place");const { accountEngine } = await import("@/lib/your-keys");@@ -131,6 +132,7 @@ function serverWords(place: ReturnType<typeof placeOf>): string[] {ownGpuQuiet(place),...Object.values(POOL_WORDS),...Object.values(FILE_TROUBLE_WORDS),+ ...Object.values(ENGINE_WORDS),SITE_HIDDEN_WORDS,SITE_FAILED_WORDS,];diff --git a/tests/pool-account-runs.test.ts b/tests/pool-account-runs.test.tsindex fb3b5a80..fb471f94 100644--- a/tests/pool-account-runs.test.ts+++ b/tests/pool-account-runs.test.ts@@ -60,6 +60,7 @@ const { allLanes } = await import("@/lib/lanes");const { getModel } = await import("@/lib/catalog");const { ComputerRunner } = await import("@/lib/computer-runner");const { FILE_TROUBLE_WORDS, POOL_WORDS } = await import("@/lib/relay");+const { ENGINE_WORDS, isEngineWords } = await import("@/lib/engine-error");const { ACCOUNT_MESSAGES } = await import("@/server/account-files");const { catalogVersion } = await import("@/server/computer/catalog-version");@@ -689,7 +690,10 @@ describe("an account's run that a worker can't finish", () => {expect(rowOf(taskId).state).toBe("failed");const g = await ended(id);expect(g.status).toBe("failed");- expect(g.error).toBe(words ?? POOL_WORDS.failed);+ // Its files' words when they are about the person's files, else the plain sentence for its kind of failure.+ if (words) expect(g.error).toBe(words);+ else expect(isEngineWords(g.error), g.error ?? "").toBe(true);+ expect(g.error ?? "").not.toMatch(JARGON);expect(g.message ?? "").not.toMatch(JARGON);expect(g.fix).toBeUndefined();// The owner reads what happened (words about the person's files: the same words, nothing more behind them).@@ -700,9 +704,44 @@ describe("an account's run that a worker can't finish", () => {return;}expect(owner?.detail).toBeTruthy();- expect(owner?.detail).not.toBe(POOL_WORDS.failed);+ expect(owner?.detail).not.toBe(g.error);});}++ it("a node that failed on the worker: the plain sentence for the account, the cleaned words for the owner only", async () => {+ const raw = [+ "VHS failed to extract audio from X:\\fuobe-worker\\work\\input\\fuobe_HFpqXpUDFs__.mp4:",+ "ffmpeg version 7.1-full_build-www.gyan.dev Copyright (c) 2000-2026 the FFmpeg developers",+ " built with gcc 14.2.0 (Rev1, Built by MSYS2 project)",+ " configuration: --enable-gpl --enable-version3 --enable-static",+ " libavutil 59. 39.100 / 59. 39.100",+ "Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'X:\\fuobe-worker\\work\\input\\fuobe_HFpqXpUDFs__.mp4':",+ "Stream map '0:a:0' matches no streams.",+ ].join("\n");+ const w = standInWorker();+ beatAs(w);+ const { id, taskId } = await accountRun();+ const api = workerApi(w.token);+ const t = (await api.claim())!;+ await api.report(t, { event: "sent", promptId: t.promptId });+ const entry = { prompt: [1, t.promptId], status: { status_str: "error", completed: false, messages: [["execution_error", { node_type: "VHS_LoadVideo", node_id: "5", exception_message: raw }]] }, outputs: {} };+ expect((await api.report(t, { event: "finished", entry })).status).toBe(200);+ expect(rowOf(taskId).state).toBe("failed");+ const g = await ended(id);+ expect(g.status).toBe("failed");+ expect(g.error).toBe(ENGINE_WORDS["no-sound"]);+ // What is stored as what the person saw is that sentence too; the engine's words are kept apart, cleaned.+ const stored = db().prepare("SELECT error, detail FROM generations WHERE id = ?").get(id) as { error: string; detail: string };+ expect(stored.error).toBe(ENGINE_WORDS["no-sound"]);+ expect(stored.detail).toContain("VHS_LoadVideo: VHS failed to extract audio from fuobe_HFpqXpUDFs__.mp4");+ expect(stored.detail).toContain("matches no streams");+ expect(stored.detail).not.toMatch(/fuobe-worker|X:\\|ffmpeg version|Copyright|configuration:|libavutil|Input #0/);+ const owner = listAccountRuns({ account: accountId }).items.find((x) => x.id === id);+ expect(owner?.error).toBe(ENGINE_WORDS["no-sound"]);+ expect(owner?.detail).toBe(stored.detail);+ // Nothing of it in the run as the account reads it.+ expect(JSON.stringify(getGeneration(id))).not.toMatch(/VHS|fuobe-worker|ffmpeg/);+ });});describe("graphs and results for the workers", () => {