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.

feat(create): der Leerlauf-Ausfall von ComfyUI wird gesagt, statt 180 s geschwiegen

purpleeb73b12d46eb
diff --git a/src/components/create/experimental/CreateExperimental.tsx b/src/components/create/experimental/CreateExperimental.tsx
index d9f2a278..fe6fba3c 100644
--- a/src/components/create/experimental/CreateExperimental.tsx
+++ b/src/components/create/experimental/CreateExperimental.tsx
@@ -5,6 +5,8 @@ import { useCreateStore, type GalleryItem } from '../../../stores/createStore'
import { useCloudNoticeStore, CLOUD_RETENTION_DAYS, shouldShowRetentionNotice } from '../../../stores/cloudNoticeStore'
import { useComfyNoticeStore } from '../../../stores/comfyNoticeStore'
import { loadComfyCorsSignature, shouldShowCorsNotice } from '../../../lib/comfy-cors-notice'
+import { comfyIdleNotice, shouldWatchComfyIdle, IDLE_WATCH_INTERVAL_MS } from '../../../lib/comfy-idle-watch'
+import type { ComfyGuardStatus } from '../../../lib/comfy-restart-guard'
import { useWorkflowStore } from '../../../stores/workflowStore'
import { CreateExpProvider, useCreateExp } from './CreateContext'
import { IntentBar } from './IntentBar'
@@ -85,6 +87,36 @@ function CreateExperimentalInner() {
return () => { cancelled = true }
}, [backend, connected, adoptCorsSignature])
+ // R18 Befund 2 (2026-08-30, Windows box): ComfyUI was killed while the app
+ // sat idle on this tab and the Create surface said NOTHING for 180 seconds.
+ // `connected` is probed once on mount and never again, so a death nobody
+ // asked about produced no error to show. The next render heals it (R16
+ // Befund 5, comfy-restart-guard) — the user just had no way to know that.
+ //
+ // A glance every 30s while this tab is open and idle, no restart of its own:
+ // holding an engine warm for work nobody asked for costs RAM and VRAM, and
+ // the render path already fixes it on demand. Wording in lib/comfy-idle-watch.
+ const [idleNotice, setIdleNotice] = useState('')
+ const idleTimerRef = useRef<(() => void) | null>(null)
+ useEffect(() => {
+ let cancelled = false
+ const clear = () => { if (!cancelled) setIdleNotice('') }
+ void (async () => {
+ const { isMacOS } = await import('../../../api/backend')
+ if (cancelled) return
+ if (!shouldWatchComfyIdle(backend === 'local', isMacOS(), isGenerating)) { clear(); return }
+ const { backendCall } = await import('../../../api/backend')
+ const look = async () => {
+ const st = await backendCall<ComfyGuardStatus>('comfyui_status').catch(() => null)
+ if (!cancelled) setIdleNotice(comfyIdleNotice(st))
+ }
+ await look()
+ const timer = setInterval(() => { void look() }, IDLE_WATCH_INTERVAL_MS)
+ idleTimerRef.current = () => clearInterval(timer)
+ })()
+ return () => { cancelled = true; idleTimerRef.current?.(); idleTimerRef.current = null }
+ }, [backend, isGenerating])
+
const fixCorsForMe = useCallback(async () => {
setCorsFixing(true)
setCorsFixError(null)
@@ -203,6 +235,17 @@ function CreateExperimentalInner() {
</div>
)}
+ {/* Idle outage (R18 Befund 2): ComfyUI died while nobody was rendering
+ and the tab said nothing about it for 180 seconds. One quiet line,
+ no button: the render path restarts it and this says so. Nothing is
+ started from here — see lib/comfy-idle-watch.ts for why. */}
+ {idleNotice && (
+ <div className="flex items-center gap-2 px-4 py-2 bg-yellow-500/5 border-b border-yellow-500/10 text-yellow-300 text-xs shrink-0">
+ <AlertTriangle size={12} className="shrink-0" />
+ <span className="flex-1 min-w-0">{idleNotice}</span>
+ </div>
+ )}
+
{/* Cross-origin block (#75, cinemazverev): a user-managed ComfyUI 0.19+
answers the WebView's media/WS requests with a Sec-Fetch 403, so results
couldn't be viewed. LU proxies the bytes so they still display, but the
diff --git a/src/lib/__tests__/comfy-idle-watch.test.ts b/src/lib/__tests__/comfy-idle-watch.test.ts
new file mode 100644
index 00000000..510629e0
--- /dev/null
+++ b/src/lib/__tests__/comfy-idle-watch.test.ts
@@ -0,0 +1,100 @@
+import { describe, it, expect } from 'vitest'
+import { readFileSync } from 'fs'
+import { join } from 'path'
+import {
+ comfyIdleNotice,
+ shouldWatchComfyIdle,
+ IDLE_WATCH_INTERVAL_MS,
+ IDLE_STOPPED_MANAGED,
+ IDLE_STOPPED_REMOTE,
+ IDLE_STOPPED_UNUSABLE,
+ IDLE_STARTING,
+} from '../comfy-idle-watch'
+
+const MANAGED_UP = { running: true, starting: false, isLocal: true, found: true, complete: true }
+const MANAGED_DOWN = { running: false, starting: false, isLocal: true, found: true, complete: true }
+const REMOTE_DOWN = { running: false, starting: false, isLocal: false, found: false, complete: false }
+const CARCASS_DOWN = { running: false, starting: false, isLocal: true, found: true, complete: false }
+
+describe('shouldWatchComfyIdle', () => {
+ it('watches while the local Create tab sits idle', () => {
+ expect(shouldWatchComfyIdle(true, false, false)).toBe(true)
+ })
+
+ it('does not watch on cloud, on a Mac, or during a render', () => {
+ expect(shouldWatchComfyIdle(false, false, false)).toBe(false)
+ expect(shouldWatchComfyIdle(true, true, false)).toBe(false)
+ expect(shouldWatchComfyIdle(true, false, true)).toBe(false)
+ })
+
+ it('asks rarely enough not to be a poller on port 8188', () => {
+ expect(IDLE_WATCH_INTERVAL_MS).toBeGreaterThanOrEqual(30_000)
+ })
+})
+
+describe('comfyIdleNotice', () => {
+ /**
+ * DER BEFUND SELBST (R18 Befund 2, Windows box): ComfyUI stirbt im Leerlauf,
+ * der Create-Tab schweigt 180 Sekunden.
+ *
+ * Rueckwaerts gefahrene Negativkontrolle: der Zustand VOR dieser Runde ist
+ * genau "es gibt keinen Satz", also der leere String. Der Test haelt fest,
+ * dass die tote, verwaltete Engine jetzt einen Satz hat und dass dieser Satz
+ * sagt, was als naechstes passiert.
+ */
+ it('THE FINDING: a managed ComfyUI that died idle gets a sentence, not silence', () => {
+ const said = comfyIdleNotice(MANAGED_DOWN)
+ expect(said).not.toBe('')
+ expect(said).toBe(IDLE_STOPPED_MANAGED)
+ expect(said).toMatch(/next render/)
+ })
+
+ it('says nothing while ComfyUI is answering', () => {
+ expect(comfyIdleNotice(MANAGED_UP)).toBe('')
+ })
+
+ it('says nothing about a state it does not know', () => {
+ expect(comfyIdleNotice(null)).toBe('')
+ })
+
+ it('names a start in progress instead of crying outage', () => {
+ expect(comfyIdleNotice({ ...MANAGED_DOWN, starting: true })).toBe(IDLE_STARTING)
+ })
+
+ it('never promises a restart LU cannot deliver', () => {
+ expect(comfyIdleNotice(REMOTE_DOWN)).toBe(IDLE_STOPPED_REMOTE)
+ expect(comfyIdleNotice(REMOTE_DOWN)).not.toMatch(/next render/)
+ expect(comfyIdleNotice(CARCASS_DOWN)).toBe(IDLE_STOPPED_UNUSABLE)
+ expect(comfyIdleNotice(CARCASS_DOWN)).not.toMatch(/next render/)
+ })
+
+ it('keeps every line in English, per the house rule', () => {
+ for (const line of [IDLE_STOPPED_MANAGED, IDLE_STOPPED_REMOTE, IDLE_STOPPED_UNUSABLE, IDLE_STARTING]) {
+ expect(line).not.toMatch(/[äöüßÄÖÜ]/)
+ expect(line).not.toMatch(/—|–/)
+ }
+ })
+})
+
+describe('the Create tab actually watches and shows it', () => {
+ const src = readFileSync(
+ join(__dirname, '../../components/create/experimental/CreateExperimental.tsx'),
+ 'utf-8',
+ )
+
+ it('polls comfyui_status only while idle, and renders the line', () => {
+ expect(src).toMatch(/shouldWatchComfyIdle\(backend === 'local', isMacOS\(\), isGenerating\)/)
+ expect(src).toMatch(/backendCall<ComfyGuardStatus>\('comfyui_status'\)/)
+ expect(src).toMatch(/setIdleNotice\(comfyIdleNotice\(st\)\)/)
+ expect(src).toMatch(/\{idleNotice && \(/)
+ })
+
+ it('starts nothing on its own from the idle watch', () => {
+ const watch = src.slice(src.indexOf('R18 Befund 2'), src.indexOf('const fixCorsForMe'))
+ expect(watch).not.toMatch(/start_comfyui|ensureComfyForRender|restartComfy/)
+ })
+
+ it('clears the interval when the tab goes away', () => {
+ expect(src).toMatch(/idleTimerRef\.current\?\.\(\)/)
+ })
+})
diff --git a/src/lib/comfy-idle-watch.ts b/src/lib/comfy-idle-watch.ts
new file mode 100644
index 00000000..d176ee38
--- /dev/null
+++ b/src/lib/comfy-idle-watch.ts
@@ -0,0 +1,87 @@
+/**
+ * Was der Create-Tab sagt, wenn ComfyUI im Leerlauf wegstirbt.
+ *
+ * R18 Befund 2, gemessen am echten 2.6.7 Windows Build (2026-08-30): ComfyUI
+ * wurde beendet, waehrend die App offen im Leerlauf stand. Der Create-Tab zeigte
+ * 180 Sekunden lang NICHTS. Kein Wort, kein Hinweis, die Oberflaeche sah aus wie
+ * immer. Erst der naechste Render heilte die Lage, und das tut er zuverlaessig
+ * (comfy-restart-guard.ts, R16 Befund 5). Nur weiss der Nutzer davon nichts,
+ * solange er nicht auf Create drueckt.
+ *
+ * Der Grund ist gutartig: `connected` wird beim Mount des Tabs einmal geprueft
+ * und danach nie wieder, weil nichts im Leerlauf fragt. Kein Fehler entsteht,
+ * also erscheint auch keiner.
+ *
+ * Was diese Datei tut, und was ausdruecklich NICHT:
+ *
+ * - Sie sagt Bescheid. Ruhig, in einem Satz, mit dem was als naechstes
+ * passiert.
+ * - Sie startet NICHTS neu. Ein Neustart im Leerlauf kostet RAM und VRAM fuer
+ * eine Arbeit, die niemand angefordert hat, und der Render-Pfad heilt
+ * bewiesenermassen von selbst. Selbstheilung heisst nicht Vorratsheilung.
+ * - Sie fragt selten. Ein Blick alle 30 Sekunden auf `comfyui_status`, und nur
+ * solange der Create-Tab offen ist und nichts rendert. Kein Dauerfeuer auf
+ * Port 8188.
+ *
+ * Jede Zeile darf nur behaupten, was in ihrer Lage auch stimmt. Der Satz "It
+ * will restart with your next render" gilt genau dann, wenn der Render-Pfad das
+ * wirklich tun wird, also bei einem ComfyUI, das LU verwalten darf. Bei einem
+ * fremden oder entfernten sagt LU stattdessen, dass es nicht seine Sache ist,
+ * statt eine Rettung zu versprechen, die nicht kommt.
+ */
+
+import { comfyIsManaged, type ComfyGuardStatus } from './comfy-restart-guard'
+
+/**
+ * Abstand zwischen zwei Blicken.
+ *
+ * Grosszuegig mit Absicht: hier wird nichts gemessen und nichts gewartet, hier
+ * wird nur ein stiller Ausfall bemerkt. Eine halbe Minute Verzug gegen 180
+ * Sekunden Schweigen ist der ganze Handel.
+ */
+export const IDLE_WATCH_INTERVAL_MS = 30_000
+
+/** Der Satz fuer ein ComfyUI, das LU beim naechsten Render selbst hochholt. */
+export const IDLE_STOPPED_MANAGED = 'ComfyUI stopped. It will restart with your next render.'
+
+/** Ein ComfyUI auf einer anderen Maschine. LU kann es von hier nicht starten. */
+export const IDLE_STOPPED_REMOTE =
+ 'ComfyUI is not answering. It runs on another machine, so it has to be started there.'
+
+/** Lokal, aber es gibt keine brauchbare Installation zum Starten (GH #98). */
+export const IDLE_STOPPED_UNUSABLE =
+ 'ComfyUI is not running, and LU found no working install to start. See Settings, AI Backends.'
+
+/** Es kommt gerade hoch. Kein Alarm, nur die Lage. */
+export const IDLE_STARTING = 'ComfyUI is starting up.'
+
+/**
+ * Lohnt sich der Blick ueberhaupt.
+ *
+ * `local` der Create-Tab rendert lokal. Ein Cloud-Job kommt an das
+ * lokale ComfyUI nie heran, dort waere der Hinweis eine Luege.
+ * `isMac` auf dem Mac laeuft ComfyUI nie (Hausregel MLX only), es gibt
+ * also nichts, dessen Ausfall zu melden waere.
+ * `isGenerating` waehrend eines Renders erzaehlt der Fortschritt die Lage, und
+ * der Render-Pfad heilt sie ohnehin. Der Leerlaufwaechter hat
+ * dort nichts zu suchen und wuerde nur doppelt reden.
+ */
+export function shouldWatchComfyIdle(local: boolean, isMac: boolean, isGenerating: boolean): boolean {
+ return local && !isMac && !isGenerating
+}
+
+/**
+ * Der Satz zur Lage, oder '' wenn es nichts zu sagen gibt.
+ *
+ * `null` ist ausdruecklich still: das Kommando kann fehlen (Web-Build) oder das
+ * Backend gerade nicht antworten. Ueber einen Zustand, den LU nicht kennt, sagt
+ * LU nichts.
+ */
+export function comfyIdleNotice(status: ComfyGuardStatus | null): string {
+ if (!status) return ''
+ if (status.running === true) return ''
+ if (status.starting === true) return IDLE_STARTING
+ if (comfyIsManaged(status)) return IDLE_STOPPED_MANAGED
+ if (status.isLocal === false) return IDLE_STOPPED_REMOTE
+ return IDLE_STOPPED_UNUSABLE
+}