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(#72): custom-node install self-heals — no more silent VHS loop (bob)

purple883d9eee797a
diff --git a/src-tauri/src/commands/install.rs b/src-tauri/src/commands/install.rs
index f604d299..9167d996 100644
--- a/src-tauri/src/commands/install.rs
+++ b/src-tauri/src/commands/install.rs
@@ -2660,24 +2660,50 @@ pub fn install_custom_node(
}
}
+ // #72 (bob, discussion 72): three silent failure modes lived here.
+ // 1. A leftover non-repo dir (aborted clone, manual unzip) made `git pull`
+ // fail forever, and the failure came back as Ok(status="update_failed")
+ // — the UI treated it as success, so the install dialog looped with no
+ // error and video gen kept falling back to .webp.
+ // 2. The exists/update path never installed requirements.txt, so a repo
+ // whose requirements failed once could never heal (ComfyUI keeps
+ // reporting IMPORT FAILED and the node never shows up).
+ // Now: a non-repo leftover is moved aside (".disabled" so ComfyUI ignores
+ // it) and re-cloned, a failed pull is a real Err, and requirements are
+ // ensured on BOTH the clone and the update path.
+ let mut fresh_clone = true;
if target_dir.exists() {
- // Already exists — git pull to update
- println!("[Install] Custom node {} already exists, updating...", node_name);
- let mut cmd = Command::new("git");
- cmd.args(["pull"]).current_dir(&target_dir)
- .stdout(Stdio::piped()).stderr(Stdio::piped());
- #[cfg(target_os = "windows")]
- cmd.creation_flags(CREATE_NO_WINDOW);
- let output = cmd.output()
- .map_err(|e| format!("Git pull failed: {}", e))?;
+ if target_dir.join(".git").exists() {
+ println!("[Install] Custom node {} already exists, updating...", node_name);
+ let mut cmd = Command::new("git");
+ cmd.args(["pull"]).current_dir(&target_dir)
+ .stdout(Stdio::piped()).stderr(Stdio::piped());
+ #[cfg(target_os = "windows")]
+ cmd.creation_flags(CREATE_NO_WINDOW);
+ let output = cmd.output()
+ .map_err(|e| format!("Git pull failed: {}", e))?;
+ if !output.status.success() {
+ let stderr = String::from_utf8_lossy(&output.stderr);
+ error!(node = %node_name, "custom node git pull failed");
+ return Err(format!(
+ "Failed to update {} (git pull): {}\n\nIf this keeps failing, \
+ delete the folder {} and try the install again.",
+ node_name, stderr.trim(), target_dir.to_string_lossy()
+ ));
+ }
+ fresh_clone = false;
+ } else {
+ // Not a git repo — pull can never succeed. Move it aside and re-clone.
+ let moved_to = move_aside_broken_node_dir(&target_dir)?;
+ println!(
+ "[Install] Custom node {} folder exists but is not a git repo — moved aside to {}, re-cloning",
+ node_name,
+ moved_to.file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_default()
+ );
+ }
+ }
- let status = if output.status.success() { "updated" } else { "update_failed" };
- Ok(serde_json::json!({
- "status": status,
- "path": target_dir.to_string_lossy(),
- }))
- } else {
- // Clone the repo
+ if fresh_clone {
println!("[Install] Cloning custom node {} from {}", node_name, repo_url);
let mut cmd = Command::new("git");
cmd.args(["clone", &repo_url]).arg(&target_dir)
@@ -2686,71 +2712,98 @@ pub fn install_custom_node(
cmd.creation_flags(CREATE_NO_WINDOW);
let output = cmd.output()
.map_err(|e| format!("Git clone failed: {}", e))?;
-
- if output.status.success() {
- // Install requirements.txt if it exists
- let reqs = target_dir.join("requirements.txt");
- if reqs.exists() {
- // Bug F (discovered during Arch live test on 2026-05-17):
- // ComfyUI was installed into a venv by the Bug E path, but
- // this function used to call pip against `state.python_bin`
- // (the system Python). On Arch / Debian 12+ / Fedora 38+
- // that hits PEP 668's `externally-managed-environment` and
- // the requirements install silently fails (`let _ = pip.output()`
- // ignored the exit code, so the user got "installed" even
- // when requirements never landed — the next workflow build
- // would then crash with `ModuleNotFoundError`).
- //
- // Fix: prefer the ComfyUI venv's Python (matches the launcher
- // in `process.rs::start_comfyui` and the installer in
- // `install_comfyui`) so requirements land in the same
- // site-packages ComfyUI actually imports from. Plus we now
- // surface a useful error when pip fails instead of swallowing it.
- let venv_python = crate::python::resolve_comfyui_venv_python(&comfy_dir);
- let python_bin = venv_python.unwrap_or_else(|| {
- state.python_bin.lock().unwrap().clone()
- });
- if python_bin.is_empty() {
- return Err(format!(
- "Custom node {} cloned, but cannot install requirements: \
- no Python available. Install Python first \
- (Settings → ComfyUI → Install Python).",
- node_name
- ));
- }
- println!("[Install] Installing requirements for {} via {}", node_name, python_bin);
- let mut pip = Command::new(&python_bin);
- pip.args(["-m", "pip", "install", "--no-input", "-r"]).arg(&reqs)
- .stdout(Stdio::piped()).stderr(Stdio::piped());
- #[cfg(target_os = "windows")]
- pip.creation_flags(CREATE_NO_WINDOW);
- let pip_out = pip.output()
- .map_err(|e| format!("Failed to spawn pip for {} requirements: {}", node_name, e))?;
- if !pip_out.status.success() {
- let stderr = String::from_utf8_lossy(&pip_out.stderr);
- let stdout = String::from_utf8_lossy(&pip_out.stdout);
- let combined = format!("{}{}", stdout, stderr);
- // Reuse the install_comfyui diagnose path so PEP 668 +
- // friends produce actionable messages here too.
- let diagnosis = diagnose_pip_error(&combined);
- error!(node = %node_name, "custom node requirements install failed");
- return Err(format!(
- "Custom node {} cloned, but requirements install failed.\n\n{}",
- node_name, diagnosis
- ));
- }
- }
-
- Ok(serde_json::json!({
- "status": "installed",
- "path": target_dir.to_string_lossy(),
- }))
- } else {
+ if !output.status.success() {
let stderr = String::from_utf8_lossy(&output.stderr);
error!(node = %node_name, "custom node clone failed");
- Err(format!("Failed to clone {}: {}", node_name, stderr))
+ return Err(format!("Failed to clone {}: {}", node_name, stderr));
}
}
+
+ let fallback_python = state.python_bin.lock().unwrap().clone();
+ install_node_requirements(&comfy_dir, &target_dir, &node_name, &fallback_python)?;
+
+ Ok(serde_json::json!({
+ "status": if fresh_clone { "installed" } else { "updated" },
+ "path": target_dir.to_string_lossy(),
+ }))
+}
+
+/// Move a non-repo custom-node leftover out of the way so a fresh clone can
+/// land. The ".disabled" suffix matches the ComfyUI(-Manager) convention, so
+/// ComfyUI never tries to load the moved-aside folder as a node pack.
+fn move_aside_broken_node_dir(target_dir: &std::path::Path) -> Result<PathBuf, String> {
+ let base = target_dir.to_string_lossy().into_owned();
+ let mut backup = PathBuf::from(format!("{}.broken.disabled", base));
+ let mut n = 1;
+ while backup.exists() {
+ n += 1;
+ backup = PathBuf::from(format!("{}.broken{}.disabled", base, n));
+ }
+ fs::rename(target_dir, &backup).map_err(|e| {
+ format!(
+ "The folder {} exists but is not a valid git checkout, and it could \
+ not be moved aside: {}. Delete it manually and try again.",
+ target_dir.display(), e
+ )
+ })?;
+ Ok(backup)
+}
+
+/// Install a custom node's requirements.txt (when present) into the Python
+/// that ComfyUI actually runs with. Shared by the clone AND the update path
+/// of `install_custom_node` — #72 was partly caused by the update path
+/// skipping this entirely.
+///
+/// Bug F (discovered during Arch live test on 2026-05-17): ComfyUI was
+/// installed into a venv by the Bug E path, but this used to call pip against
+/// `state.python_bin` (the system Python). On Arch / Debian 12+ / Fedora 38+
+/// that hits PEP 668's `externally-managed-environment` and the requirements
+/// install silently fails. Prefer the ComfyUI venv's Python (matches the
+/// launcher in `process.rs::start_comfyui` and the installer in
+/// `install_comfyui`) so requirements land in the same site-packages ComfyUI
+/// actually imports from, and surface a useful error when pip fails.
+fn install_node_requirements(
+ comfy_dir: &std::path::Path,
+ target_dir: &std::path::Path,
+ node_name: &str,
+ fallback_python: &str,
+) -> Result<(), String> {
+ let reqs = target_dir.join("requirements.txt");
+ if !reqs.exists() {
+ return Ok(());
+ }
+ let venv_python = crate::python::resolve_comfyui_venv_python(comfy_dir);
+ let python_bin = venv_python.unwrap_or_else(|| fallback_python.to_string());
+ if python_bin.is_empty() {
+ return Err(format!(
+ "Custom node {} cloned, but cannot install requirements: \
+ no Python available. Install Python first \
+ (Settings → ComfyUI → Install Python).",
+ node_name
+ ));
+ }
+ println!("[Install] Installing requirements for {} via {}", node_name, python_bin);
+ let mut pip = Command::new(&python_bin);
+ pip.args(["-m", "pip", "install", "--no-input", "-r"]).arg(&reqs)
+ .stdout(Stdio::piped()).stderr(Stdio::piped());
+ #[cfg(target_os = "windows")]
+ pip.creation_flags(CREATE_NO_WINDOW);
+ let pip_out = pip.output()
+ .map_err(|e| format!("Failed to spawn pip for {} requirements: {}", node_name, e))?;
+ if !pip_out.status.success() {
+ let stderr = String::from_utf8_lossy(&pip_out.stderr);
+ let stdout = String::from_utf8_lossy(&pip_out.stdout);
+ let combined = format!("{}{}", stdout, stderr);
+ // Reuse the install_comfyui diagnose path so PEP 668 +
+ // friends produce actionable messages here too.
+ let diagnosis = diagnose_pip_error(&combined);
+ error!(node = %node_name, "custom node requirements install failed");
+ return Err(format!(
+ "Custom node {} is cloned, but its requirements install failed.\n\n{}",
+ node_name, diagnosis
+ ));
+ }
+ Ok(())
}
// ── tests (issue #32: PyTorch / ComfyUI install reliability) ────────────────
@@ -2759,6 +2812,66 @@ pub fn install_custom_node(
mod tests {
use super::*;
+ // ── install_custom_node helpers (#72 bob: VHS install loop) ─────────
+
+ #[test]
+ fn move_aside_renames_non_repo_dir_to_disabled() {
+ let tmp = tempfile::tempdir().unwrap();
+ let node_dir = tmp.path().join("ComfyUI-VideoHelperSuite");
+ std::fs::create_dir(&node_dir).unwrap();
+ std::fs::write(node_dir.join("leftover.txt"), "junk").unwrap();
+
+ let moved = move_aside_broken_node_dir(&node_dir).unwrap();
+
+ assert!(!node_dir.exists(), "original dir must be gone");
+ assert!(moved.exists(), "moved-aside dir must exist");
+ let name = moved.file_name().unwrap().to_string_lossy().into_owned();
+ assert!(
+ name.ends_with(".disabled"),
+ "must end with .disabled so ComfyUI never loads it, got {name}"
+ );
+ assert!(moved.join("leftover.txt").exists(), "content preserved");
+ }
+
+ #[test]
+ fn move_aside_picks_a_fresh_name_when_backup_exists() {
+ let tmp = tempfile::tempdir().unwrap();
+ let node_dir = tmp.path().join("SomeNode");
+ std::fs::create_dir(&node_dir).unwrap();
+ // First backup slot already taken
+ std::fs::create_dir(tmp.path().join("SomeNode.broken.disabled")).unwrap();
+
+ let moved = move_aside_broken_node_dir(&node_dir).unwrap();
+
+ assert!(!node_dir.exists());
+ let name = moved.file_name().unwrap().to_string_lossy().into_owned();
+ assert_eq!(name, "SomeNode.broken2.disabled");
+ }
+
+ #[test]
+ fn requirements_install_is_a_noop_without_requirements_txt() {
+ let tmp = tempfile::tempdir().unwrap();
+ let comfy = tmp.path().join("comfy");
+ let node = tmp.path().join("comfy/custom_nodes/NoReqs");
+ std::fs::create_dir_all(&node).unwrap();
+
+ // No requirements.txt → must succeed without ever spawning pip
+ // (an empty fallback python would otherwise be an instant Err).
+ assert!(install_node_requirements(&comfy, &node, "NoReqs", "").is_ok());
+ }
+
+ #[test]
+ fn requirements_install_without_python_is_actionable() {
+ let tmp = tempfile::tempdir().unwrap();
+ let comfy = tmp.path().join("comfy");
+ let node = tmp.path().join("comfy/custom_nodes/WithReqs");
+ std::fs::create_dir_all(&node).unwrap();
+ std::fs::write(node.join("requirements.txt"), "imageio-ffmpeg").unwrap();
+
+ let err = install_node_requirements(&comfy, &node, "WithReqs", "").unwrap_err();
+ assert!(err.contains("no Python available"), "got: {err}");
+ }
+
// ── is_transient_pip_error ────────────────────────────────────────────
#[test]
diff --git a/src/api/__tests__/custom-node-install.test.ts b/src/api/__tests__/custom-node-install.test.ts
new file mode 100644
index 00000000..c14d9119
--- /dev/null
+++ b/src/api/__tests__/custom-node-install.test.ts
@@ -0,0 +1,68 @@
+// #72 (bob, GH discussion 72): the VHS_VideoCombine install silently failed
+// forever. The backend resolved a failed `git pull` as {status:"update_failed"}
+// instead of rejecting, installCustomNodes never read the status, and the
+// Create flow kept producing .webp with no error. These tests lock in the
+// frontend half of the contract: any non installed/updated status is a failure.
+import { describe, it, expect, vi, beforeEach } from 'vitest'
+
+vi.mock('../backend', async () => {
+ const actual = await vi.importActual<typeof import('../backend')>('../backend')
+ return {
+ ...actual,
+ backendCall: vi.fn(),
+ isTauri: () => true,
+ }
+})
+
+import { backendCall } from '../backend'
+import { installCustomNodes, assertNodeInstallOk } from '../discover'
+
+const mockedCall = vi.mocked(backendCall)
+
+beforeEach(() => {
+ mockedCall.mockReset()
+})
+
+describe('assertNodeInstallOk (#72)', () => {
+ it('throws on update_failed', () => {
+ expect(() => assertNodeInstallOk({ status: 'update_failed', path: 'x' }, 'VHS'))
+ .toThrow(/update_failed/)
+ })
+
+ it('accepts installed and updated', () => {
+ expect(() => assertNodeInstallOk({ status: 'installed' }, 'VHS')).not.toThrow()
+ expect(() => assertNodeInstallOk({ status: 'updated' }, 'VHS')).not.toThrow()
+ })
+
+ it('tolerates results without a status field', () => {
+ expect(() => assertNodeInstallOk(undefined, 'VHS')).not.toThrow()
+ expect(() => assertNodeInstallOk(null, 'VHS')).not.toThrow()
+ expect(() => assertNodeInstallOk({ path: 'x' }, 'VHS')).not.toThrow()
+ })
+})
+
+describe('installCustomNodes (#72)', () => {
+ it('rejects when the backend reports update_failed instead of treating it as success', async () => {
+ mockedCall.mockResolvedValue({ status: 'update_failed', path: 'C:/x' })
+
+ await expect(installCustomNodes(['videohelpersuite']))
+ .rejects.toThrow(/Failed to install ComfyUI-VideoHelperSuite/)
+ })
+
+ it('resolves when the backend reports installed', async () => {
+ mockedCall.mockResolvedValue({ status: 'installed', path: 'C:/x' })
+
+ await expect(installCustomNodes(['videohelpersuite'])).resolves.toBeUndefined()
+ expect(mockedCall).toHaveBeenCalledWith('install_custom_node', {
+ repoUrl: 'https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite',
+ nodeName: 'ComfyUI-VideoHelperSuite',
+ })
+ })
+
+ it('still rejects on a real backend error', async () => {
+ mockedCall.mockRejectedValue(new Error('Failed to clone: network down'))
+
+ await expect(installCustomNodes(['videohelpersuite']))
+ .rejects.toThrow(/network down/)
+ })
+})
diff --git a/src/api/discover.ts b/src/api/discover.ts
index e1bda64a..3d75bb95 100644
--- a/src/api/discover.ts
+++ b/src/api/discover.ts
@@ -167,6 +167,18 @@ export async function checkBundlesInstalled(bundles: ModelBundle[]): Promise<Rec
return result
}
+/** #72: the backend used to resolve a failed `git pull` as
+ * `{status:"update_failed"}` instead of rejecting — anything but an
+ * installed/updated status must be treated as a failure, not success. */
+export function assertNodeInstallOk(result: unknown, name: string): void {
+ if (result && typeof result === 'object' && 'status' in result) {
+ const status = String((result as { status?: unknown }).status)
+ if (status !== 'installed' && status !== 'updated') {
+ throw new Error(`backend reported status "${status}"`)
+ }
+ }
+}
+
export async function installCustomNodes(nodeKeys: string[]): Promise<void> {
for (const key of nodeKeys) {
const entry = CUSTOM_NODE_REGISTRY[key]
@@ -175,7 +187,8 @@ export async function installCustomNodes(nodeKeys: string[]): Promise<void> {
continue
}
try {
- await backendCall('install_custom_node', { repoUrl: entry.repo, nodeName: entry.name })
+ const result = await backendCall('install_custom_node', { repoUrl: entry.repo, nodeName: entry.name })
+ assertNodeInstallOk(result, entry.name)
log.info(`[discover] Installed custom node: ${entry.name}`)
} catch (err) {
log.error(`[discover] Failed to install ${entry.name}`, { err })
@@ -232,7 +245,8 @@ export async function installBundleComplete(bundle: ModelBundle): Promise<void>
try {
const entry = CUSTOM_NODE_REGISTRY[key]
if (!entry) continue
- await backendCall('install_custom_node', { repoUrl: entry.repo, nodeName: entry.name })
+ const result = await backendCall('install_custom_node', { repoUrl: entry.repo, nodeName: entry.name })
+ assertNodeInstallOk(result, entry.name)
log.info(`[discover] Installed custom node: ${entry.name}`)
} catch (err) {
log.warn('[discover] Custom node install failed', { err })
diff --git a/src/components/create/experimental/CreateExperimental.tsx b/src/components/create/experimental/CreateExperimental.tsx
index 3cc683f3..bbd9ca02 100644
--- a/src/components/create/experimental/CreateExperimental.tsx
+++ b/src/components/create/experimental/CreateExperimental.tsx
@@ -10,6 +10,7 @@ import { GalleryStrip } from './GalleryStrip'
import { Lightbox } from './Lightbox'
import { AdvancedDrawer } from './AdvancedDrawer'
import { MaskEditor } from './MaskEditor'
+import { VhsInstallModal } from './VhsInstallModal'
import { INTENT_MAP } from './intents'
import { galleryItemUrl } from './galleryUrl'
import { loadImageRef } from './loadImage'
@@ -126,6 +127,7 @@ function CreateExperimentalInner() {
</div>
<Lightbox item={lightbox} onClose={() => setLightbox(null)} />
+ <VhsInstallModal />
</div>
)
}
diff --git a/src/components/create/experimental/VhsInstallModal.tsx b/src/components/create/experimental/VhsInstallModal.tsx
new file mode 100644
index 00000000..cc2fdb96
--- /dev/null
+++ b/src/components/create/experimental/VhsInstallModal.tsx
@@ -0,0 +1,72 @@
+import { Download, FileVideo } from 'lucide-react'
+import { useCreateStore } from '../../../stores/createStore'
+import { Modal } from '../../ui/Modal'
+
+/**
+ * Bug A (v2.4.5) + #72 (bob): one-click install of VHS_VideoCombine so video
+ * generation produces actual .mp4 files instead of animated .webp fallbacks.
+ * Pops when useCreate detects webpOnly capability and sets vhsInstallPrompt
+ * in the store; resolves with the user's choice and useCreate continues /
+ * cancels.
+ */
+export function VhsInstallModal() {
+ const vhsInstallPrompt = useCreateStore((s) => s.vhsInstallPrompt)
+ const open = vhsInstallPrompt !== null
+
+ const choose = (choice: 'install' | 'webp' | 'cancel') => {
+ if (vhsInstallPrompt) vhsInstallPrompt(choice)
+ }
+
+ return (
+ <Modal open={open} onClose={() => choose('cancel')} title="Install MP4 support?">
+ <div className="space-y-4 text-sm text-gray-200">
+ <div className="flex items-start gap-3 p-3 rounded-lg bg-yellow-500/5 border border-yellow-500/15">
+ <FileVideo size={18} className="text-yellow-400 shrink-0 mt-0.5" />
+ <div className="space-y-1.5">
+ <p className="text-yellow-200 font-medium text-[13px]">
+ Your ComfyUI doesn't have <code className="px-1 py-0.5 rounded bg-black/40 text-yellow-300 font-mono text-[11px]">VHS_VideoCombine</code>
+ </p>
+ <p className="text-[11px] text-yellow-100/80 leading-relaxed">
+ Without it, video generation falls back to <code className="font-mono text-[10px] bg-black/40 px-1 rounded">SaveAnimatedWEBP</code> and produces an animated <code className="font-mono text-[10px] bg-black/40 px-1 rounded">.webp</code> file instead of a real <code className="font-mono text-[10px] bg-black/40 px-1 rounded">.mp4</code> video.
+ </p>
+ </div>
+ </div>
+
+ <div className="text-[11px] text-gray-400 leading-relaxed">
+ The installer runs <code className="font-mono bg-white/5 px-1 rounded">git clone</code> on{' '}
+ <a
+ href="https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite"
+ target="_blank"
+ rel="noreferrer"
+ className="text-blue-400 hover:text-blue-300 underline"
+ >
+ Kosinkadink/ComfyUI-VideoHelperSuite
+ </a>
+ {' '}(~5 MB) into your <code className="font-mono bg-white/5 px-1 rounded">ComfyUI/custom_nodes/</code> folder, runs <code className="font-mono bg-white/5 px-1 rounded">pip install</code> for its requirements, and restarts ComfyUI. Takes about 30 seconds.
+ </div>
+
+ <div className="flex flex-col gap-2 pt-1">
+ <button
+ onClick={() => choose('install')}
+ className="w-full px-4 py-2 rounded-lg bg-blue-500/20 hover:bg-blue-500/30 border border-blue-500/30 text-blue-200 text-sm font-medium transition-colors flex items-center justify-center gap-2"
+ >
+ <Download size={14} />
+ Install VHS_VideoCombine + continue
+ </button>
+ <button
+ onClick={() => choose('webp')}
+ className="w-full px-4 py-2 rounded-lg bg-white/5 hover:bg-white/10 border border-white/10 text-gray-300 text-xs font-medium transition-colors"
+ >
+ Continue anyway with animated .webp
+ </button>
+ <button
+ onClick={() => choose('cancel')}
+ className="w-full px-4 py-1.5 rounded-lg hover:bg-white/5 text-gray-500 hover:text-gray-300 text-xs transition-colors"
+ >
+ Cancel generation
+ </button>
+ </div>
+ </div>
+ </Modal>
+ )
+}
diff --git a/src/hooks/useCreate.ts b/src/hooks/useCreate.ts
index b70b5fae..fdb73c20 100644
--- a/src/hooks/useCreate.ts
+++ b/src/hooks/useCreate.ts
@@ -25,8 +25,10 @@ import {
LOADER_NODES, CLIP_LOADER_NODES, VAE_LOADER_NODES, SAMPLER_NODES, DECODE_NODES,
type ComfyWSEvent,
} from '../api/comfyui-ws'
-import { buildDynamicWorkflow } from '../api/dynamic-workflow'
-import { getAllNodeInfo } from '../api/comfyui-nodes'
+import { buildDynamicWorkflow, checkVideoOutputCapability } from '../api/dynamic-workflow'
+import { getAllNodeInfo, clearNodeCache } from '../api/comfyui-nodes'
+import { installCustomNodes } from '../api/discover'
+import { backendCall } from '../api/backend'
import { checkPromptSafety, SAFETY_BLOCK_MESSAGE } from '../lib/render/safety'
import { useCreateStore } from '../stores/createStore'
import { useWorkflowStore } from '../stores/workflowStore'
@@ -364,6 +366,81 @@ export function useCreate() {
workflow = await buildTxt2ImgWorkflow(baseParams, imageModelType)
}
}
+ // Bug A (v2.4.5 — miguelkodoatie Discord 2026-05-14, Turbulent_Tomato7559
+ // Reddit 2026-05-10): when ComfyUI lacks VHS_VideoCombine the video
+ // workflow falls back to SaveAnimatedWEBP and produces an animated
+ // .webp instead of an .mp4. v2.4.4 added a warning banner; v2.4.5
+ // turns it into a blocking modal with a one-click install, so users
+ // get actual videos instead of trying to figure out why "video gen"
+ // gave them an image.
+ if (mode === 'video' && builderUsed === 'dynamic') {
+ try {
+ const caps = await checkVideoOutputCapability()
+ if (caps.webpOnly) {
+ const choice = await new Promise<'install' | 'webp' | 'cancel'>((resolve) => {
+ useCreateStore.getState().setVhsInstallPrompt(resolve)
+ })
+ useCreateStore.getState().setVhsInstallPrompt(null)
+
+ if (choice === 'cancel') {
+ setIsGenerating(false)
+ setProgress(0, '')
+ return
+ }
+ if (choice === 'install') {
+ setProgress(8, 'Installing VHS_VideoCombine (git clone + pip)...')
+ try {
+ await installCustomNodes(['videohelpersuite'])
+ setProgress(9, 'Restarting ComfyUI to register the new node...')
+ try {
+ await backendCall('stop_comfyui')
+ } catch { /* may already be stopped */ }
+ await new Promise(r => setTimeout(r, 2000))
+ await backendCall('start_comfyui')
+ // Wait for ComfyUI to come back; poll /object_info up to 30s
+ let backUp = false
+ for (let i = 0; i < 15; i++) {
+ await new Promise(r => setTimeout(r, 2000))
+ try {
+ const ok = await checkComfyConnection()
+ if (ok) { backUp = true; break }
+ } catch { /* not yet */ }
+ }
+ if (!backUp) {
+ setError('VHS_VideoCombine installed but ComfyUI did not come back online within 30s. Please restart ComfyUI manually and re-generate.')
+ setIsGenerating(false)
+ return
+ }
+ // #72 (bob): the node catalogue is cached for 5 minutes, so
+ // without a forced refresh the rebuild below still saw the
+ // pre-install catalogue (no VHS) and silently produced a
+ // .webp even after a successful install + restart.
+ clearNodeCache()
+ const capsAfter = await checkVideoOutputCapability()
+ if (!capsAfter.mp4Capable) {
+ setError(
+ 'VHS_VideoCombine was installed and ComfyUI restarted, but ComfyUI still does not list the node. ' +
+ 'Check the ComfyUI startup log for "IMPORT FAILED: ComfyUI-VideoHelperSuite" (usually a Python requirements problem), then generate again.'
+ )
+ setIsGenerating(false)
+ return
+ }
+ // Re-build the workflow now that the new node is available
+ const genParams = { ...baseParams, frames, fps, ...(effI2vImage ? { inputImage: effI2vImage } : {}) }
+ workflow = await buildDynamicWorkflow(genParams, imageModelType)
+ setProgress(10, 'VHS installed — generating MP4...')
+ } catch (instErr) {
+ setError(`Failed to install VHS_VideoCombine: ${instErr instanceof Error ? instErr.message : String(instErr)}. You can install it manually in ComfyUI Manager.`)
+ setIsGenerating(false)
+ return
+ }
+ } else {
+ // 'webp' — user opted to continue with the animated .webp
+ setProgress(8, 'Continuing with animated .webp output (no VHS_VideoCombine)')
+ }
+ }
+ } catch { /* non-fatal */ }
+ }
}
setProgress(10, 'Submitting to ComfyUI...')
diff --git a/src/stores/createStore.ts b/src/stores/createStore.ts
index 66d031f3..6f7be55d 100644
--- a/src/stores/createStore.ts
+++ b/src/stores/createStore.ts
@@ -201,6 +201,10 @@ interface CreateState {
imageModelList: ClassifiedModel[]
videoModelList: ClassifiedModel[]
comfyRunning: boolean
+ /** Bug A (v2.4.5) + #72 (bob): resolver for the VHS_VideoCombine install
+ * prompt. Runtime-only — useCreate sets it when a video gen would fall
+ * 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
@@ -246,6 +250,7 @@ interface CreateState {
setProgress: (progress: number, text?: string) => void
setProgressPhase: (phase: ProgressPhase) => void
setCurrentPromptId: (id: string | null) => void
+ setVhsInstallPrompt: (resolver: ((choice: 'install' | 'webp' | 'cancel') => void) | null) => void
setError: (error: string | null) => void
setLastGenTime: (time: string | null) => void
addToGallery: (item: GalleryItem) => void
@@ -328,6 +333,7 @@ export const useCreateStore = create<CreateState>()(
imageModelList: [],
videoModelList: [],
comfyRunning: false,
+ vhsInstallPrompt: null,
setPreflightStatus: (ready, errors, warnings) => set({ preflightReady: ready, preflightErrors: errors, preflightWarnings: warnings }),
setVideoBackend: (videoBackend) => set({ videoBackend, videoBackendInitialized: true }),
@@ -459,6 +465,7 @@ export const useCreateStore = create<CreateState>()(
setProgress: (progress, text) => set({ progress, progressText: text ?? '' }),
setProgressPhase: (phase) => set({ progressPhase: phase }),
setCurrentPromptId: (id) => set({ currentPromptId: id }),
+ setVhsInstallPrompt: (resolver) => set({ vhsInstallPrompt: resolver }),
setError: (error) => set({ error }),
setLastGenTime: (time) => set({ lastGenTime: time }),
addToGallery: (item) => set((s) => ({ gallery: [item, ...s.gallery].slice(0, 200) })),