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.

chore(create): delete the dead preflight chain

purple8454d65de21d
diff --git a/src/api/preflight.ts b/src/api/preflight.ts
deleted file mode 100644
index 60c4de57..00000000
--- a/src/api/preflight.ts
+++ /dev/null
@@ -1,181 +0,0 @@
-import { classifyModel, findMatchingVAE, findMatchingCLIP, type ModelType } from './comfyui'
-import { getAllNodeInfo, categorizeNodes, type CategorizedNodes } from './comfyui-nodes'
-import { COMPONENT_REGISTRY } from './discover'
-
-// ─── Pre-Flight Validation ───
-// Checks everything BEFORE generation so users get instant feedback on model readiness.
-
-export interface PreflightWarning {
- type: 'unknown_model' | 'size_alignment' | 'high_vram'
- message: string
-}
-
-export interface PreflightError {
- type: 'missing_vae' | 'missing_clip' | 'missing_nodes' | 'no_model'
- message: string
- downloadUrl?: string
- downloadFilename?: string
- downloadSubfolder?: string
-}
-
-export interface PreflightResult {
- ready: boolean
- modelType: ModelType
- warnings: PreflightWarning[]
- errors: PreflightError[]
- resolvedVAE?: string
- resolvedCLIP?: string
-}
-
-export async function preflightCheck(
- modelName: string,
- mode: 'image' | 'video',
- width?: number,
- height?: number,
-): Promise<PreflightResult> {
- const warnings: PreflightWarning[] = []
- const errors: PreflightError[] = []
- let resolvedVAE: string | undefined
- let resolvedCLIP: string | undefined
-
- if (!modelName) {
- return { ready: false, modelType: 'unknown', warnings, errors: [{ type: 'no_model', message: 'No model selected.' }] }
- }
-
- const modelType = classifyModel(modelName)
- const registry = COMPONENT_REGISTRY[modelType]
-
- // Warn on unknown model type
- if (modelType === 'unknown') {
- warnings.push({
- type: 'unknown_model',
- message: `Model type not recognized. Using SDXL defaults. Rename the file to include the model type (e.g. "sdxl", "flux", "sd15") for optimal settings.`,
- })
- }
-
- // Check required nodes
- let nodes: CategorizedNodes | null = null
- try {
- const allNodes = await getAllNodeInfo()
- nodes = categorizeNodes(allNodes)
- } catch {
- return { ready: false, modelType, warnings, errors: [{ type: 'missing_nodes', message: 'Cannot reach ComfyUI to verify nodes.' }] }
- }
-
- // Models with custom wrapper nodes (Kijai/community custom_nodes)
- const customNodeModels: Record<string, { nodes: string[]; installHint: string }> = {
- framepack: {
- nodes: ['LoadFramePackModel', 'FramePackSampler'],
- installHint: 'ComfyUI-FramePackWrapper custom nodes. Install via Discover > Video > FramePack bundle.',
- },
- // Node class names verified 2026-07-24 against real checkouts of both
- // wrappers. Kijai's CogVideoX pack registers CogVideoSampler, NOT
- // CogVideoXSampler (only the LOADER carries the X), and PyramidFlow
- // registers PyramidFlowTransformerLoader, not PyramidFlowModelLoader. The
- // old names matched nothing, so a correct install was reported as missing
- // (bob80817-dev, D#88).
- cogvideo: {
- nodes: ['CogVideoXModelLoader', 'CogVideoSampler'],
- installHint: 'ComfyUI-CogVideoXWrapper custom nodes. Install from Model Manager.',
- },
- pyramidflow: {
- nodes: ['PyramidFlowTransformerLoader', 'PyramidFlowSampler'],
- installHint: 'ComfyUI-PyramidFlowWrapper custom nodes. Install from Model Manager.',
- },
- allegro: {
- nodes: ['AllegroModelLoader', 'AllegroSampler'],
- installHint: 'ComfyUI-Allegro custom nodes. Install from Model Manager.',
- },
- }
-
- const customCheck = customNodeModels[modelType]
- if (customCheck) {
- // `CategorizedNodes` has no `conditioning` field (it is `textEncoders`), so
- // this spread was `[...undefined]` — a TypeError that useCreate swallowed,
- // making preflight return null for exactly the four families below. That is
- // why nobody got the early "custom nodes missing" warning and everyone hit
- // the failure at generate time instead.
- const allNodeNames = [...nodes.loaders, ...nodes.samplers, ...nodes.textEncoders, ...nodes.decoders]
- const missing = customCheck.nodes.filter(n => !allNodeNames.includes(n))
- if (missing.length > 0) {
- errors.push({
- type: 'missing_nodes',
- message: `Missing custom nodes: ${missing.join(', ')}. Install ${customCheck.installHint}`,
- })
- }
- }
-
- const needsUnet = modelType === 'flux' || modelType === 'flux2' || modelType === 'zimage' || modelType === 'ernie_image' || modelType === 'wan' || modelType === 'hunyuan'
- || modelType === 'ltx' || modelType === 'mochi' || modelType === 'cosmos'
- || modelType === 'framepack'
- if (needsUnet) {
- const hasUNET = nodes.loaders.includes('UNETLoader')
- const hasCLIPLoader = nodes.loaders.includes('CLIPLoader')
- const hasVAELoader = nodes.loaders.includes('VAELoader')
- if (!hasUNET || !hasCLIPLoader || !hasVAELoader) {
- const missing = [!hasUNET && 'UNETLoader', !hasCLIPLoader && 'CLIPLoader', !hasVAELoader && 'VAELoader'].filter(Boolean)
- errors.push({
- type: 'missing_nodes',
- message: `Missing required nodes: ${missing.join(', ')}. Update ComfyUI to the latest version.`,
- })
- }
- } else if (!customCheck) {
- if (!nodes.loaders.includes('CheckpointLoaderSimple')) {
- errors.push({
- type: 'missing_nodes',
- message: 'Missing CheckpointLoaderSimple node. Update ComfyUI.',
- })
- }
- }
-
- // Check VAE availability (models with separate VAE files)
- if (registry?.needsSeparateVAE) {
- try {
- resolvedVAE = await findMatchingVAE(modelType)
- } catch (err) {
- const vaeSpec = registry?.vae
- errors.push({
- type: 'missing_vae',
- message: err instanceof Error ? err.message : 'VAE not found.',
- downloadUrl: vaeSpec?.downloadUrl,
- downloadFilename: vaeSpec?.downloadName,
- downloadSubfolder: vaeSpec?.subfolder,
- })
- }
- }
-
- // Check CLIP/text encoder availability (models with separate CLIP files)
- if (registry?.needsSeparateCLIP) {
- try {
- resolvedCLIP = await findMatchingCLIP(modelType)
- } catch (err) {
- const clipSpec = registry?.clip
- errors.push({
- type: 'missing_clip',
- message: err instanceof Error ? err.message : 'Text encoder not found.',
- downloadUrl: clipSpec?.downloadUrl,
- downloadFilename: clipSpec?.downloadName,
- downloadSubfolder: clipSpec?.subfolder,
- })
- }
- }
-
- // Size alignment check for video
- if (mode === 'video' && width && height) {
- if (width % 16 !== 0 || height % 16 !== 0) {
- warnings.push({
- type: 'size_alignment',
- message: `Video dimensions must be multiples of 16. Current: ${width}x${height}.`,
- })
- }
- }
-
- return {
- ready: errors.length === 0,
- modelType,
- warnings,
- errors,
- resolvedVAE,
- resolvedCLIP,
- }
-}
diff --git a/src/hooks/useCreate.ts b/src/hooks/useCreate.ts
index ff000ca5..3f2f3d29 100644
--- a/src/hooks/useCreate.ts
+++ b/src/hooks/useCreate.ts
@@ -47,7 +47,6 @@ import {
import { useCreateStore } from '../stores/createStore'
import { useWorkflowStore } from '../stores/workflowStore'
import { injectParameters } from '../api/workflows'
-import { preflightCheck } from '../api/preflight'
import {
generateMlxImageDataUrl, isMlxImageHost, isMlxImageModel,
mlxStatus, listMlxImageModels, buildMlxImageModels, mergeImageModels, mlxModelIdFor,
@@ -94,33 +93,6 @@ export function useCreate() {
return ok
}, [])
- const runPreflight = useCallback(async () => {
- const state = useCreateStore.getState()
- // Preflight validates a model against ComfyUI's installed node graph. On a
- // Mac that question has no meaning — and asking it reaches out to port 8188,
- // where a ComfyUI the user runs for something else would answer about nodes
- // that have nothing to do with the MLX model being checked.
- if (isMlxImageHost()) {
- state.setPreflightStatus(null, [], [])
- return
- }
- const activeModel = state.mode === 'image' ? state.imageModel : state.videoModel
- if (!activeModel) {
- state.setPreflightStatus(null, [], [])
- return
- }
- try {
- const result = await preflightCheck(activeModel, state.mode, state.width, state.height)
- state.setPreflightStatus(
- result.ready,
- result.errors,
- result.warnings.map(w => w.message),
- )
- } catch {
- state.setPreflightStatus(null, [], [])
- }
- }, [])
-
const zeroModelRetries = useRef(0)
const fetchModels = useCallback(async () => {
@@ -309,13 +281,11 @@ export function useCreate() {
state.setImageModel(imgModels[0].name, imgModels[0].type)
}
}
- // Run preflight check after models are loaded
- setTimeout(() => runPreflight(), 100)
} catch (err) {
console.error('[useCreate] Failed to fetch models:', err)
setModelLoadError(`Failed to load models: ${err instanceof Error ? err.message : 'ComfyUI API error'}`)
}
- }, [runPreflight])
+ }, [])
// Auto-refresh models when a ComfyUI model download completes.
// Schedules three fetches because real-world ComfyUI scans take longer than
@@ -1376,7 +1346,6 @@ export function useCreate() {
mlxMissing,
checkConnection,
fetchModels,
- runPreflight,
generate,
cancel,
}
diff --git a/src/stores/__tests__/createStore.test.ts b/src/stores/__tests__/createStore.test.ts
index 29ad2e0a..64d2a8b4 100644
--- a/src/stores/__tests__/createStore.test.ts
+++ b/src/stores/__tests__/createStore.test.ts
@@ -88,9 +88,6 @@ const INITIAL_STATE = {
currentPromptId: null,
error: null,
lastGenTime: null,
- preflightReady: null,
- preflightErrors: [],
- preflightWarnings: [],
gallery: [],
promptHistory: [],
}
diff --git a/src/stores/createStore.ts b/src/stores/createStore.ts
index fae5afd0..d110358f 100644
--- a/src/stores/createStore.ts
+++ b/src/stores/createStore.ts
@@ -2,7 +2,6 @@ import { create } from 'zustand'
import { persist } from 'zustand/middleware'
import type { ModelType, ClassifiedModel } from '../api/comfyui'
import { classifyModel } from '../api/comfyui'
-import type { PreflightError } from '../api/preflight'
// ModelType includes: flux, flux2, zimage, sdxl, sd15, wan, hunyuan, unknown
export type ProgressPhase = 'idle' | 'queued' | 'loading-model' | 'loading-clip' | 'loading-vae' | 'sampling' | 'decoding' | 'complete'
@@ -278,9 +277,6 @@ interface CreateState {
currentPromptId: string | null
error: string | null
lastGenTime: string | null
- preflightReady: boolean | null
- preflightErrors: PreflightError[]
- preflightWarnings: string[]
gallery: GalleryItem[]
promptHistory: string[]
/** Runtime-only (not persisted): populated by useCreate.fetchModels so the
@@ -300,7 +296,6 @@ interface CreateState {
* back to animated .webp; the modal resolves with the user's choice. */
vhsInstallPrompt: ((choice: 'install' | 'webp' | 'cancel') => void) | null
- setPreflightStatus: (ready: boolean | null, errors: PreflightError[], warnings: string[]) => void
setMode: (mode: 'image' | 'video') => void
setVideoBackend: (backend: VideoBackendKind) => void
setImageSubMode: (subMode: 'text2img' | 'img2img') => void
@@ -455,9 +450,6 @@ export const useCreateStore = create<CreateState>()(
currentPromptId: null,
error: null,
lastGenTime: null,
- preflightReady: null,
- preflightErrors: [],
- preflightWarnings: [],
gallery: [],
promptHistory: [],
imageModelList: [],
@@ -468,7 +460,6 @@ export const useCreateStore = create<CreateState>()(
comfyRunning: false,
vhsInstallPrompt: null,
- setPreflightStatus: (ready, errors, warnings) => set({ preflightReady: ready, preflightErrors: errors, preflightWarnings: warnings }),
setVideoBackend: (videoBackend) => set({ videoBackend, videoBackendInitialized: true }),
setMode: (mode) => set((state) => {
// Reset parameters to the correct defaults when switching modes