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): the heal keeps the real reason and gets the time it needs
David41ff28e8fd4d
diff --git a/src/components/create/experimental/CreateContext.tsx b/src/components/create/experimental/CreateContext.tsxindex 9490dd80..566fc516 100644--- a/src/components/create/experimental/CreateContext.tsx+++ b/src/components/create/experimental/CreateContext.tsx@@ -29,6 +29,20 @@ async function waitForIdleRender(signal?: AbortSignal, attempts = 120): Promise<}}+/** Poll until the engine answers again, on the same budget this file uses for+ * a warm start (ensureComfyRunning: 15 rounds of 2s). Deliberately does NOT+ * fall through to install_comfyui the way ensureComfyRunning does: after a+ * restart the engine is installed by definition, and a multi gigabyte install+ * is not something to start behind a model download. */+async function waitForComfyBack(onStatus?: (m: string) => void, signal?: AbortSignal): Promise<boolean> {+ for (let i = 0; i < 15; i++) {+ if (await checkComfyConnection()) return true+ onStatus?.(`Waiting for ComfyUI to come back up… ${i * 2}s`)+ await waitOrAbort(2000, signal)+ }+ return await checkComfyConnection()+}+async function restartComfyForNewNodes(): Promise<void> {try { await backendCall('stop_comfyui') } catch { /* may already be stopped */ }// stop_comfyui reaps its child before returning, so LU's own engine is down@@ -416,6 +430,9 @@ export function CreateExpProvider({ children }: { children: ReactNode }) {let missing = await waitForModelsVisible({missing: stillMissing, refresh: refreshLists, onStatus: onProgress, signal,})+ // Whatever the restart says is the PRECISE reason, and it has to outlive+ // the block so the throw below can prefer it over its own guess.+ let restartSaid = ''if (missing.length > 0) {// Heal before complaining: a restart rebuilds the model index for// certain, and it is the same move that registers a new node pack.@@ -429,13 +446,25 @@ export function CreateExpProvider({ children }: { children: ReactNode }) {await waitForIdleRender(signal)}onProgress?.('Restarting ComfyUI so it picks up the new files…')- await restartComfyForNewNodes().catch(() => { /* diagnosed below */ })+ try {+ await restartComfyForNewNodes()+ } catch (e) {+ restartSaid = e instanceof Error ? e.message : String(e)+ }+ // The engine has to be listening again before a scan can report+ // anything. The old code went straight into a 10 by 3s wait, which had+ // to cover the boot AND the directory scan, while this same file+ // budgets 30s for a warm boot alone and 60s after an install. On the+ // 12 GB video bundles the scan is the slow half, so a perfectly good+ // install ran out of time and got told its model folder was wrong.+ if (!restartSaid) await waitForComfyBack(onProgress, signal)missing = await waitForModelsVisible({- missing: stillMissing, refresh: refreshLists, onStatus: onProgress, signal, attempts: 10,+ missing: stillMissing, refresh: refreshLists, onStatus: onProgress, signal,})}if (missing.length > 0) {throw new Error(+ restartSaid ||`The files downloaded fine, but ComfyUI still does not list ${missing.join(', ')}. ` +'Either it is reading a different model folder than LU writes to, or it was started ' +'outside LU and cannot be restarted from here. The Model Manager shows where the ' +diff --git a/src/lib/__tests__/model-visible-wait.test.ts b/src/lib/__tests__/model-visible-wait.test.tsindex aa2d75e3..748d5c20 100644--- a/src/lib/__tests__/model-visible-wait.test.ts+++ b/src/lib/__tests__/model-visible-wait.test.ts@@ -115,7 +115,9 @@ describe('the install path uses it, and says something honest when it runs out',})it('the last word is a thrown error, so the card turns red instead of freezing', () => {- expect(src).toMatch(/throw new Error\(\s*\n\s*`The files downloaded fine, but ComfyUI still does not list/)+ // The restart's own reason now sits ahead of the fallback text inside the+ // same throw, so the anchor is the throw plus the reason, not the literal.+ expect(src).toMatch(/throw new Error\(\s*\n\s*restartSaid \|\|\s*\n\s*`The files downloaded fine/)})it('the error names the two things that actually cause it', () => {@@ -151,6 +153,35 @@ describe('the install path uses it, and says something honest when it runs out',it('waiting for the render to finish is bounded, an install must not park forever', () => {expect(src).toMatch(/async function waitForIdleRender\(signal\?: AbortSignal, attempts = \d+\)/)})++ // P7 from the review (2026-08-14). The heal swallowed the restart's own+ // error, which is the precise one, and then guessed between two causes. And+ // the follow-up wait was 10 rounds of 3s, which had to cover the engine boot+ // AND the directory scan, while this same file budgets 15 rounds of 2s for a+ // warm boot alone and 30 for one after an install. On the 12 GB bundles the+ // scan is the slow half, so a perfectly good install was told its model+ // folder was wrong.+ it('the restart reason is kept and preferred over the guess', () => {+ expect(src).toContain('restartSaid = e instanceof Error ? e.message : String(e)')+ const throwAt = src.indexOf('The files downloaded fine, but ComfyUI still does not list')+ expect(src.slice(throwAt - 200, throwAt)).toContain('restartSaid ||')+ })++ it('the engine gets the same time to come back that a warm boot gets', () => {+ expect(src).toContain('await waitForComfyBack(onProgress, signal)')+ expect(src).toMatch(/for \(let i = 0; i < 15; i\+\+\) \{\s*\n\s*if \(await checkComfyConnection\(\)\) return true/)+ })++ it('the second visibility wait gets the full budget, not a shortened one', () => {+ const heal = src.slice(src.indexOf('Restarting ComfyUI so it picks up the new files'))+ const secondWait = heal.slice(0, heal.indexOf('if (missing.length > 0)'))+ expect(secondWait).not.toContain('attempts: 10')+ })++ it('coming back up must not trigger a multi gigabyte install behind the download', () => {+ const helper = src.slice(src.indexOf('async function waitForComfyBack'), src.indexOf('async function restartComfyForNewNodes'))+ expect(helper).not.toContain('install_comfyui')+ })})describe('the card is no longer the owner of the run', () => {