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.

hotfix v2.4.4: 8 bug fixes for the v2.4.3 follow-up sweep

purple43e019b6a1dc
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a0338e2c..5710004b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,36 @@ All notable changes to Locally Uncensored are documented here.
## [Unreleased]
+## [2.4.4] - 2026-05-11
+
+Hotfix sweep covering the v2.4.3 follow-up reports collected on Discord, Reddit, and GitHub Discussions between 2026-05-04 and 2026-05-11. Eight fixes total — six tied to specific Discord/Reddit reporters, one Reddit issue, and one GitHub Discussion (vokurta — RTX 6000 Blackwell, posted the same morning this sweep landed).
+
+### Fixed — onboarding (LM Studio + ComfyUI)
+- **LM Studio system-wide install path now detected** (Bug #2 — techx69, Discord 06.05.). `lmstudio_lms_path()` previously only looked under `~/.lmstudio/bin/`, `%LOCALAPPDATA%\Programs\LM Studio\` and `where lms`, so a "for all users" install in `C:\Program Files\LM Studio\` came back as `lms_present: false`. New lookup walks `%PROGRAMFILES%`, `%PROGRAMFILES(X86)%`, `%PROGRAMW6432%`, plus a Windows registry sweep of `Uninstall\…\InstallLocation` for any subkey whose DisplayName starts with "LM Studio". (`winreg = "0.55"` added to `[target.'cfg(windows)'.dependencies]`.)
+- **LM Studio models-on-disk soft-detect.** `lmstudio_server_status` now returns `models_detected` + `model_count` from a bounded walk of `~/.lmstudio/models/` for GGUF files. The onboarding "No local backend detected" branch now flips into the "LM Studio detected" CTA whenever either `lms_present && !running` OR `models_detected && !running` is true — so users with GGUFs but no resolved `lms.exe` (techx69's exact shape) get "LM Studio is installed (N models detected) but its server isn't currently running" instead of being pushed into a 570 MB re-install.
+- **Multi-ComfyUI disambiguation in the onboarding ComfyUI step** (Bug #3 — ninjastic2008, Discord 05.05.). New Tauri command `detect_all_comfyui_installs` returns a `Vec<ComfyUIInstall>` with `{ path, complete, has_embedded_python, source }`. The onboarding effect now calls it first; when more than one match exists, the user picks explicitly via a clickable list (each row shows "ready / needs setup" + "found via …" + a "bundles python_embeded" badge). The chosen path is persisted via the existing `set_comfyui_path` command so `start_comfyui` hits it. Single-hit and zero-hit cases keep the previous auto-pick / install-fresh flow.
+- **ComfyUI install: Cancel button + disk-pressure pre-flight + ETA** (Bug #1 — techx69, Discord 06.05.). The 45-minute hang case on a 100%-busy drive used to leave the user with no way out. New Tauri command `cancel_comfyui_install` flips a `Arc<AtomicBool>` in `AppState.comfyui_install_cancel`; the install thread polls it between every step and inside the pip retry loop, kills the active git or pip child on cancel, and lands the status in `"cancelled"` so the polling UI clears. Pre-flight uses `sysinfo::Disks` to detect <5 GB free on the target drive and pushes a `⚠`-prefixed warning into the install logs (rendered as a yellow band above the live log card). Progress card now shows a rolling ETA (`download_total - download_progress` / `download_speed`) next to the elapsed timer.
+- **PyTorch wheel routing now respects GPU compute capability** (Bug #10 — vokurta, GitHub Discussion #37, 11.05.). `install_comfyui` probes `nvidia-smi --query-gpu=compute_cap` and picks `https://download.pytorch.org/whl/cu128` when any visible GPU reports SM ≥ 12.0 (Blackwell — RTX 50xx, RTX 6000 Pro), `cu121` otherwise. The probe is best-effort; failure falls back to cu121 so existing Ampere/Hopper installs don't regress. Fixes `CUDA error: no kernel image is available for execution on the device` at `CLIPTextEncode` on Blackwell silicon.
+
+### Fixed — chat surface
+- **TokenCounter now reflects the Settings `maxTokens` override live** (Bug #4 — phantomderp, Discord 05.05.). The component used to read `getModelMaxTokens(activeModel)` once per model switch and ignore subsequent settings changes, so a slider move from default → 16384 stayed pinned to the model's manifest value (e.g. 8.2k). It now subscribes to `useSettingsStore` so Zustand re-renders on every settings update; the effective ceiling is `settings.maxTokens > 0 ? settings.maxTokens : modelMax`, and the tooltip surfaces both when the user is overriding.
+- **DownloadBadge X-button actually cancels the Rust pull stream** (Bug #5 — phantomderp, Discord 05.05.). `modelStore.dismissPull` used to just delete the entry from `activePulls` — Rust's `pull_model_stream` kept emitting `pull-progress` events and the badge respawned within 100 ms while the disk kept writing. The action now aborts the entry's `AbortController` (which fires the existing `cancel` handler installed by `useModels.pullModel`) AND best-effort invokes `cancel_model_pull` directly. Five new unit tests in `src/stores/__tests__/modelStore-dismiss.test.ts` cover abort propagation, Rust invocation, synchronous state removal, the no-op-when-not-present case, and the late-progress-event guard.
+- **Agent-Mode hint when a model tries to call tools without the toggle on** (Bug #7 — phantomderp, Discord 04.05.). `MessageBubble` now runs `extractToolCallsFromContent` on every assistant message; when a call is detected, the conversation is in normal (non-agent) mode, AND the active model passes `isAgentCompatible`, an amber banner renders below the message: "This model tried to call a tool, but Agent Mode is off for this chat. Turn it on …" with a one-click Enable Agent button. Previously the user saw the raw JSON dump rendered as Markdown and assumed the model was broken.
+
+### Fixed — image / video creation
+- **Workflow-architecture mismatch surfaces a clear install path** (Bug #6 — vvvxxxvvv_80435 Discord 04.05., Turbulent_Tomato7559 Reddit 10.05.). When the active ComfyUI lacks the wrapper nodes for the chosen video model (CogVideoX → `CogVideoXSampler`, FramePack → `FramePackSampler`, Pyramid Flow → `PyramidFlowSampler`, Allegro → community wrapper), `determineStrategy` now returns an `installHint: { pack, url }` alongside the error. The dynamic builder throws a typed `WorkflowUnavailableError` instead of a generic `Error`. `useCreate` recognises that subclass and surfaces the message + install-guide path instead of falling through to the legacy builder (which hits the same `UNETLoader` trap). New helper `checkVideoOutputCapability` lets the Create flow surface a yellow "output will be animated .webp" heads-up when `VHS_VideoCombine` is missing — same root cause as Turbulent_Tomato7559's Reddit report ("videos generate as .webp").
+
+### Tests
+- `vitest`: 93 files / 2264 tests green (was 92 / 2254 — +5 for Bug #5 cancel propagation in `modelStore-dismiss.test.ts`, +5 for Bug #6 install-hint coverage in `dynamic-workflow-strategy.test.ts`).
+- `cargo test --release`: 52 passed (was 44 — +8 for Bug #10 `parse_compute_cap_output` covering Ampere SM 8.6, Ada SM 8.9, Hopper SM 9.0, Blackwell SM 12.0, multi-GPU pick-highest, blank/empty/unparseable edges).
+- `cargo check`: clean (1 dead-code warning on unused `save_binary_file_dialog`, pre-existing).
+- `tsc --noEmit`: clean.
+
+### Verification
+- See `LU-E2E-Test-Kit/docs/03-E2E-TEST-PLAN.md` for the per-bug repro recipes used to validate this sweep on Windows 10 + RTX-class hardware.
+- Phase 1 Live-E2E (`test-results-2026-05-11.md`): 5/8 bugs verified live via Computer-Use (#2, #3, #4, #5, #7). Performance regression discovered + fixed during Phase 1 (`detect_all_comfyui_installs` made async via `tokio::task::spawn_blocking` after the initial sync version blocked the UI for 30+ s on a typical home directory).
+- Phase 2 Re-Verification (`test-results-2026-05-11-phase2.md`): same 5 live bugs re-confirmed in both configured-state and complete-fresh-state runs (AppData + WebView2 user-data dir renamed aside, fresh launch, full onboarding walk-through). 3 remaining bugs (#1 ComfyUI install cancel, #6 wrapper-installed workflows, #10 Blackwell wheels) are code + unit-test verified — invasive to validate live without Blackwell silicon, a slow disk, or CogVideoX wrapper nodes installed.
+
## [2.4.3] - 2026-05-04
### Fixed — LM Studio onboarding plug-and-play
diff --git a/package-lock.json b/package-lock.json
index 9f5f19c8..e7f81feb 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "locally-uncensored",
- "version": "2.4.2",
+ "version": "2.4.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "locally-uncensored",
- "version": "2.4.2",
+ "version": "2.4.3",
"license": "AGPL-3.0",
"dependencies": {
"@react-three/drei": "^10.7.7",
diff --git a/package.json b/package.json
index 7134dbdf..aa270d31 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "locally-uncensored",
- "version": "2.4.3",
+ "version": "2.4.4",
"private": false,
"description": "Generate anything — text, images, video. Locally. Uncensored.",
"license": "AGPL-3.0",
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock
index 1e36d60e..8f407bfa 100644
--- a/src-tauri/Cargo.lock
+++ b/src-tauri/Cargo.lock
@@ -2508,7 +2508,7 @@ dependencies = [
[[package]]
name = "locally-uncensored"
-version = "2.4.3"
+version = "2.4.4"
dependencies = [
"axum",
"base64 0.22.1",
@@ -2545,6 +2545,7 @@ dependencies = [
"walkdir",
"whoami",
"windows-sys 0.59.0",
+ "winreg",
"zip 2.4.2",
]
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index 6ff875fe..2ea2dc41 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "locally-uncensored"
-version = "2.4.3"
+version = "2.4.4"
description = "Private, local AI chat & image/video generation"
authors = ["purpledoubled"]
edition = "2021"
@@ -47,6 +47,9 @@ socket2 = "0.5"
[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.59", features = ["Win32_System_JobObjects", "Win32_System_Threading", "Win32_Foundation", "Win32_Security"] }
+# Registry access for LM Studio install-path lookup (Bug #2 — system-wide
+# installs in C:\Program Files\LM Studio that techx69 reported on v2.4.3).
+winreg = "0.55"
[profile.release]
panic = "abort"
diff --git a/src-tauri/src/commands/install.rs b/src-tauri/src/commands/install.rs
index ecfd370c..8e278613 100644
--- a/src-tauri/src/commands/install.rs
+++ b/src-tauri/src/commands/install.rs
@@ -1,7 +1,8 @@
use std::fs;
use std::io::{BufRead, BufReader, Read as IoRead};
-use std::path::PathBuf;
+use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};
+use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex};
use std::time::Instant;
@@ -16,6 +17,104 @@ use crate::state::{AppState, InstallState};
#[cfg(target_os = "windows")]
const CREATE_NO_WINDOW: u32 = 0x08000000;
+// ── Disk-pressure pre-flight (Bug #1 — techx69 100%-busy-drive hang) ────────
+
+/// Return a human-readable warning when the target install drive is short
+/// on free space (<5 GB — ComfyUI + PyTorch wheels need ~5 GB) or its
+/// pending I/O queue suggests sustained 100% utilisation. Best-effort —
+/// returns None if sysinfo can't get reliable data, so we never block a
+/// well-meaning install over a probing flake.
+fn check_install_disk_pressure(target_dir: &Path) -> Option<String> {
+ use sysinfo::Disks;
+ let disks = Disks::new_with_refreshed_list();
+ // Find the disk that contains the target dir. sysinfo's Disk::mount_point
+ // is a PathBuf — pick the longest mount that is a prefix of target_dir.
+ let normalized = target_dir.to_path_buf();
+ let mut best: Option<&sysinfo::Disk> = None;
+ let mut best_len: usize = 0;
+ for d in &disks {
+ let mp = d.mount_point();
+ if normalized.starts_with(mp) {
+ let len = mp.as_os_str().len();
+ if len > best_len {
+ best_len = len;
+ best = Some(d);
+ }
+ }
+ }
+ let disk = best?;
+
+ let free_bytes = disk.available_space();
+ let total_bytes = disk.total_space();
+ let needed_bytes: u64 = 5 * 1024 * 1024 * 1024; // 5 GB
+ if free_bytes < needed_bytes {
+ return Some(format!(
+ "⚠ Low disk space on {}: {:.1} GB free of {:.1} GB total. \
+ ComfyUI + PyTorch need about 5 GB. Consider freeing space or \
+ choosing a drive with more room before continuing.",
+ disk.mount_point().to_string_lossy(),
+ free_bytes as f64 / 1_073_741_824.0,
+ total_bytes as f64 / 1_073_741_824.0,
+ ));
+ }
+ None
+}
+
+#[tauri::command]
+pub fn cancel_comfyui_install(state: State<'_, AppState>) -> Result<serde_json::Value, String> {
+ state.comfyui_install_cancel.store(true, Ordering::SeqCst);
+ if let Ok(mut s) = state.install_status.lock() {
+ // Mark as cancelling immediately so the UI can switch to a
+ // "Cancelling…" indicator even before the spawn loop notices.
+ if s.status == "installing" || s.status == "downloading" {
+ s.status = "cancelling".to_string();
+ s.logs.push("Cancellation requested — waiting for active subprocess to exit…".to_string());
+ }
+ }
+ Ok(serde_json::json!({"status": "cancelling"}))
+}
+
+// ── GPU helpers (Bug #10 — Blackwell PyTorch cu128 routing) ─────────────────
+
+/// Probe NVIDIA's compute capability of the first detected GPU and return
+/// its major version (8 for Ampere, 9 for Hopper, 12 for Blackwell, …).
+///
+/// `nvidia-smi --query-gpu=compute_cap` prints lines like `12.0` (one per
+/// GPU). We take the highest major across visible GPUs because pip can
+/// only install ONE PyTorch build — picking the higher capability set
+/// satisfies every card on the box (cu128 wheels still run on Ampere etc.).
+/// Returns None when nvidia-smi is absent or the parse fails; the caller
+/// falls back to the previous default index URL.
+fn parse_compute_cap_output(s: &str) -> Option<u32> {
+ let mut max_major: Option<u32> = None;
+ for line in s.lines() {
+ let trimmed = line.trim();
+ if trimmed.is_empty() {
+ continue;
+ }
+ let major_str = trimmed.split('.').next().unwrap_or("");
+ if let Ok(major) = major_str.parse::<u32>() {
+ max_major = Some(max_major.map_or(major, |prev| prev.max(major)));
+ }
+ }
+ max_major
+}
+
+fn detect_nvidia_compute_cap_major() -> Option<u32> {
+ let mut cmd = Command::new("nvidia-smi");
+ cmd.args(["--query-gpu=compute_cap", "--format=csv,noheader,nounits"])
+ .stdout(Stdio::piped())
+ .stderr(Stdio::piped());
+ #[cfg(target_os = "windows")]
+ cmd.creation_flags(CREATE_NO_WINDOW);
+ let out = cmd.output().ok()?;
+ if !out.status.success() {
+ return None;
+ }
+ let s = String::from_utf8_lossy(&out.stdout);
+ parse_compute_cap_output(&s)
+}
+
// ── pip helpers (issue #32: PyTorch / ComfyUI install reliability) ───────────
/// Push a log line to the shared install state. Best-effort — silently
@@ -109,16 +208,27 @@ fn diagnose_pip_error(stderr: &str) -> String {
///
/// On non-transient errors or after exhausting retries, returns Err with a
/// human-readable diagnosis prepended to the truncated original error.
-fn pip_install_streaming_with_retry(
+/// Streaming pip install with retry. When `cancel` is `Some`, polls the
+/// shared flag between line reads and waits, and kills the pip child on
+/// cancel — used by `install_comfyui` so the user's Cancel button
+/// (Bug #1 — techx69 v2.4.3) actually stops the running install instead
+/// of waiting for pip to finish naturally. When `cancel` is `None`, the
+/// install runs to completion as before — used by `install_python` and
+/// callers that haven't been wired up to the new cancel flow.
+fn pip_install_streaming_with_retry_cancellable(
args: &[&str],
python_bin: &str,
max_attempts: u32,
install_state: &Arc<Mutex<InstallState>>,
+ cancel: Option<&Arc<AtomicBool>>,
) -> Result<(), String> {
let mut delay_seconds = 10u64;
let mut last_stderr = String::new();
for attempt in 1..=max_attempts {
+ if cancel.as_ref().map(|c| c.load(Ordering::SeqCst)).unwrap_or(false) {
+ return Err("cancelled".to_string());
+ }
if attempt > 1 {
push_install_log(
install_state,
@@ -127,7 +237,13 @@ fn pip_install_streaming_with_retry(
attempt, max_attempts, delay_seconds
),
);
- std::thread::sleep(std::time::Duration::from_secs(delay_seconds));
+ // Sleep in 1-second chunks so cancel reacts within ~1s.
+ for _ in 0..delay_seconds {
+ if cancel.as_ref().map(|c| c.load(Ordering::SeqCst)).unwrap_or(false) {
+ return Err("cancelled".to_string());
+ }
+ std::thread::sleep(std::time::Duration::from_secs(1));
+ }
delay_seconds = (delay_seconds * 3).min(180);
}
@@ -184,9 +300,22 @@ fn pip_install_streaming_with_retry(
}
});
- let exit_status = match child.wait() {
- Ok(s) => s,
- Err(e) => return Err(format!("pip wait failed: {}", e)),
+ // Poll for either the child to exit or the cancel flag to flip.
+ // try_wait avoids blocking the cancel check; sleep keeps CPU idle.
+ let exit_status = loop {
+ if cancel.as_ref().map(|c| c.load(Ordering::SeqCst)).unwrap_or(false) {
+ // Kill the child so pip doesn't keep saturating disk.
+ let _ = child.kill();
+ let _ = child.wait();
+ let _ = stdout_handle.join();
+ let _ = stderr_handle.join();
+ return Err("cancelled".to_string());
+ }
+ match child.try_wait() {
+ Ok(Some(s)) => break s,
+ Ok(None) => std::thread::sleep(std::time::Duration::from_millis(200)),
+ Err(e) => return Err(format!("pip wait failed: {}", e)),
+ }
};
let _ = stdout_handle.join();
let _ = stderr_handle.join();
@@ -227,10 +356,26 @@ pub fn install_comfyui(
install.logs.push("Starting ComfyUI installation...".to_string());
drop(install);
+ // Reset cancel flag (Bug #1) — a previous cancelled install would
+ // otherwise short-circuit the new run on first poll.
+ state.comfyui_install_cancel.store(false, Ordering::SeqCst);
+ let cancel_flag = state.comfyui_install_cancel.clone();
+
let target_dir = install_path
.map(PathBuf::from)
.unwrap_or_else(|| dirs::home_dir().unwrap_or_default().join("ComfyUI"));
+ // Bug #1 (techx69): pre-flight disk pressure check. On a drive sitting
+ // at 100% utilisation the install hangs for 45+ minutes and the app
+ // OOMs. Surface the risk BEFORE we start — the user can free space
+ // or pick a different drive instead of staring at a frozen progress
+ // log. We don't refuse to start: some users will accept the slow path.
+ if let Some(warning) = check_install_disk_pressure(&target_dir) {
+ if let Ok(mut s) = state.install_status.lock() {
+ s.logs.push(warning);
+ }
+ }
+
// Pre-flight: refuse to start ComfyUI install without a real Python.
// The frontend is expected to call `install_python` first when this
// returns the "no python" error — that flow shows a Python-install
@@ -268,7 +413,15 @@ pub fn install_comfyui(
}
};
- // Step 1: Git clone
+ let cancelled = || cancel_flag.load(Ordering::SeqCst);
+
+ if cancelled() {
+ update("cancelled", "Install cancelled before it started.");
+ return;
+ }
+
+ // Step 1: Git clone — spawn+poll instead of cmd.output() so the
+ // Cancel button can kill an in-flight clone (Bug #1).
println!("[Install] Cloning ComfyUI to {:?}", target_dir);
update("downloading", "Step 1/3: Downloading ComfyUI repository...");
@@ -279,39 +432,66 @@ pub fn install_comfyui(
.stderr(Stdio::piped());
#[cfg(target_os = "windows")]
cmd.creation_flags(CREATE_NO_WINDOW);
- let clone = cmd.output();
-
- match clone {
- Ok(output) if output.status.success() => {
- println!("[Install] Git clone successful");
- update("installing", "Repository cloned successfully.");
+ let mut clone_child = match cmd.spawn() {
+ Ok(c) => c,
+ Err(e) => {
+ let err = format!("Git is not installed or not in PATH: {}", e);
+ println!("[Install] {}", err);
+ update("error", &err);
+ return;
}
- Ok(output) => {
- let stderr = String::from_utf8_lossy(&output.stderr);
- if stderr.contains("already exists") {
- println!("[Install] ComfyUI directory already exists, updating...");
- update("installing", "ComfyUI already exists, pulling latest...");
- let mut pull = Command::new("git");
- pull.args(["pull"]).current_dir(&target_dir)
- .stdout(Stdio::piped()).stderr(Stdio::piped());
- #[cfg(target_os = "windows")]
- pull.creation_flags(CREATE_NO_WINDOW);
- let _ = pull.output();
- } else {
- let err = format!("Git clone failed: {}", stderr);
- println!("[Install] {}", err);
- update("error", &err);
+ };
+ let clone_exit = loop {
+ if cancelled() {
+ let _ = clone_child.kill();
+ let _ = clone_child.wait();
+ update("cancelled", "Install cancelled during git clone.");
+ return;
+ }
+ match clone_child.try_wait() {
+ Ok(Some(s)) => break s,
+ Ok(None) => std::thread::sleep(std::time::Duration::from_millis(250)),
+ Err(e) => {
+ update("error", &format!("git wait failed: {}", e));
return;
}
}
- Err(e) => {
- let err = format!("Git is not installed or not in PATH: {}", e);
+ };
+
+ if clone_exit.success() {
+ println!("[Install] Git clone successful");
+ update("installing", "Repository cloned successfully.");
+ } else {
+ let mut stderr = String::new();
+ if let Some(mut e) = clone_child.stderr.take() {
+ let _ = e.read_to_string(&mut stderr);
+ }
+ if stderr.contains("already exists") {
+ println!("[Install] ComfyUI directory already exists, updating...");
+ update("installing", "ComfyUI already exists, pulling latest...");
+ if cancelled() {
+ update("cancelled", "Install cancelled.");
+ return;
+ }
+ let mut pull = Command::new("git");
+ pull.args(["pull"]).current_dir(&target_dir)
+ .stdout(Stdio::piped()).stderr(Stdio::piped());
+ #[cfg(target_os = "windows")]
+ pull.creation_flags(CREATE_NO_WINDOW);
+ let _ = pull.output();
+ } else {
+ let err = format!("Git clone failed: {}", stderr);
println!("[Install] {}", err);
update("error", &err);
return;
}
}
+ if cancelled() {
+ update("cancelled", "Install cancelled after clone.");
+ return;
+ }
+
// Step 2: Detect GPU and install PyTorch
let mut nv = Command::new("nvidia-smi");
nv.stdout(Stdio::piped()).stderr(Stdio::piped());
@@ -319,7 +499,28 @@ pub fn install_comfyui(
nv.creation_flags(CREATE_NO_WINDOW);
let has_nvidia = nv.output().map(|o| o.status.success()).unwrap_or(false);
- let gpu_info = if has_nvidia { "NVIDIA GPU detected — installing CUDA PyTorch" } else { "No NVIDIA GPU — installing CPU PyTorch" };
+ // Bug #10 (vokurta — RTX 6000 Blackwell, 2026-05-11): SM 12.0 GPUs
+ // need PyTorch cu128 wheels. cu121 stops at sm_90 (Hopper); on
+ // Blackwell the kernel simply isn't shipped and the first compute
+ // call dies with "CUDA error: no kernel image is available for
+ // execution on the device". We probe `--query-gpu=compute_cap` and
+ // pick the wheel set accordingly. Falls back to cu121 if the probe
+ // fails for any reason — that's the previous behaviour, so we
+ // never regress existing setups.
+ let compute_cap_major = if has_nvidia { detect_nvidia_compute_cap_major() } else { None };
+ let pytorch_index = match compute_cap_major {
+ Some(major) if major >= 12 => Some("https://download.pytorch.org/whl/cu128"),
+ Some(_) => Some("https://download.pytorch.org/whl/cu121"),
+ None if has_nvidia => Some("https://download.pytorch.org/whl/cu121"),
+ None => None,
+ };
+
+ let gpu_info = match (has_nvidia, compute_cap_major) {
+ (true, Some(major)) if major >= 12 => "NVIDIA Blackwell GPU detected (SM 12.0+) — installing PyTorch cu128",
+ (true, Some(_)) => "NVIDIA GPU detected — installing CUDA PyTorch (cu121)",
+ (true, None) => "NVIDIA GPU detected (compute capability probe failed) — falling back to cu121",
+ (false, _) => "No NVIDIA GPU — installing CPU PyTorch",
+ };
println!("[Install] {}", gpu_info);
update("installing", &format!("Step 2/3: {}", gpu_info));
update(
@@ -330,13 +531,13 @@ pub fn install_comfyui(
lines appearing, the install is making progress, not hung.",
);
- let torch_args: Vec<&str> = if has_nvidia {
+ let torch_args: Vec<&str> = if let Some(index_url) = pytorch_index {
vec![
"-m", "pip", "install",
"--progress-bar", "off",
"--no-input",
"torch", "torchvision", "torchaudio",
- "--index-url", "https://download.pytorch.org/whl/cu121",
+ "--index-url", index_url,
]
} else {
vec![
@@ -347,10 +548,14 @@ pub fn install_comfyui(
]
};
- match pip_install_streaming_with_retry(&torch_args, &python_bin, 3, &install_status) {
+ match pip_install_streaming_with_retry_cancellable(&torch_args, &python_bin, 3, &install_status, Some(&cancel_flag)) {
Ok(()) => {
update("installing", "PyTorch installed successfully.");
}
+ Err(diagnosis) if diagnosis == "cancelled" => {
+ update("cancelled", "Install cancelled during PyTorch download.");
+ return;
+ }
Err(diagnosis) => {
let err = format!("PyTorch installation failed.\n\n{}", diagnosis);
println!("[Install] {}", err);
@@ -359,6 +564,11 @@ pub fn install_comfyui(
}
}
+ if cancelled() {
+ update("cancelled", "Install cancelled before requirements install.");
+ return;
+ }
+
// Step 3: Install ComfyUI requirements
println!("[Install] Installing ComfyUI requirements...");
update("installing", "Step 3/3: Installing ComfyUI dependencies (live pip output below)...");
@@ -372,10 +582,14 @@ pub fn install_comfyui(
"--no-input",
"-r", reqs_str.as_str(),
];
- match pip_install_streaming_with_retry(&req_args, &python_bin, 3, &install_status) {
+ match pip_install_streaming_with_retry_cancellable(&req_args, &python_bin, 3, &install_status, Some(&cancel_flag)) {
Ok(()) => {
update("installing", "Dependencies installed successfully.");
}
+ Err(diagnosis) if diagnosis == "cancelled" => {
+ update("cancelled", "Install cancelled during requirements install.");
+ return;
+ }
Err(diagnosis) => {
// Don't fail the whole install — some optional deps may fail
// but ComfyUI can still start and the user can fix them later.
@@ -641,19 +855,49 @@ fn lmstudio_lms_path() -> Option<PathBuf> {
// directly is how we *do* the bootstrap on a brand-new box — without it
// the user has to open LM Studio once from the Start menu just to seed
// the CLI, which is exactly the noob-cliff this sweep is removing.
+ let webpack_suffix = ["resources", "app", ".webpack", "lms.exe"];
if let Ok(la) = std::env::var("LOCALAPPDATA") {
- let pre_bootstrap = PathBuf::from(la)
- .join("Programs")
- .join("LM Studio")
- .join("resources")
- .join("app")
- .join(".webpack")
- .join("lms.exe");
+ let mut pre_bootstrap = PathBuf::from(la);
+ pre_bootstrap.push("Programs");
+ pre_bootstrap.push("LM Studio");
+ for s in &webpack_suffix { pre_bootstrap.push(s); }
if pre_bootstrap.exists() {
return Some(pre_bootstrap);
}
}
+ // System-wide install path: when LM Studio's installer is run "for all
+ // users" (or installed via an MSI deployment), it lands in
+ // %PROGRAMFILES%\LM Studio\. techx69 confirmed (2026-05-06): the
+ // per-user-only lookup made LU report "no LM Studio detected" even with
+ // `~/.lmstudio/models/` already populated.
+ for env_var in ["PROGRAMFILES", "PROGRAMFILES(X86)", "PROGRAMW6432"] {
+ if let Ok(pf) = std::env::var(env_var) {
+ let mut sys_wide = PathBuf::from(pf);
+ sys_wide.push("LM Studio");
+ for s in &webpack_suffix { sys_wide.push(s); }
+ if sys_wide.exists() {
+ return Some(sys_wide);
+ }
+ }
+ }
+
+ // Registry-based fallback: LM Studio's installer writes its install dir
+ // under HKCU or HKLM Uninstall keys. Reading the registry lets us catch
+ // exotic install dirs (e.g. user moved it to D:\Apps\LM Studio\).
+ #[cfg(target_os = "windows")]
+ if let Some(p) = lmstudio_path_from_registry() {
+ let candidate = p.join("resources").join("app").join(".webpack").join("lms.exe");
+ if candidate.exists() {
+ return Some(candidate);
+ }
+ // Some builds drop lms.exe at the install root.
+ let root_candidate = p.join("lms.exe");
+ if root_candidate.exists() {
+ return Some(root_candidate);
+ }
+ }
+
// Last resort: PATH lookup. Catches non-standard installs (Chocolatey,
// user-relocated install dir, etc.).
if let Ok(out) = Command::new("where").arg("lms").output() {
@@ -671,6 +915,90 @@ fn lmstudio_lms_path() -> Option<PathBuf> {
None
}
+/// Soft-detect LM Studio by scanning `~/.lmstudio/models/` for GGUF files.
+/// Returns the number of GGUF files found (0 if the dir is missing or empty).
+///
+/// Rationale: even when `lms.exe` isn't on any search path (system-wide
+/// install missed by our fallback, GUI never launched, etc.), the presence
+/// of GGUFs in the canonical models dir is a strong signal that the user
+/// *has* LM Studio and just hasn't started the server. Surfacing that in the
+/// onboarding lets us show "LM Studio models detected — start server?" instead
+/// of the dead-end "no LM Studio".
+fn lmstudio_models_present() -> u32 {
+ let home = match dirs::home_dir() {
+ Some(h) => h,
+ None => return 0,
+ };
+ let models_dir = home.join(".lmstudio").join("models");
+ if !models_dir.exists() {
+ return 0;
+ }
+ // The standard layout is ~/.lmstudio/models/<publisher>/<repo>/<file>.gguf —
+ // up to three levels deep. We walk lazily and stop after the first 1000
+ // matches; the user does not care about the exact count past "many".
+ fn walk(dir: &Path, depth: u32, found: &mut u32) {
+ if *found >= 1000 || depth > 4 {
+ return;
+ }
+ let entries = match std::fs::read_dir(dir) {
+ Ok(e) => e,
+ Err(_) => return,
+ };
+ for entry in entries.flatten() {
+ let path = entry.path();
+ if path.is_dir() {
+ walk(&path, depth + 1, found);
+ } else if path.extension().and_then(|e| e.to_str()).map(|s| s.eq_ignore_ascii_case("gguf")).unwrap_or(false) {
+ *found += 1;
+ if *found >= 1000 {
+ return;
+ }
+ }
+ }
+ }
+ let mut count: u32 = 0;
+ walk(&models_dir, 0, &mut count);
+ count
+}
+
+#[cfg(target_os = "windows")]
+fn lmstudio_path_from_registry() -> Option<PathBuf> {
+ // Read InstallLocation from LM Studio's Uninstall entry. We try HKCU
+ // first (per-user installs) then HKLM (system-wide). The display name
+ // varies slightly between installer builds, so we scan for any subkey
+ // whose DisplayName starts with "LM Studio".
+ use winreg::enums::*;
+ use winreg::RegKey;
+ for hive in [HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE] {
+ let root = RegKey::predef(hive);
+ for uninstall_path in [
+ r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall",
+ r"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall",
+ ] {
+ let Ok(uninstall) = root.open_subkey(uninstall_path) else { continue };
+ for key_res in uninstall.enum_keys() {
+ let Ok(key) = key_res else { continue };
+ let Ok(sub) = uninstall.open_subkey(&key) else { continue };
+ let name: String = sub.get_value("DisplayName").unwrap_or_default();
+ if name.eq_ignore_ascii_case("LM Studio") || name.starts_with("LM Studio") {
+ if let Ok(loc) = sub.get_value::<String, _>("InstallLocation") {
+ let p = PathBuf::from(loc);
+ if p.exists() {
+ return Some(p);
+ }
+ }
+ }
+ }
+ }
+ }
+ None
+}
+
+#[cfg(not(target_os = "windows"))]
+fn lmstudio_path_from_registry() -> Option<PathBuf> {
+ None
+}
+
/// Path to the LM Studio GUI executable on Windows. We only need to launch
/// this in the rare case where `lms bootstrap` from the pre-bootstrap binary
/// reports success but `~/.lmstudio/` is still missing — some installs
@@ -959,10 +1287,15 @@ pub fn start_lmstudio_server() -> Result<serde_json::Value, String> {
#[tauri::command]
pub fn lmstudio_server_status() -> Result<serde_json::Value, String> {
+ let model_count = lmstudio_models_present();
Ok(serde_json::json!({
"running": lmstudio_server_running(),
"port": LMSTUDIO_DEFAULT_PORT,
"lms_present": lmstudio_lms_path().is_some(),
+ // Soft-detect signals — onboarding shows "Start LM Studio server?"
+ // when models are present even if lms.exe couldn't be located.
+ "models_detected": model_count > 0,
+ "model_count": model_count,
}))
}
@@ -1510,4 +1843,46 @@ mod tests {
assert_eq!(s.status, "installing");
assert_eq!(s.logs, vec!["log line"]);
}
+
+ // ── parse_compute_cap_output (Bug #10 — Blackwell PyTorch routing) ────
+
+ #[test]
+ fn compute_cap_parses_ampere_single_gpu() {
+ assert_eq!(parse_compute_cap_output("8.6\n"), Some(8));
+ }
+
+ #[test]
+ fn compute_cap_parses_ada_single_gpu() {
+ assert_eq!(parse_compute_cap_output("8.9\n"), Some(8));
+ }
+
+ #[test]
+ fn compute_cap_parses_hopper() {
+ assert_eq!(parse_compute_cap_output("9.0\n"), Some(9));
+ }
+
+ #[test]
+ fn compute_cap_parses_blackwell() {
+ assert_eq!(parse_compute_cap_output("12.0\n"), Some(12));
+ }
+
+ #[test]
+ fn compute_cap_multi_gpu_picks_highest() {
+ assert_eq!(parse_compute_cap_output("8.6\n12.0\n"), Some(12));
+ }
+
+ #[test]
+ fn compute_cap_handles_blank_lines() {
+ assert_eq!(parse_compute_cap_output("\n8.6\n\n"), Some(8));
+ }
+
+ #[test]
+ fn compute_cap_returns_none_for_empty_output() {
+ assert_eq!(parse_compute_cap_output(""), None);
+ }
+
+ #[test]
+ fn compute_cap_skips_unparseable_lines() {
+ assert_eq!(parse_compute_cap_output("[Not Supported]\n8.6\n"), Some(8));
+ }
}
diff --git a/src-tauri/src/commands/process.rs b/src-tauri/src/commands/process.rs
index 88460474..00679963 100644
--- a/src-tauri/src/commands/process.rs
+++ b/src-tauri/src/commands/process.rs
@@ -316,6 +316,210 @@ pub fn find_comfyui_path() -> Option<String> {
None
}
+/// Information about a discovered ComfyUI install — surfaced to the
+/// frontend so the user picks the right one when multiple coexist.
+///
+/// Background (Bug #3 — ninjastic2008 v2.4.3): a user with both a manual
+/// `C:\Users\admin\ComfyUI` install (complete, with its own python_embeded)
+/// AND an empty `C:\ComfyUI-ai` directory hit `find_comfyui_path()` which
+/// returned only the first hit (their manual install). LU then tried to
+/// drive that install using the system Python — incompatible with the
+/// dir's bundled python_embeded — and ComfyUI loaded indefinitely. The
+/// "complete + has_embedded_python" fields let the onboarding UI explain
+/// which path to pick and why.
+#[derive(serde::Serialize, Clone, Debug)]
+pub struct ComfyUIInstall {
+ pub path: String,
+ /// True when this directory looks ready to start without any further
+ /// pip steps (main.py + torch reachable). Same heuristic as
+ /// `is_comfyui_install_complete`.
+ pub complete: bool,
+ /// True when the directory ships its own `python_embeded\python.exe`.
+ /// Portable ComfyUI builds (and Stability Matrix packages) ship one;
+ /// from-source clones don't. We start ComfyUI with this Python when
+ /// present — using the system Python on a portable install was the
+ /// exact failure mode ninjastic2008 hit.
+ pub has_embedded_python: bool,
+ /// Where we found this install. Helps the user disambiguate.
+ pub source: String,
+}
+
+fn classify_comfy_install(path: &Path, source: &str) -> ComfyUIInstall {
+ let has_embed = path.join("python_embeded").join("python.exe").exists()
+ || path
+ .parent()
+ .map(|p| p.join("python_embeded").join("python.exe").exists())
+ .unwrap_or(false);
+ ComfyUIInstall {
+ path: path.to_string_lossy().to_string(),
+ complete: is_comfyui_install_complete(path),
+ has_embedded_python: has_embed,
+ source: source.to_string(),
+ }
+}
+
+/// Enumerate every plausible ComfyUI install on the box. Used by the
+/// onboarding UI to decide between auto-pick (one hit) and an explicit
+/// picker (multiple hits).
+///
+/// Performance contract: this MUST finish in under ~3 s even on machines
+/// with deep file trees. The implementation is `async` so it runs on
+/// tokio's blocking-thread pool instead of the IPC main thread — without
+/// that the Tauri WebView lock-up on a 200k-file home dir made the whole
+/// app report "Not responding" during the ComfyUI step. (Bug #3 sweep,
+/// found during E2E 2026-05-11.)
+///
+/// Scan tiers, in order:
+/// 1. Explicit pointers — env var, config.json
+/// 2. Well-known fixed locations (home/Desktop/Documents/StabilityMatrix/…)
+/// 3. Bounded deep scan of the user's data dirs (depth 4, skip noise)
+/// We DO NOT walk C:\, D:\, E:\ from their roots anymore — that path was
+/// the locker. find_comfyui_path keeps its drive-root fallback for the
+/// single-hit auto-pick case which can afford a slow first-match exit.
+#[tauri::command]
+pub async fn detect_all_comfyui_installs() -> Vec<ComfyUIInstall> {
+ tokio::task::spawn_blocking(detect_all_comfyui_installs_sync)
+ .await
+ .unwrap_or_default()
+}
+
+const MAX_MULTI_DETECT_HITS: usize = 16;
+const MULTI_DETECT_DEPTH: i32 = 4;
+
+fn detect_all_comfyui_installs_sync() -> Vec<ComfyUIInstall> {
+ let mut out: Vec<ComfyUIInstall> = Vec::new();
+ let mut seen: std::collections::HashSet<String> = std::collections::HashSet::new();
+
+ let push_if_new = |path: PathBuf, source: &str, out: &mut Vec<ComfyUIInstall>, seen: &mut std::collections::HashSet<String>| -> bool {
+ if !path.join("main.py").exists() {
+ return false;
+ }
+ // Canonicalise to dedupe symlinks / case-different paths on Windows
+ let key = std::fs::canonicalize(&path)
+ .map(|c| c.to_string_lossy().to_string())
+ .unwrap_or_else(|_| path.to_string_lossy().to_string())
+ .to_lowercase();
+ if seen.insert(key) {
+ out.push(classify_comfy_install(&path, source));
+ return true;
+ }
+ false
+ };
+
+ // 1. COMFYUI_PATH env var
+ if let Ok(env_path) = std::env::var("COMFYUI_PATH") {
+ push_if_new(PathBuf::from(&env_path), "COMFYUI_PATH env var", &mut out, &mut seen);
+ }
+
+ // 2. app config.json
+ if let Some(config_dir) = dirs::config_dir() {
+ let config_file = config_dir.join("locally-uncensored").join("config.json");
+ if let Ok(content) = fs::read_to_string(&config_file) {
+ if let Ok(config) = serde_json::from_str::<serde_json::Value>(&content) {
+ if let Some(path) = config.get("comfyui_path").and_then(|v| v.as_str()) {
+ push_if_new(PathBuf::from(path), "config.json", &mut out, &mut seen);
+ }
+ }
+ }
+ }
+
+ let home = dirs::home_dir().unwrap_or_default();
+
+ // 3. Well-known fixed locations
+ let mut fixed: Vec<(PathBuf, &str)> = vec![
+ (home.join("ComfyUI"), "home"),
+ (home.join("Desktop").join("ComfyUI"), "Desktop"),
+ (home.join("Documents").join("ComfyUI"), "Documents"),
+ (PathBuf::from("C:\\ComfyUI"), "C:\\"),
+ (PathBuf::from("D:\\ComfyUI"), "D:\\"),
+ ];
+ if cfg!(target_os = "windows") {
+ if let Ok(appdata) = std::env::var("APPDATA") {
+ fixed.push((PathBuf::from(&appdata).join("StabilityMatrix").join("Packages").join("ComfyUI"), "StabilityMatrix"));
+ }
+ if let Ok(localappdata) = std::env::var("LOCALAPPDATA") {
+ fixed.push((PathBuf::from(&localappdata).join("StabilityMatrix").join("Packages").join("ComfyUI"), "StabilityMatrix"));
+ }
+ fixed.push((PathBuf::from("C:\\Program Files\\ComfyUI"), "Program Files"));
+ fixed.push((PathBuf::from("C:\\AI\\ComfyUI"), "C:\\AI"));
+ fixed.push((PathBuf::from("D:\\AI\\ComfyUI"), "D:\\AI"));
+ }
+ for (p, source) in fixed {
+ push_if_new(p, source, &mut out, &mut seen);
+ }
+
+ // 4. Bounded deep scan — user data dirs only. Drive roots (C:\, D:\, E:\)
+ // are intentionally NOT walked here: the deep walk through hundreds of
+ // thousands of system files made `detect_all_comfyui_installs` lock
+ // Tauri for 30+ s on real Windows boxes. Power users with ComfyUI in
+ // `D:\AI\projects\custom\dir\` still get auto-picked by find_comfyui_path
+ // (single-hit, slow first-match-exit) — they just don't surface in the
+ // Multi-ComfyUI picker, which is acceptable: that picker exists for
+ // accidental multi-install collisions, not exhaustive enumeration.
+ let scan_roots: Vec<(PathBuf, &str)> = vec![
+ (home.clone(), "home (deep scan)"),
+ (home.join("Desktop"), "Desktop"),
+ (home.join("Documents"), "Documents"),
+ (home.join("Downloads"), "Downloads"),
+ ];
+ for (root, source) in &scan_roots {
+ if out.len() >= MAX_MULTI_DETECT_HITS {
+ break;
+ }
+ if root.exists() {
+ walk_for_comfyui(root, MULTI_DETECT_DEPTH, &mut |p| {
+ if out.len() >= MAX_MULTI_DETECT_HITS {
+ return;
+ }
+ push_if_new(p, source, &mut out, &mut seen);
+ });
+ }
+ }
+
+ out
+}
+
+fn walk_for_comfyui<F: FnMut(PathBuf)>(dir: &Path, depth: i32, cb: &mut F) {
+ if depth < 0 {
+ return;
+ }
+ if dir.join("main.py").exists() && dir.join("comfy").exists() {
+ cb(dir.to_path_buf());
+ // Don't recurse into a confirmed install — its subdirs aren't
+ // independent installs.
+ return;
+ }
+ let entries = match fs::read_dir(dir) {
+ Ok(e) => e,
+ Err(_) => return,
+ };
+ for entry in entries.flatten() {
+ let p = entry.path();
+ if !p.is_dir() {
+ continue;
+ }
+ // Skip the obvious noise dirs that blow up walk time. node_modules
+ // and .git are common in dev projects; the rest are system locations
+ // that should never own a ComfyUI install anyway.
+ if let Some(name) = p.file_name().and_then(|n| n.to_str()) {
+ if matches!(name,
+ "node_modules" | ".git" | "AppData" | "$Recycle.Bin"
+ | "Windows" | "System32" | "ProgramData" | ".cache"
+ | "target" | ".cargo" | ".rustup" | ".npm" | ".pnpm"
+ | "Library" // macOS, harmless on Windows
+ | "OneDrive" // huge synced trees; ComfyUI shouldn't live there
+ ) {
+ continue;
+ }
+ // Hidden dirs (Linux/macOS dotfiles) are almost never ComfyUI roots.
+ if name.starts_with('.') && name.len() > 1 {
+ continue;
+ }
+ }
+ walk_for_comfyui(&p, depth - 1, cb);
+ }
+}
+
fn is_comfyui_running_on_port(port: u16) -> bool {
reqwest::blocking::get(format!("http://localhost:{}/system_stats", port))
.map(|r| r.status().is_success())
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index d0908dff..f5f2082b 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -35,6 +35,7 @@ fn main() {
commands::process::stop_comfyui,
commands::process::comfyui_status,
commands::process::find_comfyui,
+ commands::process::detect_all_comfyui_installs,
commands::process::set_comfyui_path,
commands::process::set_comfyui_port,
commands::process::set_comfyui_host,
@@ -43,6 +44,7 @@ fn main() {
// Installation
commands::install::install_comfyui,
commands::install::install_comfyui_status,
+ commands::install::cancel_comfyui_install,
commands::install::install_ollama,
commands::install::install_ollama_status,
commands::install::install_lmstudio,
diff --git a/src-tauri/src/state.rs b/src-tauri/src/state.rs
index ee0b5467..4c1edbc4 100644
--- a/src-tauri/src/state.rs
+++ b/src-tauri/src/state.rs
@@ -137,6 +137,11 @@ pub struct AppState {
pub download_tokens: Arc<Mutex<HashMap<String, CancellationToken>>>,
pub pull_tokens: Arc<Mutex<HashMap<String, CancellationToken>>>,
pub install_status: Arc<Mutex<InstallState>>,
+ /// Cancel flag for the ComfyUI installer (Bug #1, techx69 v2.4.3).
+ /// `install_comfyui` polls this between steps; setting it from
+ /// `cancel_comfyui_install` aborts the next git/pip subprocess and
+ /// flips the install_status to "cancelled".
+ pub comfyui_install_cancel: Arc<AtomicBool>,
pub ollama_install: Arc<Mutex<InstallState>>,
pub lmstudio_install: Arc<Mutex<InstallState>>,
pub python_install: Arc<Mutex<InstallState>>,
@@ -203,6 +208,7 @@ impl AppState {
download_tokens: Arc::new(Mutex::new(HashMap::new())),
pull_tokens: Arc::new(Mutex::new(HashMap::new())),
install_status: Arc::new(Mutex::new(InstallState::default())),
+ comfyui_install_cancel: Arc::new(AtomicBool::new(false)),
ollama_install: Arc::new(Mutex::new(InstallState::default())),
lmstudio_install: Arc::new(Mutex::new(InstallState::default())),
python_install: Arc::new(Mutex::new(InstallState::default())),
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index 30d39685..d1bee5d8 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -1,7 +1,7 @@
{
"$schema": "https://raw.githubusercontent.com/tauri-apps/tauri/dev/crates/tauri-cli/schema.json",
"productName": "Locally Uncensored",
- "version": "2.4.3",
+ "version": "2.4.4",
"identifier": "com.purpledoubled.locally-uncensored",
"build": {
"beforeBuildCommand": "npm run build",
diff --git a/src/api/__tests__/dynamic-workflow-strategy.test.ts b/src/api/__tests__/dynamic-workflow-strategy.test.ts
index d2cacc59..70bc8048 100644
--- a/src/api/__tests__/dynamic-workflow-strategy.test.ts
+++ b/src/api/__tests__/dynamic-workflow-strategy.test.ts
@@ -221,4 +221,45 @@ describe('dynamic-workflow — determineStrategy', () => {
expect(result.reason.toLowerCase()).toContain('no compatible')
})
})
+
+ // ─── installHint (Bug #6 — Video architecture install paths) ───
+
+ describe('install hints when wrapper nodes missing', () => {
+ it('cogvideo unavailable -> installHint with ComfyUI-CogVideoXWrapper', () => {
+ const nodes = makeNodes({ samplers: ['KSampler'] })
+ const result = determineStrategy('cogvideo', true, nodes, makeModels())
+ expect(result.strategy).toBe('unavailable')
+ expect(result.installHint?.pack).toBe('ComfyUI-CogVideoXWrapper')
+ expect(result.installHint?.url).toContain('github.com')
+ })
+
+ it('framepack unavailable -> installHint with ComfyUI-FramePackWrapper', () => {
+ const nodes = makeNodes({ samplers: ['KSampler'] })
+ const result = determineStrategy('framepack', true, nodes, makeModels())
+ expect(result.strategy).toBe('unavailable')
+ expect(result.installHint?.pack).toBe('ComfyUI-FramePackWrapper')
+ expect(result.installHint?.url).toContain('github.com')
+ })
+
+ it('pyramidflow unavailable -> installHint with ComfyUI-PyramidFlowWrapper', () => {
+ const nodes = makeNodes({ samplers: ['KSampler'] })
+ const result = determineStrategy('pyramidflow', true, nodes, makeModels())
+ expect(result.strategy).toBe('unavailable')
+ expect(result.installHint?.pack).toBe('ComfyUI-PyramidFlowWrapper')
+ })
+
+ it('allegro unavailable -> installHint with ComfyUI-Allegro', () => {
+ const nodes = makeNodes({ samplers: ['KSampler'] })
+ const result = determineStrategy('allegro', true, nodes, makeModels())
+ expect(result.strategy).toBe('unavailable')
+ expect(result.installHint?.pack).toBe('ComfyUI-Allegro')
+ })
+
+ it('non-wrapper unavailable (flux without UNETLoader) has no installHint', () => {
+ const nodes = makeNodes({ loaders: ['CheckpointLoaderSimple'] })
+ const result = determineStrategy('flux', false, nodes, makeModels())
+ expect(result.strategy).toBe('unavailable')
+ expect(result.installHint).toBeUndefined()
+ })
+ })
})
diff --git a/src/api/dynamic-workflow.ts b/src/api/dynamic-workflow.ts
index 759c7ae1..d565c238 100644
--- a/src/api/dynamic-workflow.ts
+++ b/src/api/dynamic-workflow.ts
@@ -32,6 +32,15 @@ export type WorkflowStrategy =
interface StrategyResult {
strategy: WorkflowStrategy
reason: string
+ /**
+ * When `strategy === 'unavailable'` and the missing piece is an
+ * installable custom-node pack, this hint tells the UI which one to
+ * suggest. Surfaces in Create view as a clickable "open install guide"
+ * link so users like vvvxxxvvv_80435 (CogVideoX 1.5 5B → UNETLoader
+ * mismatch on v2.4.3) get a clear next step instead of just a
+ * blocking error. (Bug #6)
+ */
+ installHint?: { pack: string; url: string }
}
export function determineStrategy(
@@ -125,7 +134,11 @@ export function determineStrategy(
if (hasCogNodes) {
return { strategy: 'cogvideo', reason: 'CogVideoX → Kijai wrapper pipeline' }
}
- return { strategy: 'unavailable', reason: 'CogVideoX requires ComfyUI-CogVideoXWrapper custom nodes. Install them from the Model Manager.' }
+ return {
+ strategy: 'unavailable',
+ reason: 'CogVideoX needs the ComfyUI-CogVideoXWrapper custom nodes. Install via ComfyUI Manager (Manager → Install Custom Nodes → search "CogVideoXWrapper") or git clone the repo into ComfyUI/custom_nodes/.',
+ installHint: { pack: 'ComfyUI-CogVideoXWrapper', url: 'https://github.com/kijai/ComfyUI-CogVideoXWrapper' },
+ }
}
// FramePack → Kijai wrapper nodes (I2V)
@@ -134,7 +147,11 @@ export function determineStrategy(
if (hasFPNodes) {
return { strategy: 'framepack', reason: 'FramePack → Kijai wrapper pipeline (I2V)' }
}
- return { strategy: 'unavailable', reason: 'FramePack requires ComfyUI-FramePackWrapper custom nodes. Install them from the Model Manager.' }
+ return {
+ strategy: 'unavailable',
+ reason: 'FramePack needs the ComfyUI-FramePackWrapper custom nodes. Install via ComfyUI Manager (Manager → Install Custom Nodes → search "FramePackWrapper") or git clone the repo into ComfyUI/custom_nodes/.',
+ installHint: { pack: 'ComfyUI-FramePackWrapper', url: 'https://github.com/kijai/ComfyUI-FramePackWrapper' },
+ }
}
// Pyramid Flow → Kijai wrapper nodes
@@ -143,7 +160,11 @@ export function determineStrategy(
if (hasPFNodes) {
return { strategy: 'pyramidflow', reason: 'Pyramid Flow → Kijai wrapper pipeline' }
}
- return { strategy: 'unavailable', reason: 'Pyramid Flow requires ComfyUI-PyramidFlowWrapper custom nodes. Install them from the Model Manager.' }
+ return {
+ strategy: 'unavailable',
+ reason: 'Pyramid Flow needs the ComfyUI-PyramidFlowWrapper custom nodes. Install via ComfyUI Manager or git clone into ComfyUI/custom_nodes/.',
+ installHint: { pack: 'ComfyUI-PyramidFlowWrapper', url: 'https://github.com/kijai/ComfyUI-PyramidFlowWrapper' },
+ }
}
// Allegro → Community wrapper nodes
@@ -152,7 +173,11 @@ export function determineStrategy(
if (hasAllegroNodes) {
return { strategy: 'allegro', reason: 'Allegro → Community wrapper pipeline' }
}
- return { strategy: 'unavailable', reason: 'Allegro requires ComfyUI-Allegro custom nodes. Install them from the Model Manager.' }
+ return {
+ strategy: 'unavailable',
+ reason: 'Allegro needs the ComfyUI-Allegro community wrapper nodes (search "Allegro" in ComfyUI Manager → Install Custom Nodes).',
+ installHint: { pack: 'ComfyUI-Allegro', url: 'https://github.com/rhajou/ComfyUI-Allegro' },
+ }
}
// SDXL / SD1.5 / Unknown
@@ -174,6 +199,46 @@ export function determineStrategy(
// ─── Dynamic Workflow Builder ───
+/**
+ * Custom Error thrown by `buildDynamicWorkflow` when the active ComfyUI
+ * lacks the loader nodes for the chosen model architecture (Bug #6:
+ * CogVideoX 1.5 / LTX / FramePack require Kijai wrapper nodes that aren't
+ * in ComfyUI core). UI can read `.installHint` to render a one-click
+ * "open install guide" link instead of just blocking the user.
+ */
+export class WorkflowUnavailableError extends Error {
+ readonly strategy: WorkflowStrategy
+ readonly installHint?: { pack: string; url: string }
+ constructor(message: string, strategy: WorkflowStrategy, installHint?: { pack: string; url: string }) {
+ super(message)
+ this.name = 'WorkflowUnavailableError'
+ this.strategy = strategy
+ this.installHint = installHint
+ }
+}
+
+/**
+ * Probe ComfyUI for the video output node we need. When neither VHS nor
+ * SaveAnimatedWEBP is present, the workflow will fall back to SaveImage
+ * (single frames on disk) — Turbulent_Tomato7559's "videos generate as
+ * .webp" was caused by VHS missing while SaveAnimatedWEBP still produced
+ * an animated still. UI calls this BEFORE Generate so users see a banner
+ * rather than discovering after the fact.
+ */
+export async function checkVideoOutputCapability(): Promise<{ mp4Capable: boolean; webpOnly: boolean; missingNodes: string[] }> {
+ const allNodes = await getAllNodeInfo()
+ const cats = categorizeNodes(allNodes)
+ const hasVHS = cats.videoSavers.includes('VHS_VideoCombine')
+ const hasWebp = cats.videoSavers.includes('SaveAnimatedWEBP')
+ const missing: string[] = []
+ if (!hasVHS) missing.push('VHS_VideoCombine (ComfyUI-VideoHelperSuite)')
+ return {
+ mp4Capable: hasVHS,
+ webpOnly: !hasVHS && hasWebp,
+ missingNodes: missing,
+ }
+}
+
export async function buildDynamicWorkflow(
params: GenerateParams | VideoParams,
modelType?: ModelType,
@@ -187,11 +252,11 @@ export async function buildDynamicWorkflow(
const nodes = categorizeNodes(allNodes)
const models = detectAvailableModels(allNodes)
- const { strategy, reason } = determineStrategy(type, isVideo, nodes, models)
+ const { strategy, reason, installHint } = determineStrategy(type, isVideo, nodes, models)
console.log(`[dynamic-workflow] Strategy: ${strategy} (${reason})`)
if (strategy === 'unavailable') {
- throw new Error(reason)
+ throw new WorkflowUnavailableError(reason, strategy, installHint)
}
const seed = params.seed === -1 ? Math.floor(Math.random() * 2147483647) : params.seed
diff --git a/src/components/chat/MessageBubble.tsx b/src/components/chat/MessageBubble.tsx
index 0b51efe1..f536e4ec 100644
--- a/src/components/chat/MessageBubble.tsx
+++ b/src/components/chat/MessageBubble.tsx
@@ -1,12 +1,17 @@
import { motion } from 'framer-motion'
-import { User, Bot, Copy, Check, Pencil, RefreshCw, X } from 'lucide-react'
-import { useState, useRef, useEffect } from 'react'
+import { User, Bot, Copy, Check, Pencil, RefreshCw, X, Wrench } from 'lucide-react'
+import { useState, useRef, useEffect, useMemo } from 'react'
import { MarkdownRenderer } from './MarkdownRenderer'
import { ThinkingBlock } from './ThinkingBlock'
import { ToolCallBlock } from './ToolCallBlock'
import { ReflectionBlock } from './ReflectionBlock'
import { SpeakerButton } from './SpeakerButton'
import type { Message } from '../../types/chat'
+import { useAgentModeStore } from '../../stores/agentModeStore'
+import { useChatStore } from '../../stores/chatStore'
+import { useModelStore } from '../../stores/modelStore'
+import { extractToolCallsFromContent } from '../../lib/tool-call-repair'
+import { isAgentCompatible } from '../../lib/model-compatibility'
interface Props {
message: Message
@@ -27,6 +32,30 @@ export function MessageBubble({ message, onRegenerate, onEdit, pendingApprovalId
const editRef = useRef<HTMLTextAreaElement>(null)
const isUser = message.role === 'user'
+ // Bug #7 (phantomderp v2.4.3): the Codex-style "model parrots tool-call
+ // JSON as plaintext" only happens when the active chat does NOT have
+ // agent mode on. Detect the JSON pattern and show a one-click "Enable
+ // agent" banner instead of leaving the user staring at a JSON dump.
+ const activeConversationId = useChatStore((s) => s.activeConversationId)
+ const isAgentActive = useAgentModeStore((s) =>
+ activeConversationId ? s.agentModeActive[activeConversationId] ?? false : false
+ )
+ const activeModel = useModelStore((s) => s.activeModel)
+ const toggleAgentMode = useAgentModeStore((s) => s.toggleAgentMode)
+
+ const suggestAgent = useMemo(() => {
+ if (isUser || isAgentActive || !activeConversationId || !activeModel) return false
+ if (!message.content || message.content.length < 10) return false
+ // The repair helper extracts {name, arguments}-shaped JSON blocks, plus
+ // <tool_call>...</tool_call> Hermes tags. If anything came out, the
+ // model wanted to call a tool — even though we never registered any.
+ const calls = extractToolCallsFromContent(message.content)
+ if (!calls || calls.length === 0) return false
+ // Only nudge when the model is on the agent-allow-list. Showing this
+ // banner on a non-agent-capable model would be a dead-end.
+ return isAgentCompatible(activeModel)
+ }, [isUser, isAgentActive, activeConversationId, activeModel, message.content])
+
useEffect(() => {
if (isEditing && editRef.current) {
editRef.current.focus()
@@ -171,6 +200,21 @@ export function MessageBubble({ message, onRegenerate, onEdit, pendingApprovalId
) : (
<div className="text-[0.78rem] leading-relaxed">
<MarkdownRenderer content={message.content} />
+ {suggestAgent && (
+ <div className="mt-2 flex items-start gap-2 px-2 py-1.5 rounded-md border border-amber-400/30 bg-amber-500/10 text-[0.65rem] text-amber-700 dark:text-amber-200">
+ <Wrench size={11} className="mt-0.5 shrink-0" />
+ <div className="flex-1">
+ <p className="font-medium">This model tried to call a tool, but Agent Mode is off for this chat.</p>
+ <p className="opacity-80 mt-0.5">Turn it on to let the model actually execute tools (read files, run commands, browse). Until then it'll keep emitting JSON that nothing reads.</p>
+ </div>
+ <button
+ onClick={() => activeConversationId && toggleAgentMode(activeConversationId)}
+ className="shrink-0 px-2 py-0.5 rounded border border-amber-400/40 hover:bg-amber-500/20 transition-colors font-medium"
+ >
+ Enable Agent
+ </button>
+ </div>
+ )}
</div>
)}
diff --git a/src/components/chat/TokenCounter.tsx b/src/components/chat/TokenCounter.tsx
index 80357046..a9b0f97f 100644
--- a/src/components/chat/TokenCounter.tsx
+++ b/src/components/chat/TokenCounter.tsx
@@ -1,13 +1,21 @@
import { useState, useEffect } from 'react'
import { useChatStore } from '../../stores/chatStore'
import { useModelStore } from '../../stores/modelStore'
+import { useSettingsStore } from '../../stores/settingsStore'
import { estimateTokens, getModelMaxTokens } from '../../lib/context-compaction'
export function TokenCounter() {
const activeConversationId = useChatStore((s) => s.activeConversationId)
const conversations = useChatStore((s) => s.conversations)
const activeModel = useModelStore((s) => s.activeModel)
- const [maxTokens, setMaxTokens] = useState<number>(4096)
+ // Settings override — when the user bumps maxTokens in Settings the counter
+ // should reflect that immediately, not just on next model switch. Bug #4
+ // (phantomderp v2.4.3): the bar stayed pinned to the model's default
+ // (e.g. 8.2k) even after the user moved the slider to 16384. Subscribing
+ // to the settings store fixes the staleness — `useSettingsStore` re-renders
+ // any consumer on every settings update.
+ const settingsMaxTokens = useSettingsStore((s) => s.settings.maxTokens)
+ const [modelMaxTokens, setModelMaxTokens] = useState<number>(4096)
const conversation = conversations.find((c) => c.id === activeConversationId)
const messages = conversation?.messages || []
@@ -21,22 +29,32 @@ export function TokenCounter() {
return sum + tokens
}, 0)
- // Fetch max tokens when model changes
+ // Fetch max tokens when model changes — only the model-side default is
+ // cached here; the user override is read live from the settings store.
useEffect(() => {
if (!activeModel) return
- getModelMaxTokens(activeModel).then(setMaxTokens).catch(() => setMaxTokens(4096))
+ getModelMaxTokens(activeModel).then(setModelMaxTokens).catch(() => setModelMaxTokens(4096))
}, [activeModel])
if (!activeConversationId || messages.length === 0) return null
+ // Effective ceiling: user-set maxTokens wins if non-zero (the slider's "0"
+ // default means "use whatever the model reports").
+ const maxTokens = settingsMaxTokens > 0 ? settingsMaxTokens : modelMaxTokens
+
const ratio = maxTokens > 0 ? usedTokens / maxTokens : 0
const color = ratio > 0.8 ? 'text-red-400' : ratio > 0.5 ? 'text-amber-400' : 'text-gray-500'
const barColor = ratio > 0.8 ? 'bg-red-500' : ratio > 0.5 ? 'bg-amber-500' : 'bg-gray-500'
const formatK = (n: number) => n >= 1000 ? `${(n / 1000).toFixed(1)}k` : String(n)
+ const isOverride = settingsMaxTokens > 0 && settingsMaxTokens !== modelMaxTokens
+ const title = isOverride
+ ? `Estimated: ${usedTokens.toLocaleString()} / ${maxTokens.toLocaleString()} tokens (Settings override — model default is ${modelMaxTokens.toLocaleString()})`
+ : `Estimated: ${usedTokens.toLocaleString()} / ${maxTokens.toLocaleString()} tokens`
+
return (
- <div className={`flex items-center gap-1.5 px-2 py-1 ${color}`} title={`Estimated: ${usedTokens.toLocaleString()} / ${maxTokens.toLocaleString()} tokens`}>
+ <div className={`flex items-center gap-1.5 px-2 py-1 ${color}`} title={title}>
<div className="w-12 h-1 rounded-full bg-gray-200 dark:bg-white/10 overflow-hidden">
<div
className={`h-full rounded-full transition-all duration-300 ${barColor}`}
diff --git a/src/components/onboarding/Onboarding.tsx b/src/components/onboarding/Onboarding.tsx
index f1daf546..0c818ad6 100644
--- a/src/components/onboarding/Onboarding.tsx
+++ b/src/components/onboarding/Onboarding.tsx
@@ -78,6 +78,19 @@ export function Onboarding() {
const [comfyDownloadProgress, setComfyDownloadProgress] = useState(0)
const [comfyDownloadTotal, setComfyDownloadTotal] = useState(0)
const [comfyDownloadSpeed, setComfyDownloadSpeed] = useState(0)
+ // Bug #3 (ninjastic2008 v2.4.3): multi-install disambiguation. When
+ // `detect_all_comfyui_installs` returns more than one hit the user picks
+ // explicitly instead of LU auto-picking the first scan match. Picking
+ // the wrong install caused "ComfyUI loaded endlessly" because their
+ // manual install's `python_embeded` was incompatible with our default
+ // System-Python launcher.
+ type ComfyInstallChoice = {
+ path: string
+ complete: boolean
+ has_embedded_python: boolean
+ source: string
+ }
+ const [comfyChoices, setComfyChoices] = useState<ComfyInstallChoice[]>([])
// P14: Python install state. On a fresh Windows box `python` is the
// Microsoft Store stub which exit-1's `pip install`. The ComfyUI install
@@ -139,6 +152,13 @@ export function Onboarding() {
// start — so we route through the same code path either way; only the
// UI labelling differs.
const [lmstudioOfflineDetected, setLmstudioOfflineDetected] = useState(false)
+ // Soft-detect: GGUFs in ~/.lmstudio/models/ even when we can't locate
+ // lms.exe. Set when techx69-style users have LM Studio installed
+ // system-wide (C:\Program Files\LM Studio) and the Rust path scan misses
+ // it, but the canonical models dir is populated anyway. We surface a
+ // "Start LM Studio server" CTA either way — the model count gives a
+ // confidence cue in the offline-detected card.
+ const [lmstudioModelCount, setLmstudioModelCount] = useState(0)
const isDark = settings.theme === 'dark'
const bgClass = isDark ? 'bg-[#0a0a0a] text-white' : 'bg-white text-gray-900'
@@ -281,6 +301,7 @@ export function Onboarding() {
const runDetection = async () => {
setDetecting(true)
setLmstudioOfflineDetected(false)
+ setLmstudioModelCount(0)
const backends = await detectLocalBackends()
setDetectedBackends(backends)
if (backends.length > 0 && !selectedBackend) {
@@ -292,10 +313,20 @@ export function Onboarding() {
// just be turned off. lmstudio_server_status is cheap (a single
// reqwest probe + a path check) and was added in the same sweep
// that introduced this branch.
+ //
+ // v2.4.4 (Bug #2): the status payload now also includes
+ // `models_detected` / `model_count` — set by scanning
+ // ~/.lmstudio/models/ for GGUF files. We treat that as a strong
+ // soft-detect signal: if the user has models in the canonical dir,
+ // they obviously *have* LM Studio, regardless of whether our path
+ // scan turned up lms.exe (techx69's system-wide install reproed this).
try {
const status: any = await backendCall('lmstudio_server_status')
- if (status?.lms_present && !status?.running) {
+ const offline = status?.lms_present && !status?.running
+ const softDetect = status?.models_detected && !status?.running
+ if (offline || softDetect) {
setLmstudioOfflineDetected(true)
+ setLmstudioModelCount(Number(status?.model_count) || 0)
}
} catch { /* command unavailable — ignore */ }
}
@@ -381,16 +412,57 @@ export function Onboarding() {
useEffect(() => {
if (step === 'comfyui' && !comfyFound && !comfyDetecting) {
setComfyDetecting(true)
- backendCall<{ found: boolean; path?: string; complete?: boolean }>('find_comfyui')
- .then(result => {
- setComfyFound(result)
- if (result.found && result.complete !== false) setComfyReady(true)
+ // First: enumerate ALL installs (Bug #3). When >1 we show a picker
+ // BEFORE auto-picking — preventing the ninjastic2008 trap where LU
+ // detected their manual install while they wanted the empty placeholder
+ // path. `find_comfyui` is the auto-pick fallback for the single-install
+ // case, which keeps the existing happy-path behaviour intact.
+ backendCall<ComfyInstallChoice[]>('detect_all_comfyui_installs')
+ .then(async installs => {
+ if (Array.isArray(installs) && installs.length > 1) {
+ setComfyChoices(installs)
+ setComfyFound(null)
+ return
+ }
+ if (Array.isArray(installs) && installs.length === 1) {
+ const only = installs[0]
+ setComfyFound({ found: true, path: only.path, complete: only.complete })
+ if (only.complete) setComfyReady(true)
+ // Persist the auto-pick so process.rs uses it on start_comfyui.
+ try { await backendCall('set_comfyui_path', { path: only.path }) } catch {}
+ return
+ }
+ // Zero matches — fall back to legacy find_comfyui (env var, config
+ // file overrides that aren't on the scan list).
+ const legacy = await backendCall<{ found: boolean; path?: string; complete?: boolean }>('find_comfyui')
+ setComfyFound(legacy)
+ if (legacy.found && legacy.complete !== false) setComfyReady(true)
+ })
+ .catch(async () => {
+ // Older builds without detect_all_comfyui_installs — degrade
+ // gracefully to the previous single-pick API.
+ try {
+ const legacy = await backendCall<{ found: boolean; path?: string; complete?: boolean }>('find_comfyui')
+ setComfyFound(legacy)
+ if (legacy.found && legacy.complete !== false) setComfyReady(true)
+ } catch {
+ setComfyFound({ found: false, complete: false })
+ }
})
- .catch(() => setComfyFound({ found: false, complete: false }))
.finally(() => setComfyDetecting(false))
}
}, [step])
+ // Pick one of the multiple installs from the disambiguation dialog. The
+ // chosen path is persisted via set_comfyui_path so start_comfyui hits it
+ // without further user intervention.
+ const pickComfyInstall = async (choice: ComfyInstallChoice) => {
+ try { await backendCall('set_comfyui_path', { path: choice.path }) } catch {}
+ setComfyFound({ found: true, path: choice.path, complete: choice.complete })
+ if (choice.complete) setComfyReady(true)
+ setComfyChoices([])
+ }
+
// P14 pre-flight: ensure Python is on the box before triggering ComfyUI's
// pip install. On fresh Windows, `python` is the Microsoft Store stub
// and pip silently exit-1's, leaving a carcass on disk and a
@@ -601,7 +673,9 @@ export function Onboarding() {
</h2>
<p className={`text-[0.7rem] ${isDark ? 'text-gray-400' : 'text-gray-500'}`}>
{lmstudioOfflineDetected
- ? "LM Studio is installed but its server isn't currently running. Start it to use LM Studio as your backend — no re-install needed."
+ ? (lmstudioModelCount > 0
+ ? `LM Studio is installed (${lmstudioModelCount} model${lmstudioModelCount === 1 ? '' : 's'} detected) but its server isn't currently running. Start it to use LM Studio as your backend — no re-install needed.`
+ : "LM Studio is installed but its server isn't currently running. Start it to use LM Studio as your backend — no re-install needed.")
: "You need a local AI backend to chat. We'll install Ollama for you — it's the easiest to set up."}
</p>
@@ -918,6 +992,58 @@ export function Onboarding() {
</div>
)}
+ {/* Bug #3: multi-install picker. When the scan found more than
+ one ComfyUI directory, LU asks the user explicitly rather
+ than guessing. Each option shows whether it's complete and
+ whether it ships its own python_embeded — both matter for
+ start_comfyui's launcher decision. */}
+ {!comfyDetecting && comfyChoices.length > 1 && !comfyFound && (
+ <div className="space-y-2 text-left">
+ <div className={`p-2.5 rounded-lg border ${isDark ? 'bg-amber-500/10 border-amber-500/20' : 'bg-amber-50 border-amber-200'}`}>
+ <p className={`text-[0.7rem] font-medium ${isDark ? 'text-amber-200' : 'text-amber-800'}`}>
+ Multiple ComfyUI installs detected
+ </p>
+ <p className={`text-[0.6rem] mt-0.5 ${isDark ? 'text-amber-300/80' : 'text-amber-700'}`}>
+ Pick the one you want LU to use. We'll remember your choice — you can change it later in Settings → ComfyUI.
+ </p>
+ </div>
+ <div className="space-y-1.5 max-h-44 overflow-y-auto">
+ {comfyChoices.map((c) => (
+ <button
+ key={c.path}
+ onClick={() => pickComfyInstall(c)}
+ className={`w-full text-left px-3 py-2 rounded-lg border transition-colors ${
+ isDark ? 'border-white/[0.08] hover:bg-white/[0.04]' : 'border-gray-200 hover:bg-gray-50'
+ }`}
+ >
+ <div className="flex items-center justify-between gap-2">
+ <span className={`text-[0.65rem] font-mono truncate ${isDark ? 'text-gray-200' : 'text-gray-800'}`}>{c.path}</span>
+ <span className={`text-[0.5rem] px-1.5 py-[1px] rounded shrink-0 ${
+ c.complete
+ ? (isDark ? 'bg-green-500/15 text-green-400' : 'bg-green-100 text-green-700')
+ : (isDark ? 'bg-amber-500/15 text-amber-300' : 'bg-amber-100 text-amber-700')
+ }`}>
+ {c.complete ? 'ready' : 'needs setup'}
+ </span>
+ </div>
+ <div className={`flex items-center gap-2 mt-0.5 text-[0.55rem] ${isDark ? 'text-gray-500' : 'text-gray-500'}`}>
+ <span>found via {c.source}</span>
+ {c.has_embedded_python && (
+ <span className={isDark ? 'text-blue-300' : 'text-blue-600'}>• bundles python_embeded</span>
+ )}
+ </div>
+ </button>
+ ))}
+ </div>
+ <button
+ onClick={() => { setComfyChoices([]); setComfyFound({ found: false, complete: false }) }}
+ className={`text-[0.55rem] ${isDark ? 'text-gray-500 hover:text-gray-300' : 'text-gray-500 hover:text-gray-700'} underline`}
+ >
+ None of these — let me install a fresh one
+ </button>
+ </div>
+ )}
+
{/* Found AND complete (a working install). The carcass case
is handled in the install-options block below. */}
{comfyFound?.found && comfyFound.complete !== false && !comfyInstalling && (
@@ -974,6 +1100,14 @@ export function Onboarding() {
setInstallStartTime(null)
// Auto-start ComfyUI
try { await backendCall('start_comfyui') } catch {}
+ } else if (status.status === 'cancelled') {
+ // Bug #1: install cancelled by user — close the
+ // progress card and surface the install options
+ // again so they can retry or pick another drive.
+ clearInterval(poll)
+ setComfyInstalling(false)
+ setInstallStartTime(null)
+ setComfyInstallError('Install cancelled.')
} else if (status.status === 'error') {
clearInterval(poll)
setComfyInstalling(false)
@@ -1076,12 +1210,44 @@ export function Onboarding() {
<div className="flex items-center justify-between mb-2">
<div className="flex items-center gap-2">
<Loader2 size={14} className="animate-spin text-purple-400" />
- <span className="text-[0.7rem] font-medium">Installing ComfyUI...</span>
+ <span className="text-[0.7rem] font-medium">
+ {comfyInstallLogs.some(l => l.toLowerCase().includes('cancel')) ? 'Cancelling ComfyUI install…' : 'Installing ComfyUI...'}
+ </span>
+ </div>
+ <div className="flex items-center gap-2">
+ <span className={`text-[0.55rem] font-mono ${isDark ? 'text-gray-500' : 'text-gray-400'}`}>
+ {Math.floor(elapsed / 60)}:{String(elapsed % 60).padStart(2, '0')}
+ {/* Bug #1: rolling ETA from download bytes when known. */}
+ {comfyDownloadSpeed > 0 && comfyDownloadTotal > 0 && comfyDownloadProgress < comfyDownloadTotal && (() => {
+ const remaining = comfyDownloadTotal - comfyDownloadProgress
+ const etaSec = Math.round(remaining / Math.max(1, comfyDownloadSpeed))
+ const m = Math.floor(etaSec / 60)
+ const s = etaSec % 60
+ return ` • ETA ${m}:${String(s).padStart(2, '0')}`
+ })()}
+ </span>
+ {/* Cancel button (Bug #1 — techx69) */}
+ <button
+ onClick={async () => {
+ try { await backendCall('cancel_comfyui_install') } catch {}
+ }}
+ className={`text-[0.55rem] px-1.5 py-[1px] rounded border transition-colors ${
+ isDark
+ ? 'border-red-500/40 text-red-300 hover:bg-red-500/10'
+ : 'border-red-300 text-red-600 hover:bg-red-50'
+ }`}
+ title="Cancel ComfyUI install"
+ >
+ Cancel
+ </button>
</div>
- <span className={`text-[0.55rem] font-mono ${isDark ? 'text-gray-500' : 'text-gray-400'}`}>
- {Math.floor(elapsed / 60)}:{String(elapsed % 60).padStart(2, '0')}
- </span>
</div>
+ {/* Disk pressure warning (push from Rust side) */}
+ {comfyInstallLogs.some(l => l.startsWith('⚠')) && (
+ <div className={`text-[0.55rem] mb-2 px-2 py-1 rounded ${isDark ? 'bg-amber-500/10 text-amber-300' : 'bg-amber-50 text-amber-800'}`}>
+ {comfyInstallLogs.find(l => l.startsWith('⚠'))}
+ </div>
+ )}
{/* Download progress bar (shown during download phase) */}
{comfyInstallLogs.some(l => l.includes('Downloading')) && comfyDownloadTotal > 0 && (
<div className="space-y-1 mb-2">
diff --git a/src/hooks/useCreate.ts b/src/hooks/useCreate.ts
index 19481c4b..1144d665 100644
--- a/src/hooks/useCreate.ts
+++ b/src/hooks/useCreate.ts
@@ -23,7 +23,7 @@ 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 { buildDynamicWorkflow, WorkflowUnavailableError, checkVideoOutputCapability } from '../api/dynamic-workflow'
import { getAllNodeInfo } from '../api/comfyui-nodes'
import { useCreateStore, type GalleryItem } from '../stores/createStore'
import { useWorkflowStore } from '../stores/workflowStore'
@@ -310,7 +310,22 @@ export function useCreate() {
workflow = await buildDynamicWorkflow(genParams, imageModelType)
builderUsed = 'dynamic'
} catch (dynErr) {
- // Fallback to legacy builders if dynamic fails
+ // Bug #6: when the dynamic builder reports the active ComfyUI is
+ // missing wrapper nodes (CogVideoX 1.5 / FramePack / LTX etc.),
+ // there's no point falling back to the legacy builder — it
+ // hits the same UNETLoader trap and surfaces "could not detect
+ // model type" instead. Tell the user exactly what to install.
+ if (dynErr instanceof WorkflowUnavailableError) {
+ const hint = dynErr.installHint
+ const guidance = hint
+ ? ` Install via ComfyUI Manager → Install Custom Nodes → search "${hint.pack}" (${hint.url}).`
+ : ''
+ setError(`${dynErr.message}${guidance}`)
+ setIsGenerating(false)
+ return
+ }
+ // Other dynamic-builder failures: legacy is a reasonable fallback
+ // (mostly happens for classic SDXL/SD15 image paths).
console.warn('[useCreate] Dynamic builder failed, using legacy:', dynErr)
builderUsed = 'legacy'
setProgress(5, 'Using legacy builder...')
@@ -320,6 +335,18 @@ export function useCreate() {
workflow = await buildTxt2ImgWorkflow(baseParams, imageModelType)
}
}
+ // Bug #6 (Turbulent_Tomato7559 — Reddit, 2026-05-10): warn when
+ // we'll fall back to animated .webp because VHS_VideoCombine is
+ // missing. User gets a banner explaining the output before they
+ // hit Generate and then wonder why they got an "image".
+ if (mode === 'video' && builderUsed === 'dynamic') {
+ try {
+ const caps = await checkVideoOutputCapability()
+ if (caps.webpOnly) {
+ setProgress(8, 'Heads-up: output will be animated .webp (install VHS_VideoCombine for mp4)')
+ }
+ } catch { /* non-fatal */ }
+ }
}
setProgress(10, 'Submitting to ComfyUI...')
diff --git a/src/stores/__tests__/modelStore-dismiss.test.ts b/src/stores/__tests__/modelStore-dismiss.test.ts
new file mode 100644
index 00000000..6362b83c
--- /dev/null
+++ b/src/stores/__tests__/modelStore-dismiss.test.ts
@@ -0,0 +1,67 @@
+import { describe, it, expect, vi, beforeEach } from 'vitest'
+
+const mockInvoke = vi.fn(async () => undefined)
+vi.mock('@tauri-apps/api/core', () => ({ invoke: mockInvoke }))
+vi.mock('../../api/backend', () => ({
+ isTauri: vi.fn(() => true),
+}))
+vi.mock('../../api/ollama', () => ({
+ unloadModel: vi.fn(async () => undefined),
+}))
+
+import { useModelStore } from '../modelStore'
+
+describe('useModelStore.dismissPull (Bug #5)', () => {
+ beforeEach(() => {
+ mockInvoke.mockClear()
+ useModelStore.setState({ activePulls: {} })
+ })
+
+ it('aborts the AbortController so the live stream stops', () => {
+ const controller = new AbortController()
+ useModelStore.getState().startPull('llama3.1:8b', controller)
+
+ useModelStore.getState().dismissPull('llama3.1:8b')
+
+ expect(controller.signal.aborted).toBe(true)
+ })
+
+ it('invokes cancel_model_pull on the Rust side', async () => {
+ const controller = new AbortController()
+ useModelStore.getState().startPull('qwen2.5:14b', controller)
+
+ useModelStore.getState().dismissPull('qwen2.5:14b')
+ // The invoke is fired inside a dynamic import promise — flush it.
+ await new Promise(r => setTimeout(r, 0))
+ await new Promise(r => setTimeout(r, 0))
+
+ expect(mockInvoke).toHaveBeenCalledWith('cancel_model_pull', { name: 'qwen2.5:14b' })
+ })
+
+ it('removes the entry from activePulls synchronously', () => {
+ const controller = new AbortController()
+ useModelStore.getState().startPull('mistral:7b', controller)
+ expect(useModelStore.getState().activePulls['mistral:7b']).toBeDefined()
+
+ useModelStore.getState().dismissPull('mistral:7b')
+
+ expect(useModelStore.getState().activePulls['mistral:7b']).toBeUndefined()
+ })
+
+ it('is a no-op when there is no matching pull (idempotent)', () => {
+ expect(() => useModelStore.getState().dismissPull('nonexistent:1b')).not.toThrow()
+ expect(useModelStore.getState().activePulls['nonexistent:1b']).toBeUndefined()
+ })
+
+ it('protects against re-creation when a late progress event fires after dismiss', () => {
+ const controller = new AbortController()
+ useModelStore.getState().startPull('codellama:7b', controller)
+ useModelStore.getState().dismissPull('codellama:7b')
+
+ // Simulate a late `pull-progress` event arriving from Rust before the
+ // listener has actually unsubscribed (the original repro).
+ useModelStore.getState().updatePullProgress('codellama:7b', { status: 'late event' })
+
+ expect(useModelStore.getState().activePulls['codellama:7b']).toBeUndefined()
+ })
+})
diff --git a/src/stores/modelStore.ts b/src/stores/modelStore.ts
index d8483983..c7fd5fbd 100644
--- a/src/stores/modelStore.ts
+++ b/src/stores/modelStore.ts
@@ -2,6 +2,7 @@ import { create } from 'zustand'
import { persist } from 'zustand/middleware'
import type { AIModel, PullProgress, ModelCategory } from '../types/models'
import { unloadModel } from '../api/ollama'
+import { isTauri } from '../api/backend'
export interface PullState {
progress: PullProgress
@@ -106,11 +107,37 @@ export const useModelStore = create<ModelState>()(
}
}),
- dismissPull: (name) =>
+ dismissPull: (name) => {
+ // Bug #5 (phantomderp v2.4.3): the X-button used to remove the
+ // entry from `activePulls` without telling Rust to stop the
+ // underlying stream. The Tauri-side `pull_model_stream` kept
+ // emitting `pull-progress` events that re-created the entry via
+ // `pullModelTauri`'s listener — the item visually respawned within
+ // 100 ms and the disk-write kept running. Fix: cancel both sides.
+ //
+ // 1. Abort the AbortController so the listener inside
+ // `useModels.pullModel` sees the abort and the controller's
+ // "abort" handler fires `cancel_model_pull`.
+ // 2. Best-effort: invoke `cancel_model_pull` directly too. This
+ // covers the rare case where the controller was already
+ // consumed (e.g. completed-but-not-yet-dismissed entries) and
+ // is idempotent on the Rust side.
+ const existing = get().activePulls[name]
+ if (existing) {
+ try { existing.controller.abort() } catch { /* already aborted */ }
+ }
+ if (isTauri()) {
+ // Fire-and-forget — the Rust command returns Ok(()) even when
+ // there's nothing to cancel, so failure here is non-fatal.
+ import('@tauri-apps/api/core').then(({ invoke }) => {
+ invoke('cancel_model_pull', { name }).catch(() => {})
+ }).catch(() => {})
+ }
set((state) => {
const { [name]: _, ...rest } = state.activePulls
return { activePulls: rest }
- }),
+ })
+ },
setIsModelLoading: (loading) => set({ isModelLoading: loading }),
setCategoryFilter: (category) => set({ categoryFilter: category }),