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(models): Unload all says nothing about a ComfyUI that is not running (#235)

purple20225598c076
diff --git a/src/lib/__tests__/unload-all-frees-every-engine-235.test.ts b/src/lib/__tests__/unload-all-frees-every-engine-235.test.ts
index e20a5b26..c19f4467 100644
--- a/src/lib/__tests__/unload-all-frees-every-engine-235.test.ts
+++ b/src/lib/__tests__/unload-all-frees-every-engine-235.test.ts
@@ -64,10 +64,25 @@ describe('Unload all models frees every engine', () => {
})
it('a ComfyUI on another computer is said as such', async () => {
- const d = deps({ offload: vi.fn(async () => ({ offloaded: ['bundled-engine'], notOurs: [{ backend: 'comfyui' }] })) })
+ const why = 'ComfyUI is configured on another host, so its VRAM is not this machine\'s to free'
+ const d = deps({ offload: vi.fn(async () => ({ offloaded: ['bundled-engine'], notOurs: [{ backend: 'comfyui', why }] })) })
expect(unloadProblems((await unloadEverything({ ollama: false, lmstudio: false }, d)).outcomes)).toMatch(/ComfyUI runs on another computer/)
})
+ it('NEGATIVE CONTROL (from the real run): no ComfyUI running is not a problem', async () => {
+ // The app's own words on the Mac test build, 15.11.2026, ComfyUI not started.
+ const why = 'nothing answered /free there (error sending request for url (http://localhost:8188/free))'
+ const d = deps({ offload: vi.fn(async () => ({ offloaded: ['bundled-engine'], notOurs: [{ backend: 'comfyui', why }, { backend: 'ollama', why: 'nothing answered /api/ps there' }] })) })
+ const r = await unloadEverything({ ollama: false, lmstudio: false }, d)
+ expect(unloadProblems(r.outcomes)).toBeNull()
+ expect(unloadedNames(r.outcomes)).toEqual(['LU Engine'])
+ })
+
+ it('a ComfyUI that answers with an error is named', async () => {
+ const d = deps({ offload: vi.fn(async () => ({ offloaded: ['bundled-engine'], notOurs: [{ backend: 'comfyui', why: '/free answered HTTP 500' }] })) })
+ expect(unloadProblems((await unloadEverything({ ollama: false, lmstudio: false }, d)).outcomes)).toBe('ComfyUI did not free its memory.')
+ })
+
it('LM Studio still holding a model after the unload is named', async () => {
const d = deps({ lmsUnloadAll: vi.fn(async () => {}) })
expect(unloadProblems((await unloadEverything({ ollama: false, lmstudio: true }, d)).outcomes)).toBe('LM Studio still has qwen3-8b loaded.')
diff --git a/src/lib/unload-everything.ts b/src/lib/unload-everything.ts
index be61b0f7..b41e9340 100644
--- a/src/lib/unload-everything.ts
+++ b/src/lib/unload-everything.ts
@@ -29,7 +29,7 @@ export interface UnloadScope {
lmstudio: boolean
}
-interface OffloadReply { offloaded?: string[]; notOurs?: Array<{ backend?: string }> }
+interface OffloadReply { offloaded?: string[]; notOurs?: Array<{ backend?: string; why?: string }> }
export interface UnloadDeps {
unloadOllama: () => Promise<UnloadAllResult>
@@ -77,8 +77,16 @@ export async function unloadEverything(scope: UnloadScope, deps: UnloadDeps = de
const reply = await deps.offload()
const freed = new Set(reply.offloaded ?? [])
outcomes.push({ engine: 'engine', freed: freed.has('bundled-engine') })
- if ((reply.notOurs ?? []).some((n) => n.backend === 'comfyui')) {
+ // The app says why it left ComfyUI alone (process.rs, VramRelease):
+ // on another host, nothing answered (not running: nothing to free), or
+ // it answered with an error. Found by the real check: an idle machine
+ // without ComfyUI must not read as "on another computer".
+ const comfy = (reply.notOurs ?? []).find((n) => n.backend === 'comfyui')
+ const why = comfy?.why ?? ''
+ if (comfy && /another host/i.test(why)) {
outcomes.push({ engine: 'comfyui', freed: false, problem: 'ComfyUI runs on another computer, so LU cannot free its memory from here.' })
+ } else if (comfy && !/nothing answered/i.test(why)) {
+ outcomes.push({ engine: 'comfyui', freed: false, problem: 'ComfyUI did not free its memory.' })
} else {
outcomes.push({ engine: 'comfyui', freed: freed.has('comfyui') })
}