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(settings): ein gescheiterter Install oder Repair ist keine Sackgasse mehr

purple284112d40ee9
diff --git a/src/components/settings/SettingsPage.tsx b/src/components/settings/SettingsPage.tsx
index 8ecece98..31a3969d 100644
--- a/src/components/settings/SettingsPage.tsx
+++ b/src/components/settings/SettingsPage.tsx
@@ -539,6 +539,11 @@ export function ComfyUISettings() {
const installDl = useComfyInstallStore((s) => s.dl)
const cancelling = useComfyInstallStore((s) => s.cancelling)
const installNotice = useComfyInstallStore((s) => s.notice)
+ // A failed run must not be a dead end. The phase stays `error` until
+ // something clears it, and with the state outliving the mount the old escape
+ // hatch (leave the section, lose the useState) is gone. So the start buttons
+ // stay reachable on `error` too, and the card carries a Dismiss.
+ const installIdle = installPhase === 'idle' || installPhase === 'error'
useEffect(() => {
let cancelled = false
@@ -778,12 +783,12 @@ export function ComfyUISettings() {
{/* GH #98: a from-source install whose Python env broke (shared system
Python, dead torch) needs a rebuild, not a re-install — pip reports
broken packages as already satisfied. Rebuilds ComfyUI/venv. */}
- {status?.found && !status?.running && installPhase === 'idle' && (
+ {status?.found && !status?.running && installIdle && (
<button onClick={handleRepair} title="Rebuild the Python environment in an isolated venv (~2 GB). Models, outputs and custom nodes are left alone." className="px-2 py-1 rounded text-[0.6rem] bg-amber-500/10 text-amber-400 hover:bg-amber-500/20 transition-colors">
Repair environment
</button>
)}
- {(!status?.found || status?.complete === false) && installPhase === 'idle' && (
+ {(!status?.found || status?.complete === false) && installIdle && (
<button
onClick={() => {
// andy_38747 (Discord): let the Path field double as the install
@@ -798,7 +803,7 @@ export function ComfyUISettings() {
{status?.complete === false ? 'Re-install ComfyUI' : 'Install ComfyUI'}
</button>
)}
- {status?.found && status?.complete !== false && installPhase === 'idle' && (
+ {status?.found && status?.complete !== false && installIdle && (
// 2.5.8: the specialized local lanes (music / talking character /
// motion) need node families that ship with current cores — this is
// the one-click git pull + dependency refresh the lane errors point
@@ -832,6 +837,15 @@ export function ComfyUISettings() {
{installPhase === 'error' && 'Install failed'}
</>}
</span>
+ {installPhase === 'error' && (
+ <button
+ onClick={() => useComfyInstallStore.getState().reset()}
+ title="Clear this message"
+ className="ml-auto px-1.5 py-[1px] rounded border border-white/15 text-[0.55rem] text-gray-400 hover:text-gray-200 hover:bg-white/10 transition-colors"
+ >
+ Dismiss
+ </button>
+ )}
{(installPhase === 'comfyui' || installPhase === 'repair') && (
<button
onClick={handleCancelInstall}
diff --git a/src/components/settings/__tests__/comfy-install-survives-remount.test.ts b/src/components/settings/__tests__/comfy-install-survives-remount.test.ts
index a30271f1..f54f4899 100644
--- a/src/components/settings/__tests__/comfy-install-survives-remount.test.ts
+++ b/src/components/settings/__tests__/comfy-install-survives-remount.test.ts
@@ -113,3 +113,48 @@ describe('a repair started in Settings survives leaving the section', () => {
expect(backendCall.mock.calls.filter(([cmd]) => cmd === 'install_comfyui_status').length).toBe(before + 1)
})
})
+
+/**
+ * Review 2026-09-02 (blocker): with the state outliving the mount, `error`
+ * outlives it too. The three start buttons hung on `phase === 'idle'` and
+ * nothing but a fresh run cleared the phase, so a failed install or repair was
+ * a dead end until the app was restarted. Before the store, leaving the
+ * section threw the failure away and the buttons came back.
+ */
+describe('a failed run stays escapable', () => {
+ it('offers Repair environment again after a failure, across a remount', async () => {
+ vi.useFakeTimers({ shouldAdvanceTime: true })
+ const first = await mountPanel()
+ await act(async () => { fireEvent.click(screen.getByText('Repair environment')) })
+
+ installStatus = { status: 'error', logs: ['ERROR: pip could not build wheels'] }
+ await act(async () => { await vi.advanceTimersByTimeAsync(2000) })
+ expect(screen.getByText('Install failed')).toBeTruthy()
+
+ // The user leaves for Providers and comes back, the old escape hatch.
+ first.unmount()
+ await mountPanel()
+
+ expect(screen.getByText('Install failed')).toBeTruthy()
+ const again = screen.getByText('Repair environment')
+ expect((again as HTMLButtonElement).disabled).toBe(false)
+ // And pressing it really starts a second run instead of doing nothing.
+ await act(async () => { fireEvent.click(again) })
+ expect(backendCall.mock.calls.filter(([cmd]) => cmd === 'repair_comfyui_env').length).toBe(2)
+ expect(screen.queryByText('Install failed')).toBeNull()
+ })
+
+ it('clears the card on Dismiss without starting anything', async () => {
+ vi.useFakeTimers({ shouldAdvanceTime: true })
+ await mountPanel()
+ await act(async () => { fireEvent.click(screen.getByText('Repair environment')) })
+ installStatus = { status: 'error', logs: ['ERROR: pip could not build wheels'] }
+ await act(async () => { await vi.advanceTimersByTimeAsync(2000) })
+
+ await act(async () => { fireEvent.click(screen.getByText('Dismiss')) })
+ expect(screen.queryByText('Install failed')).toBeNull()
+ expect(screen.queryByText(/pip could not build wheels/)).toBeNull()
+ expect(backendCall.mock.calls.filter(([cmd]) => cmd === 'repair_comfyui_env').length).toBe(1)
+ expect(comfyInstallPolling()).toBe(false)
+ })
+})