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.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
hotfix v2.4.5: Bug G + H + I + J — Linux installer family + ComfyUI --cpu
purple9956b016c25b
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex f674a1eb..6d29cc1f 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -6,7 +6,7 @@ All notable changes to Locally Uncensored are documented here.## [2.4.5] - 2026-05-17-Drop-in hotfix on top of v2.4.4. Six bugs total: five user-reported (A — Discord/Reddit; B — GH #38; C — GH Discussion #39; D — Discord; E — GH #32 comment) plus one discovered during the Arch live verification sweep (F).+Drop-in hotfix on top of v2.4.4. **Ten bugs total**: five user-reported (A — Discord/Reddit; B — GH #38; C — GH Discussion #39; D — Discord; E — GH #32 comment) plus five discovered during the real-tester Arch live verification sweep (F — `install_custom_node` not venv-aware on PEP 668; G — `install_ollama` Windows-only `.exe` download; H — `install_lmstudio` Windows-only; I — `install_python` Windows-only winget; J — `start_comfyui` crashes on non-NVIDIA systems without `--cpu` flag).### Fixed — image / video creation- **Video output now actually produces `.mp4` files** (Bug A — miguelkodoatie Discord 14.05., Turbulent_Tomato7559 Reddit 10.05.). v2.4.4 added a warning when ComfyUI lacked `VHS_VideoCombine`, but the fallback to `SaveAnimatedWEBP` still produced an animated `.webp` "image" instead of a video. v2.4.5 turns the warning into a blocking modal with three options: install VHS now (one-click git clone + pip + ComfyUI restart, ~30 s), continue with `.webp`, or cancel. New entry `videohelpersuite` added to `CUSTOM_NODE_REGISTRY` in `src/api/discover.ts`, new `VhsInstallModal` component in `CreateView`, and a Promise-resolver bridge in `createStore.vhsInstallPrompt` so `useCreate.generate()` can await the user's choice. The install path re-builds the workflow after ComfyUI comes back, so the user gets a proper MP4 on the same Generate click instead of having to retry.@@ -20,6 +20,18 @@ Drop-in hotfix on top of v2.4.4. Six bugs total: five user-reported (A — Disco### Fixed — Linux / AppImage- **Arch / Wayland AppImage now actually paints content** (Bug D — emilmjt Discord 11.05.). The "empty window" symptom on Arch is Tauri 2 + webkit2gtk-4.1 silently failing on DMABUF buffer-sharing and DMA-compositing paths on certain Mesa versions (tauri-apps/tauri#9304). `src-tauri/src/main.rs` now sets `WEBKIT_DISABLE_DMABUF_RENDERER=1` and `WEBKIT_DISABLE_COMPOSITING_MODE=1` at startup on Linux, falling back to software composite — same workaround the GNOME and KDE maintainers recommend. Only set when the user hasn't already exported the vars themselves. `tauri.conf.json` also now declares explicit `bundle.linux.deb.depends` and `bundle.linux.rpm.depends` for `webkit2gtk-4.1`, `gtk3`, and `libayatana-appindicator3-1`, and enables `bundleMediaFramework` on AppImage so gstreamer plugins ship inside the AppImage instead of relying on the host distribution.+### Fixed — Linux / ComfyUI runtime+- **`start_comfyui` + `auto_start_comfyui` pass `--cpu` on non-NVIDIA systems** (Bug J — discovered during 2026-05-17 Arch real-tester sweep). ComfyUI 0.21.x's `main.py` calls `get_torch_device()` → `torch.cuda.current_device()` unconditionally during import. On every Linux system without an NVIDIA driver (AMD ROCm setups, Intel Arc, pure CPU boxes, any user who hasn't installed `nvidia` yet), `torch.cuda._lazy_init()` raises `RuntimeError: Found no NVIDIA driver on your system` and `main.py` crashes before binding port 8188. The user then sees LU stuck on "ComfyUI loading…" (Bug B's 60-s panel surfaces this correctly, but the underlying spawn-then-crash burns time on every restart). New helper `process::needs_cpu_fallback()` probes `nvidia-smi`; when it's absent (and we're not on macOS, where PyTorch uses MPS and never touches cuda APIs), both ComfyUI spawn paths append `--cpu` to the argv. Live-verified on Arch VirtualBox VM 2026-05-17: pre-fix, `main.py` crashed with the verbatim `Found no NVIDIA driver` traceback; post-fix, ComfyUI 0.21.1 started cleanly in CPU mode and answered `/system_stats` after 15 s. Note: AMD/Intel users CURRENTLY downgrade to CPU too — a follow-up will probe `rocm-smi` and Intel XPU devices to pick the right backend, but the safe default is "no crash."++### Fixed — Linux / Ollama install+- **`install_ollama` now has a proper Linux path** (Bug G — discovered during 2026-05-17 Arch real-tester sweep). Pre-fix: `install_ollama` unconditionally downloaded `https://ollama.com/download/OllamaSetup.exe` (a Windows NSIS installer) and tried to execute it with `/S`. On Linux that fails with `Exec format error`; on macOS with the same binary-format mismatch. The user got a cryptic install failure with no actionable path. v2.4.5 dispatches by `target_os`: Windows keeps the existing NSIS flow; **Linux** downloads the official static `ollama-linux-amd64` binary from GitHub releases (`https://github.com/ollama/ollama/releases/latest/download/ollama-linux-amd64`) into `~/.local/bin/ollama` (no sudo required), chmods it +x, then spawns `ollama serve`; **macOS** surfaces a clear pointer at https://ollama.com/download/mac (auto-installing a code-signed `.app` past Gatekeeper from a Tauri process is brittle). Both new paths reuse the existing `wait_for_ollama_ready()` startup probe. Linux failure mode (no `~/.local/bin` in $PATH) is documented in the success message so users know to add it.++### Fixed — Linux + macOS / LM Studio install+- **`install_lmstudio` no longer tries to run a Windows installer on Linux + macOS** (Bug H — discovered during 2026-05-17 Arch real-tester sweep). Pre-fix: `install_lmstudio` unconditionally downloaded `LMStudioSetup.exe` and tried `/S`. Same `Exec format error` on Linux + macOS as Bug G. LM Studio's Linux distribution is an AppImage whose URL rotates with every release (no stable string to mirror) and macOS distributes a code-signed `.app`. v2.4.5 surfaces a clear download pointer at `https://lmstudio.ai/download` for both non-Windows platforms with platform-specific install instructions (AppImage `chmod +x` for Linux, drag to `/Applications` for macOS). Windows path unchanged.++### Fixed — Linux + macOS / Python install+- **`install_python` no longer invokes Windows-only `winget` on Linux + macOS** (Bug I — discovered during 2026-05-17 Arch real-tester sweep). Pre-fix: `install_python` unconditionally called `Command::new("winget")` which on Linux/macOS fails with `winget: command not found`. In practice Python is virtually always pre-installed on Linux (base group on Arch, default on Debian/Ubuntu/Fedora) so the button rarely fires, but the failure path is unhelpful when it does. v2.4.5 detects the distro family from `/etc/os-release` (parses `ID` + `ID_LIKE` tokens correctly across quoted multi-value formats) and surfaces a distro-specific install command: `sudo pacman -S python python-pip` for Arch/Manjaro/EndeavourOS/Garuda; `sudo apt install python3 python3-pip python3-venv` for Debian/Ubuntu/Mint/Pop!/elementary; `sudo dnf install python3 python3-pip` for Fedora/RHEL/CentOS/Rocky/AlmaLinux; `sudo zypper install python3 python3-pip` for openSUSE/SLES. macOS suggests `brew install python` or python.org. Generic fallback for unknown distros points at "your distro's package manager." Tested via 9 cargo unit tests covering the full distro matrix including quoted-multi-value `ID_LIKE="rhel centos fedora"` format that Rocky uses.+### Fixed — Linux / custom-node install- **`install_custom_node` now uses the ComfyUI venv when present** (Bug F — discovered during Arch live verification 2026-05-17). The `install_custom_node` Tauri command (used by Bug A's VHS install path among others) used to call pip against `state.python_bin` (the system Python). On Arch and other PEP 668 distros the requirements install would silently fail with `error: externally-managed-environment` — and since the function did `let _ = pip.output()` and ignored the exit code, the user got a "installed" status while the requirements never actually landed. The next workflow build then crashed with `ModuleNotFoundError`. `install_custom_node` now (1) resolves `<ComfyUI>/venv` via the shared `resolve_comfyui_venv_python()` helper from `src-tauri/src/python.rs`, falling back to `state.python_bin` only when no venv exists, and (2) captures pip's exit status + stderr and runs them through `diagnose_pip_error` so PEP 668 / connection / disk-full / etc. surface actionable messages. This bug only fired on PEP 668 distros (Arch / Debian 12+ / Fedora 38+ / Ubuntu 23.04+) when the user installed ComfyUI through LU's installer (which creates the venv) and then tried to install any custom node afterwards. **LIVE-VERIFIED on REAL Arch 2026-05-17**: in the installed-Arch VM, simulated Bug E's outcome by creating `<ComfyUI>/venv`, then ran the EXACT pip flow `install_custom_node` would issue. (a) venv-python path: `requests>=2.0` installed cleanly into the venv's site-packages, `python -c "import requests; print(requests.__version__)"` returned `2.34.2`; (b) system-python path (what the pre-fix code would have done): pip exited with `error: externally-managed-environment` + Arch's verbatim "If you believe this is a mistake, please contact your Python installation or OS distribution provider … See PEP 668 for the detailed specification" message. Both legs proven empirically.@@ -28,7 +40,7 @@ Drop-in hotfix on top of v2.4.4. Six bugs total: five user-reported (A — Disco### Tests- `vitest`: 2271 passed (93 files) — +7 new tests for `parseOllamaError` missing-blob coverage in `src/lib/__tests__/ollama-errors.test.ts` (Anson192 verbatim error, generic no-fallback-model, forward+back-slash tolerance, Rust-proxy wrapping, chat-style message wording with + without model), +1 smoke test for the new `videohelpersuite` `CUSTOM_NODE_REGISTRY` entry in `src/api/__tests__/comfyui-bundles.test.ts`.-- `cargo test --release`: 70 passed — +5 new tests in `src-tauri/src/main.rs::tests` for the Bug D Linux webkit workaround function (`webkit_workaround_sets_both_vars_when_unset`, `preserves_user_dmabuf_override`, `preserves_user_compositing_override`, `preserves_empty_string_as_explicit_unset`, `is_idempotent`) plus +13 new tests for Bug E in `src-tauri/src/commands/install.rs::tests` and `src-tauri/src/python.rs::tests` (`is_pep668_protected_returns_false_for_empty_bin`, `is_pep668_protected_returns_false_for_garbage_bin`, `diagnose_externally_managed_mentions_venv`, `diagnose_externally_managed_includes_distro_install_commands`, `diagnose_externally_managed_alt_format_matches`, `transient_rejects_externally_managed`, `venv_python_path_matches_platform_layout`, `venv_python_path_is_under_comfyui_dir`, `resolve_returns_none_when_venv_missing`, `resolve_returns_some_when_venv_python_exists`, plus 3 baseline `is_real_python` tests promoted from inline assertions). Bug D tests serialize via `ENV_MUTEX` since env vars are process-global.+- `cargo test --release`: **81 passed** — +5 for Bug D (webkit env-var workarounds) + 13 for Bug E (PEP 668 detection, venv path layout, diagnose hints) + 9 for Bug I (`linux_python_install_hint` distro matrix: Arch, Manjaro via `ID_LIKE`, Ubuntu, Debian, Fedora, Rocky via quoted `ID_LIKE="rhel centos fedora"`, openSUSE, unknown fallback, empty input) + 2 for Bug J (`needs_cpu_fallback` macOS short-circuit + determinism). Bug D + Bug F + Bug G + Bug H code-paths cross-platform via cfg gates — the cfg branches themselves are compile-time checked. Bug E also has a `#[ignore]`'d live integration test (`pep668_e2e_live_detect_and_create_venv`) that exercises the full helper chain against a real Python with a planted PEP 668 marker (Windows simulation) and was driven against real Arch's `/usr/bin/python` during the 2026-05-17 verification.- `cargo check --release`: clean (1 dead-code warning on unused `save_binary_file_dialog`, pre-existing).- `tsc --noEmit`: clean.diff --git a/src-tauri/src/commands/install.rs b/src-tauri/src/commands/install.rsindex 2863a2ca..0d12ec0a 100644--- a/src-tauri/src/commands/install.rs+++ b/src-tauri/src/commands/install.rs@@ -321,7 +321,7 @@ fn diagnose_pip_error(stderr: &str) -> String {/// 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(+pub fn pip_install_streaming_with_retry_cancellable(args: &[&str],python_bin: &str,max_attempts: u32,@@ -849,100 +849,237 @@ pub fn install_ollama(state: State<'_, AppState>) -> Result<serde_json::Value, S}};- // Step 1: Download OllamaSetup.exe- let temp_dir = std::env::temp_dir();- let installer_path = temp_dir.join("OllamaSetup.exe");+ // Bug G (discovered during 2026-05-17 Arch live test): pre-fix+ // install_ollama unconditionally downloaded OllamaSetup.exe (a+ // Windows-only NSIS installer) and tried to execute it with /S.+ // On Linux that fails with "Exec format error" and on macOS with+ // a similar binary-format mismatch — the user sees a cryptic+ // install failure with no path forward. Dispatch by platform.+ #[cfg(target_os = "windows")]+ {+ install_ollama_windows_impl(&ollama_state, update);+ }+ #[cfg(target_os = "linux")]+ {+ install_ollama_linux_impl(&ollama_state, update);+ }+ #[cfg(target_os = "macos")]+ {+ install_ollama_macos_impl(&ollama_state, update);+ }+ });- println!("[Ollama] Downloading OllamaSetup.exe...");+ Ok(serde_json::json!({"status": "downloading"}))+}- match download_file_blocking(- "https://ollama.com/download/OllamaSetup.exe",- &installer_path,- &ollama_state,- ) {- Ok(()) => {- println!("[Ollama] Download complete");- update("installing", "Download complete. Installing Ollama...");- }- Err(e) => {- let err = format!("Download failed: {}", e);- println!("[Ollama] {}", err);- update("error", &err);- return;- }+/// Bug I — Linux distro detection for the install_python error hint.+/// Parses `/etc/os-release` line-by-line, collects `ID` and `ID_LIKE`+/// tokens (stripping the quotes that systemd allows around multi-value+/// fields like `ID_LIKE="rhel centos fedora"`), and returns a distro+/// family install command. Pulled out so we can unit test the matching+/// logic without writing to /etc on the test box.+pub fn linux_python_install_hint(os_release: &str) -> String {+ // Collect family tokens from ID and ID_LIKE.+ let mut families: Vec<String> = Vec::new();+ for line in os_release.lines() {+ let trimmed = line.trim();+ let (key, value) = match trimmed.split_once('=') {+ Some(kv) => kv,+ None => continue,+ };+ let key = key.trim().to_lowercase();+ if key != "id" && key != "id_like" {+ continue;+ }+ // Strip surrounding quotes if present, then split on whitespace+ // (ID_LIKE often carries multiple space-separated tokens).+ let value = value.trim().trim_matches('"').trim_matches('\'');+ for token in value.split_whitespace() {+ families.push(token.to_lowercase());}+ }+ let has = |needle: &str| families.iter().any(|f| f == needle);- // Step 2: Run silent install- println!("[Ollama] Running silent installer...");- let mut cmd = Command::new(&installer_path);- cmd.arg("/S");- #[cfg(target_os = "windows")]- cmd.creation_flags(CREATE_NO_WINDOW);+ if has("arch") || has("manjaro") || has("endeavouros") || has("garuda") {+ "`sudo pacman -S python python-pip`".to_string()+ } else if has("debian") || has("ubuntu") || has("linuxmint") || has("pop") || has("elementary") {+ "`sudo apt install python3 python3-pip python3-venv`".to_string()+ } else if has("fedora") || has("rhel") || has("centos") || has("rocky") || has("almalinux") {+ "`sudo dnf install python3 python3-pip`".to_string()+ } else if has("opensuse") || has("opensuse-tumbleweed") || has("opensuse-leap") || has("suse") || has("sles") {+ "`sudo zypper install python3 python3-pip`".to_string()+ } else {+ "your distro's package manager".to_string()+ }+}- match cmd.output() {- Ok(output) if output.status.success() => {- println!("[Ollama] Installation successful");- update("starting", "Ollama installed. Starting Ollama...");- }- Ok(output) => {- let code = output.status.code().unwrap_or(-1);- // NSIS installer returns 0 on success; non-zero might still be OK- println!("[Ollama] Installer exited with code {}", code);- update("starting", &format!("Installer finished (code {}). Starting Ollama...", code));- }- Err(e) => {- let err = format!("Could not run installer: {}", e);- println!("[Ollama] {}", err);- update("error", &err);+/// Wait for Ollama HTTP API to respond on the default port (best-effort+/// shared startup probe used after every platform-specific install path).+fn wait_for_ollama_ready() -> bool {+ let client = reqwest::blocking::Client::builder()+ .timeout(std::time::Duration::from_secs(3))+ .build()+ .unwrap_or_default();+ for i in 0..15 {+ std::thread::sleep(std::time::Duration::from_secs(2));+ match client.get("http://localhost:11434/api/tags").send() {+ Ok(res) if res.status().is_success() => return true,+ _ => println!("[Ollama] Not ready yet, attempt {}/15", i + 1),+ }+ }+ false+}++#[cfg(target_os = "windows")]+fn install_ollama_windows_impl<F: Fn(&str, &str)>(+ ollama_state: &Arc<Mutex<InstallState>>,+ update: F,+) {+ let temp_dir = std::env::temp_dir();+ let installer_path = temp_dir.join("OllamaSetup.exe");+ println!("[Ollama] Downloading OllamaSetup.exe...");+ if let Err(e) = download_file_blocking(+ "https://ollama.com/download/OllamaSetup.exe",+ &installer_path,+ ollama_state,+ ) {+ update("error", &format!("Download failed: {}", e));+ return;+ }+ update("installing", "Download complete. Installing Ollama...");+ let mut cmd = Command::new(&installer_path);+ cmd.arg("/S");+ cmd.creation_flags(CREATE_NO_WINDOW);+ match cmd.output() {+ Ok(o) => {+ let code = o.status.code().unwrap_or(-1);+ update("starting", &format!("Installer finished (code {}). Starting Ollama...", code));+ }+ Err(e) => {+ update("error", &format!("Could not run installer: {}", e));+ return;+ }+ }+ let _ = fs::remove_file(&installer_path);+ let mut serve = Command::new("ollama");+ serve.arg("serve").stdout(Stdio::piped()).stderr(Stdio::piped());+ serve.creation_flags(CREATE_NO_WINDOW);+ let _ = serve.spawn();+ update("starting", "Waiting for Ollama to start...");+ if wait_for_ollama_ready() {+ update("complete", "Ollama is ready!");+ } else {+ update("error", "Ollama installed but not responding. Try restarting the app.");+ }+}++#[cfg(target_os = "linux")]+fn install_ollama_linux_impl<F: Fn(&str, &str)>(+ ollama_state: &Arc<Mutex<InstallState>>,+ update: F,+) {+ // If `ollama` is already on PATH (pacman -S ollama, manual install, etc.),+ // skip the download entirely.+ if Command::new("which").arg("ollama").output().map(|o| o.status.success()).unwrap_or(false) {+ update("starting", "Ollama is already installed — starting service...");+ } else {+ // Download the official static Linux x86_64 binary from GitHub releases.+ // (https://ollama.com/install.sh's curl|sh path needs sudo to write into+ // /usr/local/bin, which isn't safe to drive from a desktop app. Putting+ // the binary in ~/.local/bin avoids the sudo round-trip and works for+ // every Linux user.)+ let home = match std::env::var("HOME") {+ Ok(h) => PathBuf::from(h),+ Err(_) => {+ update("error", "Could not resolve $HOME. Install Ollama manually: pacman -S ollama / apt install ollama / brew install ollama.");return;}+ };+ let bin_dir = home.join(".local").join("bin");+ if let Err(e) = fs::create_dir_all(&bin_dir) {+ update("error", &format!("Could not create {}: {}", bin_dir.display(), e));+ return;}+ let binary_path = bin_dir.join("ollama");+ update("downloading", &format!("Downloading ollama-linux-amd64 to {}...", binary_path.display()));+ if let Err(e) = download_file_blocking(+ "https://github.com/ollama/ollama/releases/latest/download/ollama-linux-amd64",+ &binary_path,+ ollama_state,+ ) {+ update("error", &format!(+ "Download failed: {}. Install Ollama manually via your distro package \+ manager: `pacman -S ollama` (Arch), `apt install ollama` (Debian/Ubuntu \+ 23.10+), or download from https://ollama.com/download/linux.",+ e+ ));+ return;+ }+ // chmod +x+ #[cfg(unix)]+ {+ use std::os::unix::fs::PermissionsExt;+ if let Ok(meta) = fs::metadata(&binary_path) {+ let mut perms = meta.permissions();+ perms.set_mode(0o755);+ let _ = fs::set_permissions(&binary_path, perms);+ }+ }+ update("installing", &format!("Installed to {}. Note: add ~/.local/bin to your PATH if you want to run `ollama` from your shell.", binary_path.display()));+ }- // Cleanup installer- let _ = fs::remove_file(&installer_path);+ // Resolve absolute path (PATH may not include ~/.local/bin in the spawned+ // shell environment, so prefer the explicit binary path when we know it).+ let home = std::env::var("HOME").ok().map(PathBuf::from);+ let explicit = home.map(|h| h.join(".local").join("bin").join("ollama"));+ let ollama_cmd = match explicit {+ Some(p) if p.exists() => p.to_string_lossy().to_string(),+ _ => "ollama".to_string(),+ };++ let mut serve = Command::new(&ollama_cmd);+ serve.arg("serve").stdout(Stdio::piped()).stderr(Stdio::piped());+ let _ = serve.spawn();- // Step 3: Start ollama serve- println!("[Ollama] Starting ollama serve...");+ update("starting", "Waiting for Ollama to start...");+ if wait_for_ollama_ready() {+ update("complete", "Ollama is ready!");+ } else {+ update(+ "error",+ "Ollama installed but the API isn't responding on localhost:11434. \+ Open a terminal and run `ollama serve` manually — if that fails, \+ the binary at ~/.local/bin/ollama may be missing executable \+ permissions or your kernel may need an older static build.",+ );+ }+}++#[cfg(target_os = "macos")]+fn install_ollama_macos_impl<F: Fn(&str, &str)>(+ _ollama_state: &Arc<Mutex<InstallState>>,+ update: F,+) {+ if Command::new("which").arg("ollama").output().map(|o| o.status.success()).unwrap_or(false) {+ update("starting", "Ollama already installed — starting service...");let mut serve = Command::new("ollama");serve.arg("serve").stdout(Stdio::piped()).stderr(Stdio::piped());- #[cfg(target_os = "windows")]- serve.creation_flags(CREATE_NO_WINDOW);-- // Try to start — may already be running as servicelet _ = serve.spawn();-- // Step 4: Wait for Ollama to respond (up to 30 seconds)- println!("[Ollama] Waiting for Ollama to be ready...");- update("starting", "Waiting for Ollama to start...");-- let client = reqwest::blocking::Client::builder()- .timeout(std::time::Duration::from_secs(3))- .build()- .unwrap_or_default();-- let mut ready = false;- for i in 0..15 {- std::thread::sleep(std::time::Duration::from_secs(2));- match client.get("http://localhost:11434/api/tags").send() {- Ok(res) if res.status().is_success() => {- ready = true;- break;- }- _ => {- println!("[Ollama] Not ready yet, attempt {}/15", i + 1);- }- }- }-- if ready {- println!("[Ollama] Ready!");+ if wait_for_ollama_ready() {update("complete", "Ollama is ready!");} else {- update("error", "Ollama installed but not responding. Try restarting the app.");+ update("error", "Ollama is installed but the API isn't responding. Try restarting Ollama.app.");}- });-- Ok(serde_json::json!({"status": "downloading"}))+ return;+ }+ // We don't auto-install on macOS because the official distribution is+ // the signed Ollama.app from ollama.com/download/mac. Surfacing a clear+ // pointer beats trying to script around macOS gatekeeper.+ update(+ "error",+ "On macOS, download Ollama.app from https://ollama.com/download/mac and \+ move it to /Applications, then come back here and click Re-detect.",+ );}#[tauri::command]@@ -1199,6 +1336,38 @@ pub fn install_lmstudio(state: State<'_, AppState>) -> Result<serde_json::Value,}};+ // Bug H (discovered during 2026-05-17 Arch live test): pre-fix+ // install_lmstudio unconditionally downloaded LMStudioSetup.exe+ // (Windows installer) and tried to `cmd.arg("/S")` it. On Linux+ // the execve crashes with "Exec format error"; on macOS the+ // mismatch is the same. LM Studio's Linux distribution is an+ // AppImage whose URL rotates with every release, so we can't+ // mirror it from a stable in-binary string — surface a clear+ // download pointer instead of pretending to auto-install.+ #[cfg(target_os = "linux")]+ {+ update(+ "error",+ "LM Studio's Linux distribution is an AppImage with a URL that \+ rotates per release. Download it from https://lmstudio.ai/download \+ (pick 'Linux AppImage'), `chmod +x` the file, run it once to \+ finish bootstrap, then come back to LU and click Re-detect.\n\n\+ Tip: if you prefer the CLI-only path, the `lms` CLI ships with \+ the AppImage and lands at ~/.lmstudio/bin/lms after first run.",+ );+ return;+ }+ #[cfg(target_os = "macos")]+ {+ update(+ "error",+ "On macOS, download LM Studio.app from https://lmstudio.ai/download, \+ drag it to /Applications, launch it once to finish setup, then \+ come back to LU and click Re-detect.",+ );+ return;+ }+// Pre-check: if LM Studio is already installed (an `lms.exe` is// findable in any of the locations `lmstudio_lms_path()` knows about)// we skip the ~570 MB download entirely. Re-installing on a box where@@ -1495,6 +1664,40 @@ pub fn install_python(state: State<'_, AppState>) -> Result<serde_json::Value, S}};+ // Bug I (discovered during 2026-05-17 Arch live test): pre-fix+ // install_python unconditionally invoked `winget` which is+ // Windows-exclusive. On Linux that fails with "winget: command+ // not found" and the user gets stuck. In practice every modern+ // Linux distro ships Python in the base group so the install+ // button rarely needs to fire — but when it does, surfacing the+ // right distro-specific install command beats a cryptic spawn+ // error.+ #[cfg(target_os = "linux")]+ {+ let os_release = std::fs::read_to_string("/etc/os-release").unwrap_or_default();+ let suggestion = linux_python_install_hint(&os_release);+ update(+ "error",+ &format!(+ "Python isn't installed system-wide. On Linux, install it via {} \+ then click Re-detect. (LU's auto-installer is Windows-only — on \+ Linux your package manager is the right tool.)",+ suggestion+ ),+ );+ return;+ }+ #[cfg(target_os = "macos")]+ {+ update(+ "error",+ "Python isn't installed system-wide. On macOS, install it via \+ `brew install python` (Homebrew) or download Python 3.12+ from \+ https://www.python.org/downloads/macos/ then click Re-detect.",+ );+ return;+ }+// Stream-friendly winget invocation. `--silent --accept-*-agreements`// drops the EULA prompts; without them winget will sit and wait for// user input forever inside our background thread. Python.Python.3.12@@ -2143,6 +2346,72 @@ mod tests {));}+ // ── Bug I — linux_python_install_hint distro detection ────────────────++ #[test]+ fn linux_hint_arch_via_id_field() {+ let release = "NAME=\"Arch Linux\"\nID=arch\nID_LIKE=archlinux\n";+ let hint = linux_python_install_hint(release);+ assert!(hint.contains("pacman"), "got: {}", hint);+ assert!(hint.contains("python") && hint.contains("pip"));+ }++ #[test]+ fn linux_hint_manjaro_via_id_like_arch() {+ let release = "NAME=\"Manjaro\"\nID=manjaro\nID_LIKE=arch\n";+ let hint = linux_python_install_hint(release);+ assert!(hint.contains("pacman"), "Manjaro should map to Arch family, got: {}", hint);+ }++ #[test]+ fn linux_hint_ubuntu_via_id_like_debian() {+ let release = "NAME=\"Ubuntu\"\nID=ubuntu\nID_LIKE=debian\n";+ let hint = linux_python_install_hint(release);+ assert!(hint.contains("apt"), "got: {}", hint);+ assert!(hint.contains("python3"));+ }++ #[test]+ fn linux_hint_debian_via_id() {+ let release = "NAME=\"Debian GNU/Linux\"\nID=debian\n";+ let hint = linux_python_install_hint(release);+ assert!(hint.contains("apt"), "got: {}", hint);+ }++ #[test]+ fn linux_hint_fedora_via_id() {+ let release = "NAME=\"Fedora Linux\"\nID=fedora\nID_LIKE=\"fedora\"\n";+ let hint = linux_python_install_hint(release);+ assert!(hint.contains("dnf"), "got: {}", hint);+ }++ #[test]+ fn linux_hint_rocky_via_id_like_rhel() {+ let release = "NAME=\"Rocky Linux\"\nID=rocky\nID_LIKE=\"rhel centos fedora\"\n";+ let hint = linux_python_install_hint(release);+ assert!(hint.contains("dnf"), "RHEL-family should suggest dnf, got: {}", hint);+ }++ #[test]+ fn linux_hint_opensuse_via_id_like() {+ let release = "NAME=\"openSUSE Tumbleweed\"\nID=opensuse-tumbleweed\nID_LIKE=\"opensuse suse\"\n";+ let hint = linux_python_install_hint(release);+ assert!(hint.contains("zypper"), "got: {}", hint);+ }++ #[test]+ fn linux_hint_unknown_distro_falls_back() {+ let release = "NAME=\"Some Custom Distro\"\nID=mystery\n";+ let hint = linux_python_install_hint(release);+ assert!(hint.contains("package manager"), "got: {}", hint);+ }++ #[test]+ fn linux_hint_empty_input_falls_back() {+ let hint = linux_python_install_hint("");+ assert!(hint.contains("package manager"));+ }+// ── Bug E — LIVE integration test ──────────────────────────────────────//// Runs against a real Python install with a real EXTERNALLY-MANAGEDdiff --git a/src-tauri/src/commands/process.rs b/src-tauri/src/commands/process.rsindex 141d3f31..f59bf080 100644--- a/src-tauri/src/commands/process.rs+++ b/src-tauri/src/commands/process.rs@@ -60,6 +60,29 @@ pub fn show_window(app: tauri::AppHandle) {}}+/// Bug J: does this system need ComfyUI's --cpu fallback flag?+///+/// ComfyUI 0.21.x's `main.py` calls `get_torch_device()` which calls+/// `torch.cuda.current_device()` unconditionally during import. On systems+/// without an NVIDIA driver, that raises `RuntimeError: Found no NVIDIA+/// driver on your system` and main.py crashes before binding the port.+///+/// We pass `--cpu` to fall back to CPU inference when:+/// - Not on macOS (Mac PyTorch uses MPS, which doesn't touch cuda APIs), AND+/// - `nvidia-smi` is missing or exits non-zero (no NVIDIA card present).+///+/// AMD ROCm + Intel XPU setups CURRENTLY fall into this branch too, which+/// is conservative: they downgrade to CPU instead of crashing. A future+/// enhancement can probe `rocm-smi` / Intel devices and skip `--cpu` for+/// real hardware accel paths. For now the safe default is "no crash."+pub fn needs_cpu_fallback() -> bool {+ if cfg!(target_os = "macos") {+ return false;+ }+ let probe = Command::new("nvidia-smi").output();+ !probe.map(|o| o.status.success()).unwrap_or(false)+}+/// Skip these directories during ComfyUI searchconst SKIP_DIRS: &[&str] = &["node_modules", ".git", "__pycache__", "venv", ".venv", "site-packages",@@ -651,8 +674,29 @@ pub fn start_comfyui(state: State<'_, AppState>) -> Result<serde_json::Value, St}println!("[ComfyUI] Starting from: {} on port {}", comfy_path, port);+ // Bug J (discovered during 2026-05-17 Arch live test): on systems without+ // an NVIDIA driver (most Linux non-NVIDIA setups: AMD, Intel, CPU-only;+ // also Windows boxes without an NVIDIA card), ComfyUI's main.py calls+ // get_torch_device() → torch.cuda.current_device() → which raises+ // `RuntimeError: Found no NVIDIA driver on your system` before+ // main.py ever binds the port. The user sees LU stuck on "ComfyUI+ // loading..." (which Bug B's 60-s panel now correctly surfaces, but+ // the underlying spawn-then-crash loop wastes the user's time on every+ // start). Detect NVIDIA via `nvidia-smi` and pass --cpu when absent,+ // except on macOS where PyTorch uses MPS and never calls cuda APIs.+ let needs_cpu_fallback = needs_cpu_fallback();+ let mut comfy_args: Vec<&str> = vec![+ "main.py",+ "--listen", "127.0.0.1",+ "--port", &port_str,+ "--enable-cors-header", "*",+ ];+ if needs_cpu_fallback {+ comfy_args.push("--cpu");+ println!("[ComfyUI] No NVIDIA driver detected — passing --cpu to ComfyUI (CPU inference fallback)");+ }let mut cmd = Command::new(&python);- cmd.args(["main.py", "--listen", "127.0.0.1", "--port", &port_str, "--enable-cors-header", "*"])+ cmd.args(&comfy_args).current_dir(&comfy_path).env("TQDM_DISABLE", "1").env("PYTHONUNBUFFERED", "1")@@ -1103,8 +1147,21 @@ pub fn auto_start_comfyui(state: &AppState) {println!("[ComfyUI] Auto-start using ComfyUI venv Python (PEP 668 install): {}", python);}+ // Bug J: same --cpu fallback as start_comfyui to avoid the+ // "Found no NVIDIA driver" crash loop on non-NVIDIA systems.+ let auto_needs_cpu = needs_cpu_fallback();+ let mut comfy_args: Vec<&str> = vec![+ "main.py",+ "--listen", "127.0.0.1",+ "--port", &port_str,+ "--enable-cors-header", "*",+ ];+ if auto_needs_cpu {+ comfy_args.push("--cpu");+ println!("[ComfyUI] Auto-start: no NVIDIA driver — passing --cpu");+ }let mut cmd = Command::new(&python);- cmd.args(["main.py", "--listen", "127.0.0.1", "--port", &port_str, "--enable-cors-header", "*"])+ cmd.args(&comfy_args).current_dir(&path).env("TQDM_DISABLE", "1").env("PYTHONUNBUFFERED", "1")@@ -1152,3 +1209,36 @@ pub fn auto_start_comfyui(state: &AppState) {None => println!("[ComfyUI] Not found. Install ComfyUI or set path in settings."),}}++#[cfg(test)]+mod tests {+ use super::*;++ // ── Bug J: needs_cpu_fallback platform short-circuit ─────────────────++ #[test]+ fn needs_cpu_fallback_is_false_on_macos() {+ // On macOS, PyTorch uses MPS and never calls cuda APIs that crash+ // the way Linux+no-NVIDIA does. The fallback must be a no-op there+ // so we don't downgrade real Mac users (M1/M2/etc) to CPU inference.+ if cfg!(target_os = "macos") {+ assert!(!needs_cpu_fallback(), "macOS must short-circuit to false");+ } else {+ // On non-macOS, the result depends on whether nvidia-smi is+ // installed + returns success. The function is total — it must+ // not panic in either branch. We just call it and assert it+ // returns a bool (compiler-enforced anyway).+ let _ = needs_cpu_fallback();+ }+ }++ #[test]+ fn needs_cpu_fallback_is_deterministic_for_repeat_calls() {+ // Two consecutive calls must agree — no time-based or random+ // behaviour smuggled in (Bug J's fix probes nvidia-smi each call,+ // so if nvidia-smi state doesn't change, the answer doesn't either).+ let a = needs_cpu_fallback();+ let b = needs_cpu_fallback();+ assert_eq!(a, b, "needs_cpu_fallback returned inconsistent results");+ }+}