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.

Your GPU: known ComfyUI problems are named before Run, and the memfd_create stop has its own fix

Adarsh9d433a3de197
diff --git a/src/components/gpu/file-steps.tsx b/src/components/gpu/file-steps.tsx
index cc70d774..88821324 100644
--- a/src/components/gpu/file-steps.tsx
+++ b/src/components/gpu/file-steps.tsx
@@ -1,6 +1,6 @@
"use client";
-import { CheckCircle2, Cpu, Download, ExternalLink, Loader2, RefreshCw } from "lucide-react";
+import { CheckCircle2, Cpu, Download, ExternalLink, Loader2, RefreshCw, Wrench } from "lucide-react";
import { openGpuSetup, useGpuCheck, useGpuPlan } from "@/hooks/use-gpu";
import { fileSteps, getItLabel, putItIn, readinessLine, type FileStep } from "@/lib/gpu/file-steps";
import type { Badge, FixPlan } from "@/lib/gpu/types";
@@ -117,7 +117,7 @@ export function GpuReadinessLine({ badge, gpuRef, name, className }: { badge: Ba
const one = line.files.length === 1 ? line.files[0] : undefined;
return (
<div role="status" className={cn("flex flex-wrap items-center gap-x-2 gap-y-1.5 rounded-xl bg-muted/60 px-3 py-2 text-[12px]", className)}>
- {line.state === "gpu" ? <Cpu aria-hidden className="size-3.5 shrink-0" /> : <Download aria-hidden className="size-3.5 shrink-0" />}
+ {line.state === "gpu" ? <Cpu aria-hidden className="size-3.5 shrink-0" /> : line.state === "problem" ? <Wrench aria-hidden className="size-3.5 shrink-0" /> : <Download aria-hidden className="size-3.5 shrink-0" />}
<button type="button" onClick={open} className="min-w-0 flex-1 basis-48 text-left font-medium underline-offset-2 hover:underline">
{line.words}
{one?.size && <span className="font-normal text-muted-foreground"> · {one.size}</span>}
diff --git a/src/components/gpu/guided-fix.tsx b/src/components/gpu/guided-fix.tsx
index 31251718..d29f97ce 100644
--- a/src/components/gpu/guided-fix.tsx
+++ b/src/components/gpu/guided-fix.tsx
@@ -13,6 +13,7 @@ import { Sheet, SheetContent, SheetDescription, SheetTitle } from "@/components/
import { GPU_SETUP_EVENT, takeGpuRetry, useGpuCheck, useGpuPlan, type GpuSetupDetail } from "@/hooks/use-gpu";
import { useIsMobile } from "@/hooks/use-mobile";
import { useEngine } from "@/lib/api";
+import { knownFixes } from "@/lib/gpu/known-problems";
import { formatBytes } from "@/lib/gpu/requirements";
import type { FixPlan, FixStep, Need, WhyCode } from "@/lib/gpu/types";
import { cn } from "@/lib/utils";
@@ -45,6 +46,9 @@ function itemLine(n: Need): string {
}
function intro(plan: FixPlan, kind?: string): string {
+ // A known problem of this ComfyUI on this system says what stops, and why, in its own words.
+ const known = plan.steps.find((s) => s.problem);
+ if (known) return known.detail;
const downloads = plan.steps.filter((s) => DOWNLOAD_KINDS.has(s.kind));
const packs = plan.steps.filter((s) => s.kind.startsWith("pack-"));
if (plan.steps.some((s) => s.kind === "comfy-update")) return "Your ComfyUI is older than this tool needs. Updating it keeps your models and add-ons.";
@@ -114,12 +118,24 @@ function PlanState({ plan, kind, actions, checking, onCheck, checkError }: { pla
const real = plan.steps.filter((s) => s.kind !== "restart" && s.kind !== "hf-licence" && s.kind !== "civitai-key");
// Files get rows of their own (name, size, folder, Get it); the list keeps the other steps and what is already there.
const files = real.filter((s) => s.download);
+ // A known problem's fixes, recommended first, each with an example.
+ const fixes = knownFixes(plan.steps.find((s) => s.problem)?.problem);
const shown = files.length ? real.filter((s) => !s.download) : real.length ? real : plan.steps;
const why = WHY[plan.why] ?? WHY["manual-only"]!;
const [lo, hi] = plan.etaMin;
return (
<div className="space-y-4">
<p className="text-[13px] text-muted-foreground">{intro(plan, kind)}</p>
+ {fixes.length > 0 && (
+ <ol className="space-y-2 rounded-lg border px-3 py-2.5 text-[13px]">
+ {fixes.map((f, i) => (
+ <li key={f.label}>
+ <p className={cn(i === 0 && "font-medium")}>{f.label}</p>
+ {f.example && <p className="mt-0.5 font-mono text-[12px] break-all text-muted-foreground">{f.example}</p>}
+ </li>
+ ))}
+ </ol>
+ )}
{files.length > 0 && <FileStepRows plan={plan} />}
{(shown.length > 0 || plan.have.length > 0) && (
<ul className="divide-y rounded-lg border px-3">
diff --git a/src/components/gpu/trouble.tsx b/src/components/gpu/trouble.tsx
index 5704eb45..accd4048 100644
--- a/src/components/gpu/trouble.tsx
+++ b/src/components/gpu/trouble.tsx
@@ -53,6 +53,7 @@ const ICONS: Record<TroubleActionKind, typeof Play> = {
"send-smaller": Minimize2,
"try-smaller": Minimize2,
"get-file": Download,
+ "update-comfy": RefreshCw,
};
/** The first button stands out (the one most likely to help); the rest are quieter. One line each, cut short when narrow. */
@@ -79,7 +80,7 @@ export interface TroubleHandlers {
* When some buttons must go (a small tile), the ones that help least go first: Settings (Check my GPU leads there too),
* Pair with a code, then the rest. The first button (the one most likely to help) always stays, and the order is kept.
*/
-const DROP_FIRST: TroubleActionKind[] = ["gpu-settings", "pair", "use-computer", "pick-model", "retry", "check-gpu", "key-settings", "try-smaller", "send-smaller", "add-credit", "run-with-key", "get-file", "start-gpu"];
+const DROP_FIRST: TroubleActionKind[] = ["gpu-settings", "pair", "use-computer", "pick-model", "retry", "check-gpu", "key-settings", "try-smaller", "send-smaller", "add-credit", "run-with-key", "get-file", "update-comfy", "start-gpu"];
export function fitActions(actions: TroubleAction[], max?: number): TroubleAction[] {
if (!max || actions.length <= max) return actions;
@@ -140,7 +141,7 @@ export function TroubleActions({
if (a.kind === "send-smaller") return !!handlers.onSendSmaller;
if (a.kind === "try-smaller") return !!handlers.onTrySmaller;
// Where a model file downloads from: only an https link.
- if (a.kind === "get-file") return !!a.target && HTTPS.test(a.target);
+ if (a.kind === "get-file" || a.kind === "update-comfy") return !!a.target && HTTPS.test(a.target);
// On a tile, Check my GPU leads to Settings when that is what helps: one button fewer.
if (compact && a.kind === "gpu-settings" && actions.some((x) => x.kind === "check-gpu") && a.label.startsWith("Open Settings")) return false;
return true;
@@ -182,7 +183,7 @@ export function TroubleActions({
const cls = cn(PILL, i === 0 && a.kind !== "retry" ? MAIN : QUIET);
const words = <span className="truncate">{compact ? shortLabel(a) : a.label}</span>;
const stop = (e: React.MouseEvent) => e.stopPropagation();
- if ((a.kind === "start-gpu" || a.kind === "add-credit" || a.kind === "get-file") && a.target) {
+ if ((a.kind === "start-gpu" || a.kind === "add-credit" || a.kind === "get-file" || a.kind === "update-comfy") && a.target) {
return (
<a key={a.kind} href={a.target} target="_blank" rel="noopener noreferrer" onClick={stop} title={a.label} className={cls}>
<Icon className="size-3 shrink-0" /> {words}
diff --git a/src/lib/diagnose.ts b/src/lib/diagnose.ts
index 48077223..8a65a718 100644
--- a/src/lib/diagnose.ts
+++ b/src/lib/diagnose.ts
@@ -6,10 +6,13 @@
*
* Only an account's own GPU and keys are read this way. The owner's runs and runs on the studio's GPUs keep their words.
*/
+import { knownProblemOf } from "./gpu/known-problems";
import { balanceMessage, CLOUD_KEY, keyRejectedMessage, type CloudProvider } from "./your-keys";
/** RunPod's list of pods, where a stopped pod is started again. */
export const RUNPOD_CONSOLE_URL = "https://console.runpod.io/pods";
+/** ComfyUI's own guide to updating it (every install kind: portable, Desktop, git). */
+export const COMFY_UPDATE_URL = "https://docs.comfy.org/installation/update_comfyui";
/** Where a provider account gets credit. */
export const BILLING_URL: Record<CloudProvider, string> = { fal: "https://fal.ai/dashboard/billing", replicate: "https://replicate.com/account/billing" };
@@ -43,6 +46,11 @@ export type TroubleCause =
| "gpu-job-error"
/** A model file a loader can't read (damaged, cut short) or doesn't have: words name the file. */
| "gpu-model-file"
+ /**
+ * A known problem of the person's ComfyUI version on their system (src/lib/gpu/known-problems.ts: ComfyUI 0.43 on a Linux
+ * Python without memfd_create): every run stops the same way until ComfyUI is updated, so never Retry.
+ */
+ | "gpu-comfy-known"
| "gpu-restarted"
| "gpu-moved"
| "gpu-went-away"
@@ -85,12 +93,14 @@ export type TroubleActionKind =
/** Run it again one size or length smaller (out of memory), on a click. */
| "try-smaller"
/** Open where a model file downloads from (an https link: the file, or a gated file's Hugging Face page). */
- | "get-file";
+ | "get-file"
+ /** Open how to update ComfyUI (an https link: ComfyUI's own guide). */
+ | "update-comfy";
export interface TroubleAction {
kind: TroubleActionKind;
label: string;
- /** A link (start-gpu, add-credit, gpu-settings, key-settings, pair, get-file) or the provider (run-with-key). */
+ /** A link (start-gpu, add-credit, gpu-settings, key-settings, pair, get-file, update-comfy) or the provider (run-with-key). */
target?: string;
/** run-with-key: the model that runs this tool on that key (its cloud version), and its operation there. */
modelId?: string;
@@ -216,6 +226,7 @@ const A = {
trySmaller: (): TroubleAction => ({ kind: "try-smaller", label: "Try one size smaller" }),
connectGpu: (): TroubleAction => ({ kind: "gpu-settings", label: "Connect your GPU", target: "/settings#your-gpu" }),
getFile: (url: string): TroubleAction => ({ kind: "get-file", label: "Get the file", target: url }),
+ updateComfy: (): TroubleAction => ({ kind: "update-comfy", label: "How to update ComfyUI", target: COMFY_UPDATE_URL }),
};
/**
@@ -668,6 +679,9 @@ export function diagnoseGpuJob(e: GpuJobTrouble, place: GpuPlace): Diagnosis {
case "error": {
const msg = (e.message ?? "").trim();
if (isOutOfMemoryText(msg)) return { cause: "gpu-out-of-memory", words: OUT_OF_MEMORY_WORDS, details: joinDetails(e.nodeType, cleanDetails(msg, 120)), actions: [A.trySmaller(), A.retry(), A.pick()], retryable: false };
+ // A known problem of this ComfyUI on this system: named, with its fix; Retry would stop the same way.
+ const known = knownProblemOf(msg);
+ if (known) return { cause: "gpu-comfy-known", words: known.words, details: joinDetails(e.nodeType, cleanDetails(msg, 160)), actions: [A.updateComfy(), ...(place.kind === "link" ? [A.check()] : [])], retryable: false };
const file = modelFileProblem(e.nodeType, msg);
if (file) return modelFileTrouble(file, e, place);
return {
diff --git a/src/lib/gpu/argv.ts b/src/lib/gpu/argv.ts
index 46508d08..67e3a493 100644
--- a/src/lib/gpu/argv.ts
+++ b/src/lib/gpu/argv.ts
@@ -34,5 +34,7 @@ export function parseArgv(argv: unknown): ComfyFlags {
managerLegacyUi: has("--enable-manager-legacy-ui"),
lowvram: has("--lowvram") || has("--novram"),
cpuOnly: has("--cpu"),
+ // ComfyUI's dynamic VRAM (comfy-aimdo) is off with any of these (comfy/cli_args.py enables_dynamic_vram).
+ dynamicVramOff: ["--disable-dynamic-vram", "--highvram", "--gpu-only", "--novram", "--cpu"].some(has),
};
}
diff --git a/src/lib/gpu/file-steps.ts b/src/lib/gpu/file-steps.ts
index f1c96be6..a7ed1132 100644
--- a/src/lib/gpu/file-steps.ts
+++ b/src/lib/gpu/file-steps.ts
@@ -52,7 +52,7 @@ export const putItIn = (f: Pick<FileStep, "folder" | "path">): string => `Put it
/** What the readiness line says. `files`: the files it names (one gets its own Get it). Null: no line. */
export interface ReadinessLine {
- state: "ready" | "files" | "setup" | "gpu";
+ state: "ready" | "files" | "setup" | "gpu" | "problem";
words: string;
files: FileStep[];
}
@@ -70,6 +70,9 @@ export function readinessLine(badge: Badge | null | undefined, plan: Pick<FixPla
if (s === "u") return null;
// The plan is the server's newer read: once it says ready, so does the line.
if (plan?.state === "ready") return { state: "ready", words: "Ready on your GPU", files: [] };
+ // A known problem of this ComfyUI on this system (known-problems.ts) comes first: nothing runs there until it is fixed.
+ const known = plan?.steps.find((x) => x.problem);
+ if (known) return { state: "problem", words: `Your ComfyUI needs an update: ${known.label.replace(/^Update ComfyUI to /, "")}`, files: [] };
const files = fileSteps(plan);
const others = (plan?.steps ?? []).filter((x) => !x.download && x.kind !== "restart" && x.kind !== "hf-licence" && x.kind !== "civitai-key").length;
if (files.length && !others) {
diff --git a/src/lib/gpu/gather.ts b/src/lib/gpu/gather.ts
index 19c15cd0..d435c421 100644
--- a/src/lib/gpu/gather.ts
+++ b/src/lib/gpu/gather.ts
@@ -52,6 +52,8 @@ export const problemText = (p: GpuProblem, where: "link" | "computer" | "install
p === "unreachable" && where === "computer" ? COMPUTER_UNREACHABLE : p === "unreachable" && where === "install" ? INSTALL_UNREACHABLE : PROBLEM_TEXT[p];
const clip = (s: unknown, n: number) => String(s ?? "").slice(0, n);
+/** The compiler part of system_stats' python_version, in its square brackets. */
+const PY_BUILD = /\[([^\]\n]{1,60})\]/;
/** A semaphore: at most `n` jobs at once. */
function limiter(n: number) {
@@ -186,6 +188,8 @@ export async function gatherInventory(t: ComfyTransport, idx: RequirementIndex,
version: clip(sys.comfyui_version, 40),
os: clip(sys.os, 20),
...(sys.python_version && { python: clip(String(sys.python_version).split(" ")[0], 20) }),
+ // The build part ("3.12.9 (main, Feb 12 2025) [Clang 19.1.6 ]"): which compiler made this Python.
+ ...(PY_BUILD.test(String(sys.python_version ?? "")) && { pythonBuild: clip(PY_BUILD.exec(String(sys.python_version))![1].trim(), 60) }),
...(sys.pytorch_version && { torch: clip(sys.pytorch_version, 40) }),
embeddedPython: !!sys.embedded_python,
deployEnv: clip(sys.deploy_environment ?? "local-git", 40),
diff --git a/src/lib/gpu/known-problems.ts b/src/lib/gpu/known-problems.ts
new file mode 100644
index 00000000..22f92a0b
--- /dev/null
+++ b/src/lib/gpu/known-problems.ts
@@ -0,0 +1,78 @@
+import { compareVersions } from "./requirements";
+import type { GpuInventory, Need } from "./types";
+
+/**
+ * Known problems of a ComfyUI version on a kind of system: runs there stop the same way every time, whatever the tool,
+ * so Retry never helps. The GPU pre-flight reads them from the last check's facts (system_stats: OS, ComfyUI, Python,
+ * launch flags; nothing here asks the GPU) and names the fix before Run, recommended first; a run that already stopped
+ * with one gets the same words (diagnose.ts). Pure: browser and server.
+ *
+ * memfd (ComfyUI 0.43.0 to 0.43.2 on Linux): its dynamic VRAM keeps models in an anonymous file made with Python's
+ * os.memfd_create (comfy/anonymous_file.py, ComfyUI commit 503d785f0, 2026-10-22). Pythons built against an old glibc
+ * don't have that call (uv's and other standalone Python builds, made with Clang against an old glibc), so the first
+ * model load stops with "module 'os' has no attribute 'memfd_create'" (KSampler, where models load). ComfyUI 0.44.0
+ * calls libc itself (commit 54a4e56ad, 2026-10-28). Windows and macOS never reach that call.
+ */
+
+export type KnownProblemId = "comfy-043-memfd";
+
+export interface KnownProblem {
+ id: KnownProblemId;
+ /** One plain sentence: what stops and why. */
+ words: string;
+ /** The fixes, recommended first, each with an example. */
+ fixes: { label: string; example?: string }[];
+ /** The ComfyUI version that fixes it. */
+ fixedIn: string;
+}
+
+const MEMFD: Omit<KnownProblem, "words"> = {
+ id: "comfy-043-memfd",
+ fixedIn: "0.44.0",
+ fixes: [
+ { label: "Update ComfyUI to 0.44.0 or newer (recommended)", example: "git -C ComfyUI pull, then pip install -r ComfyUI/requirements.txt" },
+ { label: "Or start ComfyUI with --disable-dynamic-vram", example: "python main.py --listen --disable-dynamic-vram" },
+ ],
+};
+
+const memfdWords = (version?: string) =>
+ `ComfyUI ${version ? `${version} ` : "0.43 "}stops at the first model on this Linux Python (it has no memfd_create). Update ComfyUI to 0.44.0 or newer, or start it with --disable-dynamic-vram.`;
+
+/** A Python built the way uv's and other standalone builds are (Clang against an old glibc): system_stats' build part. */
+const STANDALONE = /^Clang /;
+
+/** The known problems this check's facts show, before any run. */
+export function knownProblems(inv: Pick<GpuInventory, "reachable" | "comfy" | "devices">): KnownProblem[] {
+ const c = inv.comfy;
+ if (!inv.reachable || !c?.version) return [];
+ const out: KnownProblem[] = [];
+ const linux = c.os === "posix" && !inv.devices.some((d) => d.type === "mps");
+ const v043 = compareVersions(c.version, "0.43.0") >= 0 && compareVersions(c.version, "0.44.0") < 0;
+ // ComfyUI's dynamic VRAM is on unless a launch flag turns it off (comfy/cli_args.py enables_dynamic_vram).
+ const dynamicOn = !c.flags?.dynamicVramOff && !c.flags?.cpuOnly;
+ if (linux && v043 && dynamicOn && STANDALONE.test(c.pythonBuild ?? "")) out.push({ ...MEMFD, words: memfdWords(c.version) });
+ return out;
+}
+
+/** A run's error that is one of these problems (a node's message, as ComfyUI sent it). */
+export function knownProblemOf(message: string | undefined, version?: string): KnownProblem | null {
+ const m = String(message ?? "").slice(0, 4096);
+ if (/has no attribute ['"]?memfd_create/i.test(m)) return { ...MEMFD, words: memfdWords(version) };
+ return null;
+}
+
+/** A known problem's fixes, recommended first (the guided fix lists them with their examples). */
+export function knownFixes(id: string | undefined): KnownProblem["fixes"] {
+ return id === MEMFD.id ? MEMFD.fixes : [];
+}
+
+/** The step a known problem adds to every tool's plan: updating ComfyUI (its commands come with the step). */
+export function knownProblemNeed(p: KnownProblem): Need {
+ return {
+ key: `known:${p.id}`,
+ kind: "comfy-update",
+ label: `Update ComfyUI to ${p.fixedIn} or newer`,
+ detail: p.words,
+ problem: p.id,
+ };
+}
diff --git a/src/lib/gpu/readiness.ts b/src/lib/gpu/readiness.ts
index a3a9ad80..45c30a6c 100644
--- a/src/lib/gpu/readiness.ts
+++ b/src/lib/gpu/readiness.ts
@@ -1,4 +1,5 @@
import { compareVersions, formatBytes, nameKey, splitKey, vramGb } from "./requirements";
+import { knownProblemNeed, knownProblems } from "./known-problems";
import { cardFits, GPU_NEED_TEXT, readCard, type GpuNeed } from "./rtx";
import type { Badge, FileKey, GpuInventory, IndexFile, InventorySummary, Need, Readiness, RequirementIndex, ToolReadiness, ToolRef, VramFit } from "./types";
@@ -220,6 +221,9 @@ export function workflowReadiness(id: string, inv: GpuInventory, idx: Requiremen
},
);
}
+ // A known problem of this ComfyUI on this system (memfd on ComfyUI 0.43 with a standalone Linux Python): every graph
+ // that loads a model stops the same way, so its fix is a step of each, before Run (Run anyway stays).
+ if (w.files.length && !out.needs.some((n) => n.kind === "comfy-update")) for (const p of knownProblems(inv)) out.needs.push(knownProblemNeed(p));
// Add-ons.
const packNeeds = new Set<string>();
for (const [name, classes] of Object.entries(w.packs)) {
diff --git a/src/lib/gpu/types.ts b/src/lib/gpu/types.ts
index b06d3fa2..f479d446 100644
--- a/src/lib/gpu/types.ts
+++ b/src/lib/gpu/types.ts
@@ -115,6 +115,8 @@ export interface ComfyFlags {
enableManager: boolean;
managerLegacyUi: boolean;
lowvram: boolean;
+ /** ComfyUI's dynamic VRAM is off (--disable-dynamic-vram, --highvram, --gpu-only, --novram, --cpu). Older checks lack it. */
+ dynamicVramOff?: boolean;
cpuOnly: boolean;
}
@@ -141,6 +143,8 @@ export interface GpuInventory {
version: string;
os: string;
python?: string;
+ /** The Python build's compiler, from system_stats ("Clang 20.1.4", "GCC 13.3.0", "MSC v.1942 64 bit"): known problems read it. */
+ pythonBuild?: string;
torch?: string;
embeddedPython: boolean;
deployEnv: string;
@@ -217,6 +221,8 @@ export interface Need {
lora?: string;
/** The node classes it is about (missing core classes). */
classes?: string[];
+ /** A known problem of this ComfyUI on this system (known-problems.ts) that this step fixes. */
+ problem?: string;
/** Text read from the viewer's ComfyUI (a traceback): shown as plain text only. */
remote?: string;
}
diff --git a/tests/helpers/fake-comfy.ts b/tests/helpers/fake-comfy.ts
index 816fea24..bb25bc2d 100644
--- a/tests/helpers/fake-comfy.ts
+++ b/tests/helpers/fake-comfy.ts
@@ -9,6 +9,8 @@ import zlib from "node:zlib";
export interface FakeScenario {
version?: string;
+ /** system_stats' python_version, build part included ("3.12.9 (main, Feb 12 2025) [Clang 19.1.6 ]"). */
+ python?: string;
os?: string;
embeddedPython?: boolean;
deployEnv?: string;
@@ -148,7 +150,7 @@ export async function startFakeComfy(scenario: FakeScenario, port = 0): Promise<
ram_total: (s.ramGb ?? 32) * GB,
ram_free: (s.ramGb ?? 32) * GB * 0.5,
comfyui_version: s.version ?? "0.41.2",
- python_version: "3.12.9 (main)",
+ python_version: s.python ?? "3.12.9 (main)",
pytorch_version: "2.9.0+cu128",
embedded_python: !!s.embeddedPython,
deploy_environment: s.deployEnv ?? "local-git",
diff --git a/tests/known-problems.test.ts b/tests/known-problems.test.ts
new file mode 100644
index 00000000..52ed8a76
--- /dev/null
+++ b/tests/known-problems.test.ts
@@ -0,0 +1,137 @@
+import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
+import { NextRequest } from "next/server";
+import { startFakeComfy, readyFor, type FakeComfy, type FakeScenario } from "./helpers/fake-comfy";
+import { tempDir } from "./helpers/temp-dir";
+
+/**
+ * Known problems of a ComfyUI version on a kind of system (src/lib/gpu/known-problems.ts), starting with ComfyUI 0.43's
+ * os.memfd_create on a standalone Linux Python: before Run, the account's GPU check names it with its fixes (recommended
+ * first) and Run anyway stays; a run that stopped with it gets its own words and no Retry.
+ */
+
+vi.mock("next/server", async (importOriginal) => ({ ...(await importOriginal<typeof import("next/server")>()), connection: async () => {} }));
+vi.setConfig({ testTimeout: 30_000 });
+
+const dir = tempDir("fuobe-known-");
+process.env.FUOBE_DATA_DIR = dir;
+process.env.FUOBE_PUBLIC_SIGNUP = "1";
+delete process.env.FUOBE_PASSWORD;
+delete process.env.FUOBE_ALLOW_PRIVATE_URLS;
+delete process.env.FUOBE_GPU_PREFLIGHT;
+
+const auth = await import("@/server/auth");
+const { loadIndex } = await import("@/server/gpu/index-file");
+const { gpuTargetFor } = await import("@/server/gpu/target");
+const { gateGeneration } = await import("@/server/gpu/gate");
+const check = await import("@/app/api/gpu/check/route");
+const plan = await import("@/app/api/gpu/plan/route");
+const badges = await import("@/app/api/gpu/badges/route");
+const { knownProblems, knownProblemOf, knownFixes } = await import("@/lib/gpu/known-problems");
+const { parseArgv } = await import("@/lib/gpu/argv");
+const { diagnoseGpuJob } = await import("@/lib/diagnose");
+const { readinessLine } = await import("@/lib/gpu/file-steps");
+
+const idx = loadIndex();
+const QWEN = "qwen-image-21-edit";
+const LINUX_UV = "3.12.11 (main, Jun 4 2025, 17:36:46) [Clang 20.1.4 ]";
+const LINUX_DISTRO = "3.12.3 (main, Nov 6 2025, 13:44:16) [GCC 13.3.0]";
+const MEMFD = "module 'os' has no attribute 'memfd_create'";
+const CARD = { devices: [{ name: "cuda:0 NVIDIA GeForce RTX 4090 : cudaMallocAsync", type: "cuda", vramGb: 24 }] };
+
+const fakes: FakeComfy[] = [];
+afterAll(async () => {
+ globalThis.__fuobeGpuTestTransport = undefined;
+ await Promise.all(fakes.map((f) => f.close()));
+});
+beforeAll(() => {
+ auth.setPassword("install password");
+ globalThis.__fuobeGpuTestTransport = { resolve: async (h) => (h.endsWith(".gpu.test") ? ["127.0.0.1"] : ["203.0.113.9"]), blocked: () => false };
+});
+
+function req(url: string, o: { method?: string; cookie?: string } = {}) {
+ const headers: Record<string, string> = { host: "localhost:3000", "sec-fetch-site": "same-origin" };
+ if (o.cookie) headers.cookie = `${auth.SESSION_COOKIE}=${o.cookie}`;
+ return new NextRequest(`http://localhost:3000${url}`, { method: o.method ?? "GET", headers });
+}
+
+let n = 0;
+async function accountWith(s: FakeScenario) {
+ const f = await startFakeComfy(s);
+ fakes.push(f);
+ const a = auth.createAccount(`known${++n}@example.com`, "long enough");
+ auth.setAccountGpu(a.id, { url: `http://k${n}.gpu.test:${f.port}` });
+ const cookie = auth.createSession(a.id).value;
+ await (await check.POST(req("/api/gpu/check", { method: "POST", cookie }))).text();
+ return { cookie, t: gpuTargetFor(req("/", { cookie }), "read") };
+}
+
+const run = { request: { feature: "image", modelId: "oss-qwen-image-21", op: "edit" as const, prompt: "make it night", account: "x", engine: "open" as const }, route: { provider: "comfyui", endpoint: QWEN }, op: "edit", modelId: "oss-qwen-image-21", actor: "x" };
+
+/** The facts a check reads, as known problems see them. */
+const facts = (o: { os?: string; version?: string; build?: string; argv?: string[]; type?: string }) => ({
+ reachable: true,
+ comfy: { version: o.version ?? "0.43.1", os: o.os ?? "posix", pythonBuild: o.build ?? "Clang 20.1.4", embeddedPython: false, deployEnv: "local-git", flags: parseArgv(["main.py", ...(o.argv ?? [])]) },
+ devices: [{ name: "x", type: o.type ?? "cuda", index: 0, vramTotal: 1, vramFree: 1 }],
+});
+
+describe("ComfyUI 0.43's memfd_create on a standalone Linux Python", () => {
+ it("is read from the check's facts: Linux, ComfyUI 0.43.x, dynamic VRAM on, a Clang-built (standalone) Python", () => {
+ expect(knownProblems(facts({})).map((p) => p.id)).toEqual(["comfy-043-memfd"]);
+ for (const v of ["0.43.0", "0.43.2"]) expect(knownProblems(facts({ version: v })), v).toHaveLength(1);
+ // ComfyUI 0.44.0 calls libc itself; 0.42 has no anonymous files.
+ for (const v of ["0.44.0", "0.44.1", "0.42.5"]) expect(knownProblems(facts({ version: v })), v).toEqual([]);
+ // Windows and macOS never reach the call.
+ expect(knownProblems(facts({ os: "nt", build: "MSC v.1942 64 bit (AMD64)" }))).toEqual([]);
+ expect(knownProblems(facts({ type: "mps" }))).toEqual([]);
+ // A distro Python has the call; dynamic VRAM turned off never makes the file.
+ expect(knownProblems(facts({ build: "GCC 13.3.0" }))).toEqual([]);
+ for (const flag of ["--disable-dynamic-vram", "--highvram", "--gpu-only", "--novram", "--cpu"]) expect(knownProblems(facts({ argv: [flag] })), flag).toEqual([]);
+ });
+
+ it("names the fixes, recommended first, each with an example", () => {
+ const fixes = knownFixes("comfy-043-memfd");
+ expect(fixes[0].label).toMatch(/^Update ComfyUI to 0\.44\.0 or newer \(recommended\)/);
+ expect(fixes[1].label).toMatch(/--disable-dynamic-vram/);
+ expect(fixes.every((f) => f.example)).toBe(true);
+ });
+
+ it("a run that stopped with it: its own cause and words, How to update ComfyUI first, never Retry", () => {
+ const d = diagnoseGpuJob({ kind: "error", nodeType: "KSampler", message: MEMFD }, { kind: "link", url: "https://abc-8188.proxy.runpod.net" });
+ expect(d.cause).toBe("gpu-comfy-known");
+ expect(d.words).toMatch(/Update ComfyUI to 0\.44\.0 or newer, or start it with --disable-dynamic-vram\./);
+ expect(d.words).not.toMatch(/Retry/);
+ expect(d.actions.map((a) => a.kind)).toEqual(["update-comfy", "check-gpu"]);
+ expect(d.actions[0].target).toMatch(/^https:\/\/docs\.comfy\.org\//);
+ expect(d.retryable).toBe(false);
+ expect(d.details).toContain("KSampler");
+ // On this computer or a paired ComfyUI: the update only.
+ expect(diagnoseGpuJob({ kind: "error", nodeType: "KSampler", message: MEMFD }, { kind: "computer" }).actions.map((a) => a.kind)).toEqual(["update-comfy"]);
+ // Any other error keeps its words.
+ expect(diagnoseGpuJob({ kind: "error", nodeType: "KSampler", message: "boom" }, { kind: "computer" }).cause).toBe("gpu-job-error");
+ expect(knownProblemOf("AttributeError: module 'os' has no attribute 'memfd_create'")?.id).toBe("comfy-043-memfd");
+ });
+
+ it("before Run on an account's GPU: the plan's step and the readiness line name the update; Run anyway (gpuCheck skip) still runs", async () => {
+ const bad = await accountWith(readyFor(idx, [QWEN], { version: "0.43.1", python: LINUX_UV, ...CARD }));
+ const g = await gateGeneration(bad.t, run);
+ expect(g.ok).toBe(false);
+ if (!g.ok) {
+ const step = g.plan.steps.find((s) => s.problem === "comfy-043-memfd");
+ expect(step).toMatchObject({ kind: "comfy-update", label: "Update ComfyUI to 0.44.0 or newer" });
+ expect(step?.detail).toMatch(/^ComfyUI 0\.43\.1 stops at the first model on this Linux Python/);
+ expect(step?.commands.bash).toMatch(/git -C .* pull/);
+ }
+ expect(await gateGeneration(bad.t, { ...run, skip: true })).toEqual({ ok: true });
+ const map = await (await badges.GET(req("/api/gpu/badges", { cookie: bad.cookie }))).json();
+ const badge = map.models["oss-qwen-image-21#edit"];
+ expect(badge[0]).toBe("a");
+ const p = await (await plan.GET(req("/api/gpu/plan?ref=model:oss-qwen-image-21%23edit", { cookie: bad.cookie }))).json();
+ expect(readinessLine(badge, p)).toMatchObject({ state: "problem", words: "Your ComfyUI needs an update: 0.44.0 or newer" });
+
+ // The same GPU on ComfyUI 0.44, or with a distro Python: ready, nothing said.
+ for (const s of [readyFor(idx, [QWEN], { version: "0.44.0", python: LINUX_UV, ...CARD }), readyFor(idx, [QWEN], { version: "0.43.1", python: LINUX_DISTRO, ...CARD })]) {
+ const ok = await accountWith(s);
+ expect(await gateGeneration(ok.t, run)).toEqual({ ok: true });
+ }
+ });
+});