Skip to content

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.

fix(create): auch die Render-Meldungen nennen Force CPU beim Namen

purplea2cfd7f5eabe
diff --git a/src/api/vram-handoff.ts b/src/api/vram-handoff.ts
index 040815b2..2f3e8ca9 100644
--- a/src/api/vram-handoff.ts
+++ b/src/api/vram-handoff.ts
@@ -76,6 +76,7 @@ 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, type CpuRenderFacts } from '../lib/render-budget'
+import { asComfyGpuMode } from '../lib/comfy-cpu-banner'
import { log } from '../lib/logger'
/**
@@ -1331,9 +1332,13 @@ let _cpuRenderFacts: CpuRenderFacts | null = null
*/
export async function cpuRenderFacts(): Promise<CpuRenderFacts | null> {
try {
- const s = await backendCall<{ startedCpu?: boolean | null; hasAmd?: boolean | null }>('get_comfy_gpu_status')
+ const s = await backendCall<{ startedCpu?: boolean | null; mode?: string | null; hasAmd?: boolean | null }>('get_comfy_gpu_status')
if (!s) return null
- _cpuRenderFacts = { startedCpu: s.startedCpu === true, hasAmd: s.hasAmd === true, isWindows: isWindows() }
+ // `mode` rides along since round 14: the notices used to report a missing
+ // GPU path to a user who had picked Force CPU himself. Same reply, same
+ // normaliser the Create tab's banner uses, so an unknown or absent value
+ // reads as 'auto' and can never claim a press that never happened.
+ _cpuRenderFacts = { startedCpu: s.startedCpu === true, mode: asComfyGpuMode(s.mode), hasAmd: s.hasAmd === true, isWindows: isWindows() }
return _cpuRenderFacts
} catch {
return null
diff --git a/src/lib/__tests__/render-budget.test.ts b/src/lib/__tests__/render-budget.test.ts
index 5ff2433b..153bf07b 100644
--- a/src/lib/__tests__/render-budget.test.ts
+++ b/src/lib/__tests__/render-budget.test.ts
@@ -336,9 +336,12 @@ describe('wiring in the poll loop', () => {
* 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 }
+ // `mode: 'auto'` is what these three cases really were: LU fell back to the
+ // processor on its own. Round 14 added the field because the same notices
+ // were reporting that fallback to a user who had picked Force CPU himself.
+ const onCpu = { startedCpu: true, mode: 'auto', hasAmd: false, isWindows: false } as const
+ const amdLinux = { startedCpu: true, mode: 'auto', hasAmd: true, isWindows: false } as const
+ const amdWindows = { startedCpu: true, mode: 'auto', hasAmd: true, isWindows: true } as const
it('names the processor as the cause, in one shared sentence', () => {
const s = cpuCauseSuffix(onCpu)
@@ -356,7 +359,10 @@ describe('a render without a GPU says so (Runde 12)', () => {
})
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({ startedCpu: false, mode: 'auto', hasAmd: true, isWindows: true })).toBe('')
+ // and a Force CPU pick that LU has not (re)started ComfyUI under yet is
+ // still no render on the processor, so still nothing to say
+ expect(cpuCauseSuffix({ startedCpu: false, mode: 'cpu', hasAmd: false, isWindows: true })).toBe('')
expect(cpuCauseSuffix(null)).toBe('')
expect(cpuCauseSuffix(undefined)).toBe('')
})
diff --git a/src/lib/__tests__/render-notice-names-force-cpu.test.ts b/src/lib/__tests__/render-notice-names-force-cpu.test.ts
new file mode 100644
index 00000000..2fb65019
--- /dev/null
+++ b/src/lib/__tests__/render-notice-names-force-cpu.test.ts
@@ -0,0 +1,152 @@
+/**
+ * The last surface carrying the wrong reason from Nebenbefund 1 of the R12/R13
+ * re-measure (2026-08-30, ergebnis-r1213-nachmessung.md).
+ *
+ * Round 14 fixed the Create tab's yellow banner: it had been telling a user
+ * with a working, correctly detected RTX 3060 that no usable GPU was found,
+ * when he had picked Force CPU himself in Settings, Hardware, ComfyUI GPU.
+ *
+ * The three render failure notices in lib/render-budget.ts said the same thing
+ * in their own words, through the sentence they share:
+ *
+ * "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."
+ *
+ * That is a fault report, and this user has no fault. `CpuRenderFacts` simply
+ * did not carry `mode`, although `get_comfy_gpu_status` has returned it all
+ * along and vram-handoff was already reading that very reply. It carries it
+ * now, as a REQUIRED field, so no construction site can quietly skip the
+ * question, and the Force CPU wording is the banner's own two constants rather
+ * than a second copy that can drift.
+ *
+ * Run: npx vitest run src/lib/__tests__/render-notice-names-force-cpu.test.ts
+ */
+import { describe, it, expect } from 'vitest'
+import { readFileSync } from 'node:fs'
+import { fileURLToPath } from 'node:url'
+import { dirname, resolve } from 'node:path'
+
+import {
+ cpuCauseSuffix,
+ renderBudgetNotice,
+ renderTimeoutNotice,
+ swapWarmupNotice,
+ type CpuRenderFacts,
+} from '../render-budget'
+import { FORCE_CPU_REASON, FORCE_CPU_WAY_BACK, comfyCpuBannerText } from '../comfy-cpu-banner'
+
+const here = dirname(fileURLToPath(import.meta.url))
+const repo = resolve(here, '../../..')
+const read = (rel: string) => readFileSync(resolve(repo, rel), 'utf8')
+
+/** The measured box: one working NVIDIA card, no AMD, Windows, Force CPU set. */
+const FORCED: CpuRenderFacts = { startedCpu: true, mode: 'cpu', hasAmd: false, isWindows: true }
+/** The same box before the user touched the switch: LU fell back on its own. */
+const FELL_BACK: CpuRenderFacts = { ...FORCED, mode: 'auto' }
+
+describe('THE FIX: the render notices name the press, not a missing GPU path', () => {
+ it('a forced CPU render is told it was forced', () => {
+ const s = cpuCauseSuffix(FORCED)
+ expect(s).toContain(FORCE_CPU_REASON)
+ expect(s).toContain('many times slower')
+ // the fault report the box disproved
+ expect(s).not.toContain('no supported GPU path is active')
+ })
+
+ it('and it names the way back, the same way the banner does', () => {
+ expect(cpuCauseSuffix(FORCED)).toContain(FORCE_CPU_WAY_BACK)
+ })
+
+ it('all three notices carry it, because all three share the sentence', () => {
+ const pace = renderBudgetNotice('Image', 40 * 60_000, 10 * 60_000, FORCED)
+ const flat = renderTimeoutNotice('Image', 10 * 60_000, 14 * 60_000, FORCED)
+ const warm = swapWarmupNotice('Image', 6 * 60_000, FORCED)
+ for (const n of [pace, flat, warm]) {
+ expect(n).toContain(FORCE_CPU_REASON)
+ expect(n).not.toContain('no supported GPU path is active')
+ }
+ })
+
+ it('no AMD fault report reaches a user who chose the processor himself', () => {
+ // He did not hit a driver problem. Telling him LU could not install a
+ // PyTorch that drives his card sends him after a fault that is not there.
+ const amdWin = cpuCauseSuffix({ startedCpu: true, mode: 'cpu', hasAmd: true, isWindows: true })
+ const amdLinux = cpuCauseSuffix({ startedCpu: true, mode: 'cpu', hasAmd: true, isWindows: false })
+ for (const s of [amdWin, amdLinux]) {
+ expect(s).toContain(FORCE_CPU_REASON)
+ expect(s).not.toContain('AMD')
+ expect(s).not.toContain('Repair environment')
+ }
+ })
+
+ it('the banner and the notices say it in the same words, from one source', () => {
+ const banner = comfyCpuBannerText({ startedCpu: true, mode: 'cpu', hasAmd: false, isLinux: false })
+ expect(banner).toContain(FORCE_CPU_REASON)
+ expect(banner).toContain(FORCE_CPU_WAY_BACK)
+ // and the notice file borrows them rather than restating them
+ const budget = read('src/lib/render-budget.ts')
+ expect(budget).toMatch(/import \{ FORCE_CPU_REASON, FORCE_CPU_WAY_BACK, type ComfyGpuModeName \} from '\.\/comfy-cpu-banner'/)
+ expect(budget).not.toMatch(/Settings → Hardware → ComfyUI GPU back to Auto/)
+ })
+
+ it('the wiring: mode is read off the reply that always carried it', () => {
+ const handoff = read('src/api/vram-handoff.ts')
+ expect(handoff).toMatch(/mode: asComfyGpuMode\(s\.mode\)/)
+ expect(handoff).toMatch(/backendCall<\{ startedCpu\?: boolean \| null; mode\?: string \| null; hasAmd\?: boolean \| null \}>\('get_comfy_gpu_status'\)/)
+ const rust = read('src-tauri/src/commands/process.rs')
+ expect(rust).toMatch(/"mode": mode, "startedCpu": started_cpu, "hasAmd": has_amd/)
+ })
+
+ it('mode is required, so a new call site has to answer the question', () => {
+ const budget = read('src/lib/render-budget.ts')
+ expect(budget).toMatch(/export interface CpuRenderFacts \{\s*\n\s*startedCpu: boolean\s*\n\s*mode: ComfyGpuModeName/)
+ })
+})
+
+describe('NEGATIVE CONTROL: everything round 12 settled about these notices', () => {
+ it('a plain fallback to the processor keeps its sentence word for word', () => {
+ expect(cpuCauseSuffix(FELL_BACK)).toBe(
+ ' 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.',
+ )
+ })
+
+ it('an AMD card that fell back is still told the way out its own OS has', () => {
+ const linux = cpuCauseSuffix({ startedCpu: true, mode: 'auto', hasAmd: true, isWindows: false })
+ const win = cpuCauseSuffix({ startedCpu: true, mode: 'auto', hasAmd: true, isWindows: true })
+ expect(linux).toContain('Repair environment')
+ expect(win).not.toContain('Repair environment')
+ expect(win).toContain('on Windows')
+ })
+
+ it('a Force GPU pick is not a Force CPU pick', () => {
+ // If ComfyUI ended up on the processor anyway, that IS the fault report
+ // case, and this user gets it unchanged.
+ expect(cpuCauseSuffix({ ...FORCED, mode: 'gpu' })).toContain('no supported GPU path is active')
+ })
+
+ it('nothing is claimed when the render had a GPU or we do not know', () => {
+ expect(cpuCauseSuffix({ ...FORCED, startedCpu: false })).toBe('')
+ expect(cpuCauseSuffix(null)).toBe('')
+ expect(cpuCauseSuffix(undefined)).toBe('')
+ })
+
+ it('the notices around the sentence are untouched', () => {
+ // The advice, the budget arithmetic and the warm-up split all predate this.
+ const pace = renderBudgetNotice('Image', 40 * 60_000, 10 * 60_000, FORCED)
+ expect(pace).toContain('needs about 40 minutes, more than the 10 minute budget')
+ expect(pace).toContain('Try fewer frames, a smaller resolution or fewer steps')
+ const warm = swapWarmupNotice('Image', 6 * 60_000, FORCED)
+ expect(warm).toContain('the model was still loading and sampling never started')
+ expect(warm).not.toContain('Free some VRAM')
+ // and a render that DID have a GPU still gets the VRAM advice
+ expect(swapWarmupNotice('Image', 6 * 60_000, null)).toContain('Free some VRAM')
+ })
+
+ it('no em dash in the new copy', () => {
+ const budget = read('src/lib/render-budget.ts')
+ const i = budget.indexOf('Round 14 closed the last wrong reason')
+ expect(i).toBeGreaterThan(-1)
+ expect(budget.slice(i, budget.indexOf('export function cpuCauseSuffix', i))).not.toMatch(/[–—]/)
+ expect(read('src/lib/comfy-cpu-banner.ts')).not.toMatch(/[–—]/)
+ })
+})
diff --git a/src/lib/comfy-cpu-banner.ts b/src/lib/comfy-cpu-banner.ts
index 54156ec6..af20c570 100644
--- a/src/lib/comfy-cpu-banner.ts
+++ b/src/lib/comfy-cpu-banner.ts
@@ -67,6 +67,20 @@ export function amdCpuAdvice(isLinux: boolean): string {
/** The slowness warning both honest variants share, word for word. */
const SLOW = 'Generation will be extremely slow and may time out.'
+/**
+ * Why the processor is in play when the user asked for it.
+ *
+ * Exported because the Create tab's banner is not the only surface that had the
+ * wrong reason in it: the render failure notices in lib/render-budget.ts said
+ * "because no supported GPU path is active" for the same press. One wording,
+ * one place, so the two cannot drift apart.
+ */
+export const FORCE_CPU_REASON = 'you selected Force CPU'
+
+/** ... and the way back out of it, likewise said once. */
+export const FORCE_CPU_WAY_BACK =
+ 'Set Settings → Hardware → ComfyUI GPU back to Auto and restart ComfyUI from Settings → AI Backends to use your card again.'
+
/**
* The whole banner text, or '' when there is no banner to draw.
*
@@ -80,7 +94,7 @@ export function comfyCpuBannerText(facts: ComfyCpuBannerFacts | null | undefined
// broken, and the AMD route is beside the point: the way out is the
// switch he set himself, so that is the only thing worth naming.
if (facts.mode === 'cpu') {
- return `ComfyUI is running on the CPU because you selected Force CPU. ${SLOW} Set Settings → Hardware → ComfyUI GPU back to Auto and restart ComfyUI from Settings → AI Backends to use your card again.`
+ return `ComfyUI is running on the CPU because ${FORCE_CPU_REASON}. ${SLOW} ${FORCE_CPU_WAY_BACK}`
}
// 2. and 3. LU fell back to the processor on its own, so the old sentence is
diff --git a/src/lib/render-budget.ts b/src/lib/render-budget.ts
index 23440db0..df659bce 100644
--- a/src/lib/render-budget.ts
+++ b/src/lib/render-budget.ts
@@ -11,6 +11,8 @@
* the GPU stops burning (the timeout used to orphan it).
*/
+import { FORCE_CPU_REASON, FORCE_CPU_WAY_BACK, type ComfyGpuModeName } from './comfy-cpu-banner'
+
/** Sampler steps observed before we trust the pace. */
export const MIN_STEPS_FOR_VERDICT = 3
@@ -123,9 +125,15 @@ export function warmupBudgetMs(promptConfirmedAlive: boolean): number {
* `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`.
+ *
+ * `mode` is the user's own ComfyUI GPU pick from the same reply, required
+ * rather than optional so no construction site can forget to ask: without it
+ * these notices told a user who had chosen Force CPU that no supported GPU path
+ * was active, which is a fault report about a machine that had none.
*/
export interface CpuRenderFacts {
startedCpu: boolean
+ mode: ComfyGpuModeName
hasAmd: boolean
isWindows: boolean
}
@@ -139,9 +147,21 @@ export interface CpuRenderFacts {
* 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.
+ *
+ * Round 14 closed the last wrong reason in it. Nebenbefund 1 of the R12/R13
+ * re-measure caught the Create tab's banner claiming no usable GPU had been
+ * found on a box with a working, correctly detected RTX 3060, where the user
+ * had picked Force CPU himself. These three notices carried the same claim in
+ * their own words, so they get the same answer, out of the same two constants:
+ * the reason he can act on is the switch he set, and no fault report goes with
+ * it. The AMD paragraph is skipped there for the reason it always had, that it
+ * describes a driver problem, and this user does not have one.
*/
export function cpuCauseSuffix(facts: CpuRenderFacts | null | undefined): string {
if (!facts?.startedCpu) return ''
+ if (facts.mode === 'cpu') {
+ return ` Image generation is running on the CPU because ${FORCE_CPU_REASON}, so it is many times slower than it would be on a card. ${FORCE_CPU_WAY_BACK}`
+ }
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.`