The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
fix(create): die Fehlermeldungen nennen die CPU als Ursache
purple4f1b28cb1903
diff --git a/src-tauri/src/commands/process.rs b/src-tauri/src/commands/process.rsindex 06372c2e..b40a4cff 100644--- a/src-tauri/src/commands/process.rs+++ b/src-tauri/src/commands/process.rs@@ -1811,7 +1811,12 @@ pub fn set_comfy_gpu_mode(mode: String, state: State<'_, AppState>) -> Result<sepub fn get_comfy_gpu_status(state: State<'_, AppState>) -> Result<serde_json::Value, String> {let mode = state.comfy_gpu_mode.lock().unwrap().clone();let started_cpu = *state.comfy_started_cpu.lock().unwrap();- Ok(serde_json::json!({ "mode": mode, "startedCpu": started_cpu }))+ // The vendor is what turns "this ran on the processor" into a sentence the+ // user can act on: an AMD card on Linux wants a rebuilt environment, the+ // same card on Windows wants to be told no rebuild can help. Same probe the+ // hardware picker and the installers use.+ let (_, has_amd) = crate::commands::torch_wheels::gpu_vendors_present();+ Ok(serde_json::json!({ "mode": mode, "startedCpu": started_cpu, "hasAmd": has_amd }))}#[tauri::command]diff --git a/src/api/backend.ts b/src/api/backend.tsindex fc5bc4ff..9e715a4d 100644--- a/src/api/backend.ts+++ b/src/api/backend.ts@@ -52,6 +52,15 @@ export function isLinux(): boolean {return (/Linux/.test(plat) || /Linux/.test(ua)) && !/Android/.test(ua);}+/** True on Windows (WebView2 reports "Win32" / "Windows NT"). Same+ * runtime-check rule as isMacOS and isLinux — one dist serves all three. */+export function isWindows(): boolean {+ if (typeof navigator === "undefined") return false;+ const plat = navigator.platform || "";+ const ua = navigator.userAgent || "";+ return /Win/.test(plat) || /Windows NT/.test(ua);+}+/*** Launch policy: the macOS desktop app is now a full local+cloud app like* Windows/Linux (David 2026-07-22 — local mode built + tested). The formerdiff --git a/src/api/vram-handoff.ts b/src/api/vram-handoff.tsindex 0039bb82..79a035a7 100644--- a/src/api/vram-handoff.ts+++ b/src/api/vram-handoff.ts@@ -44,7 +44,7 @@* of call #2 and re-trigger the exact OOM we are avoiding.*/-import { backendCall, ollamaUrl, localFetch, isOllamaLocal } from './backend'+import { backendCall, ollamaUrl, localFetch, isOllamaLocal, isWindows } from './backend'import { listRunningModels, loadModel, unloadModel } from './ollama'import { startBundledEngine } from './engine'import { useSettingsStore } from '../stores/settingsStore'@@ -75,7 +75,7 @@ import {import type { ModelCapabilities } from './comfyui-nodes'import { getActiveAgentModel } from './agent-context'import { comfyWS, CLIENT_ID } from './comfyui-ws'-import { PaceTracker, overBudget, renderBudgetNotice, renderTimeoutNotice, warmupExceeded, swapWarmupNotice, loadPhaseGraceMs, finishGraceMs, warmupBudgetMs, SWAP_WARMUP_BUDGET_MS } from '../lib/render-budget'+import { PaceTracker, overBudget, renderBudgetNotice, renderTimeoutNotice, warmupExceeded, swapWarmupNotice, loadPhaseGraceMs, finishGraceMs, warmupBudgetMs, SWAP_WARMUP_BUDGET_MS, type CpuRenderFacts } from '../lib/render-budget'import { log } from '../lib/logger'/**@@ -1319,6 +1319,32 @@ async function generateVideo(}}+let _cpuRenderFacts: CpuRenderFacts | null = null++/**+ * Which device LU's ComfyUI is actually on, for the failure messages.+ *+ * Asked only when a render is about to fail, so a healthy render never pays for+ * the call. `null` on any error and on the web build, where the notice simply+ * stays as it was. The answer is cached for the watchdogs in useCreate, which+ * fire from a timer and cannot await anything.+ */+export async function cpuRenderFacts(): Promise<CpuRenderFacts | null> {+ try {+ const s = await backendCall<{ startedCpu?: boolean | null; hasAmd?: boolean | null }>('get_comfy_gpu_status')+ if (!s) return null+ _cpuRenderFacts = { startedCpu: s.startedCpu === true, hasAmd: s.hasAmd === true, isWindows: isWindows() }+ return _cpuRenderFacts+ } catch {+ return null+ }+}++/** The last answer `cpuRenderFacts()` got, for callers that cannot await. */+export function lastCpuRenderFacts(): CpuRenderFacts | null {+ return _cpuRenderFacts+}+/*** Poll ComfyUI history until the prompt completes, then build the result string* in the exact legacy shape so ToolCallBlock renders it inline and useAgentChat@@ -1390,7 +1416,7 @@ async function pollAndExtract(promptId: string, prompt: string, kindLabel: strinconst elapsedMs = Date.now() - startedAtlog.warn('vram_handoff.render_timeout_abort', { promptId, budgetMs: timeoutMs, elapsedMs })await abandonPrompt(promptId)- return renderTimeoutNotice(kindLabel, timeoutMs, elapsedMs)+ return renderTimeoutNotice(kindLabel, timeoutMs, elapsedMs, await cpuRenderFacts())}// User hit the in-chat cancel button — ComfyUI was already sent /interrupt// + queue-clear by requestGenerationCancel(); stop polling so runHandoff's@@ -1430,7 +1456,7 @@ async function pollAndExtract(promptId: string, prompt: string, kindLabel: strinif (overBudget(projected, timeoutMs)) {log.warn('vram_handoff.render_budget_abort', { promptId, projectedMs: Math.round(projected!), budgetMs: timeoutMs })await abandonPrompt(promptId)- return renderBudgetNotice(kindLabel, projected!, timeoutMs)+ return renderBudgetNotice(kindLabel, projected!, timeoutMs, await cpuRenderFacts())}const warmupElapsed = Date.now() - startedAtif (!sawAnyProgress && warmupElapsed > SWAP_WARMUP_BUDGET_MS && Date.now() - aliveCheckedAt > 30_000) {@@ -1440,7 +1466,7 @@ async function pollAndExtract(promptId: string, prompt: string, kindLabel: strinif (warmupExceeded(sawAnyProgress, comfyWS.connected, warmupElapsed, warmupBudgetMs(promptAlive))) {log.warn('vram_handoff.swap_warmup_abort', { promptId, elapsedMs: warmupElapsed, promptAlive })await abandonPrompt(promptId)- return swapWarmupNotice(kindLabel, warmupElapsed)+ return swapWarmupNotice(kindLabel, warmupElapsed, await cpuRenderFacts())}}} finally {diff --git a/src/hooks/useCreate.ts b/src/hooks/useCreate.tsindex 5f2458f4..64438bc2 100644--- a/src/hooks/useCreate.ts+++ b/src/hooks/useCreate.ts@@ -32,10 +32,13 @@ import {} from '../api/comfyui'import {comfyErrorHint,+ cpuRenderFacts,+ lastCpuRenderFacts,evictChatBackendsForRender,restoreChatBackendsAfterRender,type RenderEviction,} from '../api/vram-handoff'+import { cpuCauseSuffix } from '../lib/render-budget'import {comfyWS, CLIENT_ID,LOADER_NODES, CLIP_LOADER_NODES, VAE_LOADER_NODES, SAMPLER_NODES, DECODE_NODES,@@ -1040,6 +1043,12 @@ export function useCreate() {}}+ // Ask which device ComfyUI is on while the render is still healthy: both+ // stall watchdogs below fire from a timer and cannot await anything, and+ // a stall message that never names the processor is the reason an AMD+ // customer blames his settings for a hardware switch.+ void cpuRenderFacts()+// Try WebSocket-driven progress, fall back to pollingconst maxTime = mode === 'video' ? 60 * 60 * 1000 : 20 * 60 * 1000let useWS = false@@ -1087,7 +1096,7 @@ export function useCreate() {const timeoutTimer = setInterval(() => {if (Date.now() - lastActivity > maxTime) {cleanup()- reject(new Error(`Generation stalled: no progress from ComfyUI for ${Math.round(maxTime / 60000)} minutes`))+ reject(new Error(`Generation stalled: no progress from ComfyUI for ${Math.round(maxTime / 60000)} minutes.${cpuCauseSuffix(lastCpuRenderFacts())}`))}}, 15000)@@ -1291,7 +1300,7 @@ export function useCreate() {lastActivity = Date.now()} else {if (pollRef.current) clearInterval(pollRef.current)- reject(new Error(`Generation stalled: no progress from ComfyUI for ${Math.round(maxTime / 60000)} minutes`))+ reject(new Error(`Generation stalled: no progress from ComfyUI for ${Math.round(maxTime / 60000)} minutes.${cpuCauseSuffix(lastCpuRenderFacts())}`))return}}diff --git a/src/lib/__tests__/render-budget.test.ts b/src/lib/__tests__/render-budget.test.tsindex b4c9a3ef..5ff2433b 100644--- a/src/lib/__tests__/render-budget.test.ts+++ b/src/lib/__tests__/render-budget.test.ts@@ -28,6 +28,7 @@ import {warmupBudgetMs,LOAD_PHASE_GRACE_CAP_MS,FINISH_GRACE_CAP_MS,+ cpuCauseSuffix,} from '../render-budget'const here = dirname(fileURLToPath(import.meta.url))@@ -310,7 +311,7 @@ describe('wiring in the poll loop', () => {it('Z36 finding 4: a nearly finished render is adopted once, then the job ends', () => {expect(handoff).toContain('finishGraceUsed === 0 ? finishGraceMs(pace.projectedRemainingMs()) : 0')expect(handoff).toContain('finishGraceUsed = grace')- expect(handoff).toContain('renderTimeoutNotice(kindLabel, timeoutMs, elapsedMs)')+ expect(handoff).toContain('renderTimeoutNotice(kindLabel, timeoutMs, elapsedMs,')})it('abandonPrompt kills only OUR job: pending delete first, interrupt only if ours runs', () => {@@ -325,3 +326,97 @@ describe('wiring in the poll loop', () => {expect(handoff).toContain('if (_genCancelRequested) return `${kindLabel} generation cancelled.`')})})++/**+ * Runde 12, Punkt 2. A render that ran on the processor got three different+ * failure messages and not one of them said so: renderBudgetNotice told the+ * customer to use fewer steps, swapWarmupNotice told him to free VRAM on a+ * machine that was not using any, and renderTimeoutNotice said nothing at all.+ * shd_scorpion sent us the screenshot of one of them, and the cause was not in+ * it, so the support answer had to guess.+ */+describe('a render without a GPU says so (Runde 12)', () => {+ const onCpu = { startedCpu: true, hasAmd: false, isWindows: false }+ const amdLinux = { startedCpu: true, hasAmd: true, isWindows: false }+ const amdWindows = { startedCpu: true, hasAmd: true, isWindows: true }++ it('names the processor as the cause, in one shared sentence', () => {+ const s = cpuCauseSuffix(onCpu)+ expect(s).toContain('running on the CPU')+ expect(s).toContain('no supported GPU path is active')+ expect(s).toContain('many times slower')+ })++ it('an AMD card is told the way out its own OS actually has', () => {+ // Linux: LU installs ROCm wheels since 2.6.7, so a rebuild is a real fix.+ expect(cpuCauseSuffix(amdLinux)).toContain('Repair environment')+ // Windows: no rebuild can conjure a wheel, so it must not be offered.+ expect(cpuCauseSuffix(amdWindows)).not.toContain('Repair environment')+ expect(cpuCauseSuffix(amdWindows)).toContain('on Windows')+ })++ it('NEGATIVE CONTROL: says nothing when the render had a GPU or we do not know', () => {+ expect(cpuCauseSuffix({ startedCpu: false, hasAmd: true, isWindows: true })).toBe('')+ expect(cpuCauseSuffix(null)).toBe('')+ expect(cpuCauseSuffix(undefined)).toBe('')+ })++ it('the pace verdict stops blaming the step count for a hardware switch', () => {+ const n = renderBudgetNotice('Image', 40 * 60_000, 10 * 60_000, onCpu)+ expect(n).toContain('running on the CPU')+ // the measured facts are still there, the cause is added, not swapped in+ expect(n).toContain('about 40 minutes')+ expect(n).toContain('10 minute budget')+ // NEGATIVE CONTROL: on a GPU the message is byte for byte what it was+ expect(renderBudgetNotice('Image', 40 * 60_000, 10 * 60_000)).not.toContain('CPU')+ expect(renderBudgetNotice('Image', 40 * 60_000, 10 * 60_000, null))+ .toBe(renderBudgetNotice('Image', 40 * 60_000, 10 * 60_000))+ })++ it('the flat deadline names the cause too', () => {+ const n = renderTimeoutNotice('Video', 20 * 60_000, 30 * 60_000, amdLinux)+ expect(n).toContain('running on the CPU')+ expect(n).toContain('20 minute budget')+ // NEGATIVE CONTROL+ expect(renderTimeoutNotice('Video', 20 * 60_000, 30 * 60_000, null))+ .toBe(renderTimeoutNotice('Video', 20 * 60_000, 30 * 60_000))+ })++ it('the warm-up abort stops advising VRAM on a machine that uses none', () => {+ const n = swapWarmupNotice('Image', 6 * 60_000, onCpu)+ expect(n).not.toContain('VRAM')+ expect(n).not.toContain('GPU is free again')+ expect(n).toContain('running on the CPU')+ expect(n).toContain('6 minutes')+ // NEGATIVE CONTROL: on a real GPU the VRAM advice is correct and stays.+ const gpu = swapWarmupNotice('Image', 6 * 60_000)+ expect(gpu).toContain('Free some VRAM')+ expect(gpu).toContain('loading into VRAM')+ expect(swapWarmupNotice('Image', 6 * 60_000, null)).toBe(gpu)+ })+})++describe('the CPU cause is wired into all five failure exits (Runde 12)', () => {+ const handoff = read('../../api/vram-handoff.ts')+ const create = read('../../hooks/useCreate.ts')+ const process_rs = read('../../../src-tauri/src/commands/process.rs')++ it('the backend hands the frontend the vendor, not just the device', () => {+ expect(process_rs).toContain('"startedCpu": started_cpu, "hasAmd": has_amd')+ })++ it('the three agent-path exits ask before they blame', () => {+ expect(handoff).toContain('renderTimeoutNotice(kindLabel, timeoutMs, elapsedMs, await cpuRenderFacts())')+ expect(handoff).toContain('renderBudgetNotice(kindLabel, projected!, timeoutMs, await cpuRenderFacts())')+ expect(handoff).toContain('swapWarmupNotice(kindLabel, warmupElapsed, await cpuRenderFacts())')+ // asked only on the way out, so a healthy render pays nothing for it+ expect(handoff.match(/await cpuRenderFacts\(\)/g)?.length).toBe(3)+ })++ it('both Create stall watchdogs carry it too', () => {+ // They fire from a timer and cannot await, so the answer is fetched when+ // the render starts and read from the cache here.+ expect(create).toContain('void cpuRenderFacts()')+ expect(create.match(/cpuCauseSuffix\(lastCpuRenderFacts\(\)\)/g)?.length).toBe(2)+ })+})diff --git a/src/lib/render-budget.ts b/src/lib/render-budget.tsindex 95237105..23440db0 100644--- a/src/lib/render-budget.ts+++ b/src/lib/render-budget.ts@@ -117,10 +117,53 @@ export function warmupBudgetMs(promptConfirmedAlive: boolean): number {return promptConfirmedAlive ? SWAP_WARMUP_ALIVE_BUDGET_MS : SWAP_WARMUP_BUDGET_MS}+/**+ * What LU knows about the device this render actually used.+ *+ * `startedCpu` is true only when LU itself started ComfyUI with `--cpu` this+ * session, which is the one case where we can say the cause instead of guessing+ * at it. Read from `get_comfy_gpu_status`.+ */+export interface CpuRenderFacts {+ startedCpu: boolean+ hasAmd: boolean+ isWindows: boolean+}++/**+ * The sentence every render failure gets when the render never had a GPU.+ *+ * The three notices below all used to blame the user's settings or the VRAM,+ * because none of them knew about the device: `renderBudgetNotice` told an AMD+ * customer to use fewer steps while the real answer was that his card was never+ * in play, and `swapWarmupNotice` told him to free VRAM on a machine that was+ * not using any. Empty string whenever we do not know, so nothing is claimed+ * that was not measured.+ */+export function cpuCauseSuffix(facts: CpuRenderFacts | null | undefined): string {+ if (!facts?.startedCpu) return ''+ const head = 'Image generation is running on the CPU because no supported GPU path is active, so it is many times slower than it would be on a card.'+ if (facts.hasAmd && facts.isWindows) {+ return ` ${head} Your card is AMD and LU could not install a PyTorch that drives it on Windows.`+ }+ if (facts.hasAmd) {+ return ` ${head} Your card is AMD and the PyTorch in this ComfyUI environment cannot reach it. Rebuild it from Settings, ComfyUI, Repair environment.`+ }+ return ` ${head}`+}+/** Tool result for a warm-up abort. Says what was observed, not a guess. */-export function swapWarmupNotice(kindLabel: string, elapsedMs: number): string {+export function swapWarmupNotice(kindLabel: string, elapsedMs: number, cpu?: CpuRenderFacts | null): string {const m = Math.max(1, Math.round(elapsedMs / 60_000))- return `${kindLabel} generation stopped: after ${m} minute${m === 1 ? '' : 's'} the model was still loading into VRAM and sampling never started. The job was cancelled so the GPU is free again. Free some VRAM (close other GPU apps, or set VRAM hand-off to "always" in Settings so the chat model is evicted first), or pick a smaller model.`+ const minutes = `${m} minute${m === 1 ? '' : 's'}`+ if (cpu?.startedCpu) {+ // Neither half of the normal message is true here: nothing was loading into+ // VRAM, no GPU was freed by the cancel, and freeing VRAM cannot help. A big+ // checkpoint crawling into system RAM on the processor overruns this budget+ // on its own.+ return `${kindLabel} generation stopped: after ${minutes} the model was still loading and sampling never started. The job was cancelled.${cpuCauseSuffix(cpu)} Pick a smaller model.`+ }+ return `${kindLabel} generation stopped: after ${minutes} the model was still loading into VRAM and sampling never started. The job was cancelled so the GPU is free again. Free some VRAM (close other GPU apps, or set VRAM hand-off to "always" in Settings so the chat model is evicted first), or pick a smaller model.`}/**@@ -192,10 +235,13 @@ export function finishGraceMs(const advice = 'Try fewer frames, a smaller resolution or fewer steps, or pick a lighter model. The generation timeout is adjustable in Settings.'/** Tool result for a pace-based early stop. Honest about what was measured. */-export function renderBudgetNotice(kindLabel: string, projectedMs: number, budgetMs: number): string {+export function renderBudgetNotice(kindLabel: string, projectedMs: number, budgetMs: number, cpu?: CpuRenderFacts | null): string {const p = Math.max(1, Math.round(projectedMs / 60_000))const b = Math.max(1, Math.round(budgetMs / 60_000))- return `${kindLabel} generation stopped early: at the measured pace this render needs about ${p} minutes, more than the ${b} minute budget. The job was cancelled so the GPU is free again. ${advice}`+ // This is the exit a processor render reaches FIRST: the sampler ticks do+ // arrive, just twenty times too slowly, so without the suffix the message+ // blames the user's step count for the hardware switch.+ return `${kindLabel} generation stopped early: at the measured pace this render needs about ${p} minutes, more than the ${b} minute budget. The job was cancelled so the GPU is free again.${cpuCauseSuffix(cpu)} ${advice}`}/**@@ -203,11 +249,11 @@ export function renderBudgetNotice(kindLabel: string, projectedMs: number, budge* the wait outlasted the budget because the checkpoint had to load first, say* so instead of reporting a budget the run visibly overran.*/-export function renderTimeoutNotice(kindLabel: string, budgetMs: number, elapsedMs?: number): string {+export function renderTimeoutNotice(kindLabel: string, budgetMs: number, elapsedMs?: number, cpu?: CpuRenderFacts | null): string {const b = Math.max(1, Math.round(budgetMs / 60_000))const e = typeof elapsedMs === 'number' && Number.isFinite(elapsedMs) ? Math.max(1, Math.round(elapsedMs / 60_000)) : nullconst spent = e !== null && e > b? ` It ran for about ${e} minutes: the ${b} minute budget plus the time the model spent loading.`: ''- return `${kindLabel} generation hit the ${b} minute budget and was cancelled so the GPU is free again.${spent} ${advice}`+ return `${kindLabel} generation hit the ${b} minute budget and was cancelled so the GPU is free again.${spent}${cpuCauseSuffix(cpu)} ${advice}`}