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
fix(engine): Wiederanlauf jetzt auch bei Install und Update aufgerufen (F12)
purple3ab0547210ef
diff --git a/src-tauri/src/commands/install/comfy_install.rs b/src-tauri/src/commands/install/comfy_install.rsindex 72b55aae..465f8c60 100644--- a/src-tauri/src/commands/install/comfy_install.rs+++ b/src-tauri/src/commands/install/comfy_install.rs@@ -36,7 +36,7 @@ use super::comfy_job::{ComfyJob, COMFY_JOB};use super::comfy_job::comfy_job_busy_message;use super::pip::pip_install_streaming_with_retry_cancellable;use super::torch::plan_pytorch_install;-use super::venv::{create_comfyui_venv, is_pep668_protected};+use super::venv::{create_comfyui_venv, is_pep668_protected, restore_orphaned_venv_if_needed};#[cfg(target_os = "windows")]use super::git::{windows_git_install_hint, windows_git_probe, WindowsGitState};#[cfg(target_os = "windows")]@@ -295,6 +295,17 @@ pub fn install_comfyui(return;}+ // Runde 6, F12: a crash mid Repair can leave a `venv.lu-old-*` sibling+ // and no usable `venv` behind (see venv.rs's own doc). This used to be+ // adopted back only when the customer next pressed Repair; pressing+ // Install instead (a target directory that already has a ComfyUI+ // checkout, the "already exists" branch below) walked right past the+ // several-gigabyte orphan and read the folder as having no venv at+ // all. A no-op on a healthy install (`venv_python_path` already+ // exists), so this is safe to call unconditionally, before anything+ // else looks at the folder.+ restore_orphaned_venv_if_needed(&target_dir);+// Bug N (juliandiggins-stack issue #40, 2026-05-18) — probe Windows// git BEFORE clone so a WSL/non-native git on PATH surfaces a clear// hint instead of failing the clone halfway with cryptic stderr.@@ -915,6 +926,31 @@ mod tests {);}}++ /// Runde 6, F12: a crashed Repair can leave an orphaned `venv.lu-old-*`+ /// sibling behind (venv.rs's `restore_orphaned_venv_if_needed`). Install+ /// must adopt it back too, before either the "already exists" branch or+ /// the fresh-venv branch looks at the folder, or a customer who presses+ /// Install instead of Repair after a crash loses a working venv to a+ /// silent rebuild. Read out of the source like the two guards above.+ #[test]+ fn install_also_recovers_an_orphaned_venv_before_touching_the_folder() {+ let src = include_str!("comfy_install.rs");+ let needle = |head: &str, tail: &str| format!("{head}{tail}");++ let recovery_call = needle("restore_orphaned_venv_if_needed(&target_dir", ");");+ let clone_start = needle("Cloning ComfyUI to ", "{:?}");+ let existing_venv_check = needle("comfy_venv_state(&target_dir", ")");++ let at_recovery = src.find(&recovery_call).expect("install no longer recovers an orphaned venv");+ let at_clone = src.find(&clone_start).expect("the clone step marker is gone");+ let at_existing_check = src.find(&existing_venv_check).expect("the existing-venv detection is gone");++ assert!(at_recovery < at_clone, "orphan recovery must run before git clone/pull touches the folder");+ assert!(at_recovery < at_existing_check, "orphan recovery must run before the existing-venv state is read");++ assert_eq!(src.matches(&recovery_call).count(), 1, "the recovery call must appear exactly once");+ }}/// KF-28: der Doc-Kommentar über `check_install_disk_pressure` darf nurdiff --git a/src-tauri/src/commands/install/comfy_repair.rs b/src-tauri/src/commands/install/comfy_repair.rsindex a3dd28d3..6c4bc585 100644--- a/src-tauri/src/commands/install/comfy_repair.rs+++ b/src-tauri/src/commands/install/comfy_repair.rs@@ -689,6 +689,14 @@ pub fn update_comfyui(state: State<'_, AppState>) -> Result<serde_json::Value, S);}+ // Runde 6, F12: same reasoning as install_comfyui's call. Without this,+ // an Update pressed after a Repair that crashed mid rebuild reads+ // `comfy_venv_state` below as `Absent` (the retired `venv.lu-old-*`+ // sibling is not named `venv`), falls back to the system Python, and+ // never notices the several-gigabyte orphan sitting right next to it.+ // A no-op once a usable `venv` already exists.+ restore_orphaned_venv_if_needed(&comfy_dir);+// Prefer the install's venv Python (same preference the launcher uses);// refuse without a usable interpreter — a pulled core with stale// requirements is worse than no update (frontend package pins move often).@@ -1129,4 +1137,28 @@ mod tests {}}+ /// Runde 6, F12: Update reads `comfy_venv_state` synchronously, before+ /// even spawning its worker thread, to decide which Python to install+ /// requirements into. Without recovering an orphaned `venv.lu-old-*`+ /// first, that read comes back `Absent` and Update silently falls back+ /// to the system Python instead of adopting the recoverable venv, the+ /// exact failure mode F12 is about, just from the Update button instead+ /// of Install.+ #[test]+ fn update_also_recovers_an_orphaned_venv_before_reading_the_venv_state() {+ let src = include_str!("comfy_repair.rs");+ let needle = |head: &str, tail: &str| format!("{head}{tail}");++ let update_fn_start = src.find("pub fn update_comfyui(").expect("update_comfyui is gone");+ let recovery_call = needle("restore_orphaned_venv_if_needed(&comfy_d", "ir);");+ let venv_state_read = needle("comfy_venv_state(&comfy_d", "ir)");++ // Both needles occur twice in the file (Repair has its own copies);+ // only the occurrence inside update_comfyui, i.e. after its `fn`+ // keyword, is what this test is about.+ let at_recovery = src[update_fn_start..].find(&recovery_call).map(|i| i + update_fn_start).expect("update_comfyui no longer recovers an orphaned venv");+ let at_state_read = src[update_fn_start..].find(&venv_state_read).map(|i| i + update_fn_start).expect("update_comfyui no longer reads the venv state");++ assert!(at_recovery < at_state_read, "orphan recovery must run before update_comfyui reads the venv state");+ }}diff --git a/src-tauri/src/commands/install/venv.rs b/src-tauri/src/commands/install/venv.rsindex 5f326412..9dd46b37 100644--- a/src-tauri/src/commands/install/venv.rs+++ b/src-tauri/src/commands/install/venv.rs@@ -359,9 +359,15 @@ pub(crate) fn finish_rebuild(comfy_dir: &Path, retired: Option<PathBuf>) {/// `retire_for_rebuild` and the new venv passing verification (a crash, a/// power loss, the process being killed), the customer's ComfyUI folder can/// be left with a `venv.lu-old-*` sibling and NO working `venv` at all-/// (`restore_after_failed_rebuild` never got to run). Called at the START of-/// every Repair and Install run, before anything else touches the folder:-/// if there is already a usable venv, this does nothing at all. If there is+/// (`restore_after_failed_rebuild` never got to run). Runde 6, F12 (review+/// Runde 6): called at the START of every entry point that reads or writes+/// this venv, not only Repair, where it was originally called alone. Install+/// (both the existing-venv and the fresh-venv branch) and Update read+/// `comfy_venv_state`/`venv_python_path` just as directly, and used to read+/// an orphaned rebuild as "no venv" and fall back to the system Python,+/// walking right past a several-gigabyte recoverable folder instead of+/// adopting it back. Called before anything else touches the folder: if+/// there is already a usable venv, this does nothing at all. If there is/// not, but a retired one exists, the NEWEST retired folder (the one this/// run's own interrupted attempt would have made) is restored to `venv`/// before the run continues; any OLDER retired or abandoned staging folder