Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Desktop: warn before quitting during an update and skip installer fallback on cancel (#7793)
Nilay8089cfc049c5
diff --git a/studio/src-tauri/src/commands.rs b/studio/src-tauri/src/commands.rsindex b984dc44cef..25a9eb29024 100644--- a/studio/src-tauri/src/commands.rs+++ b/studio/src-tauri/src/commands.rs@@ -561,6 +561,19 @@ pub async fn start_managed_repair();}Err(msg) => {+ // A stop is the user quitting or cancelling, not a broken install. Running+ // the installer here rewrites a working venv and leaves it half-built when+ // the app exits underneath it.+ if msg == update::UPDATE_STOPPED {+ info!("Managed repair update stopped; skipping installer fallback");+ diagnostics::finish_repair_group(+ &diagnostics_state,+ &repair_group_id,+ "failed",+ Some(msg.clone()),+ );+ return Err(msg);+ }if msg.to_ascii_lowercase().contains("already running") {error!("Managed repair update conflict: {}", msg);diagnostics::finish_repair_group(diff --git a/studio/src-tauri/src/main.rs b/studio/src-tauri/src/main.rsindex 31eef4ec1d3..6a1026130ff 100644--- a/studio/src-tauri/src/main.rs+++ b/studio/src-tauri/src/main.rs@@ -159,6 +159,32 @@ fn confirm_quit_during_install(app: &tauri::AppHandle) -> bool {.blocking_show()}+/// Ask before quitting mid-update (true to proceed): the update is killed part-way+/// through installing dependencies, which leaves the venv unusable until it is repaired.+fn confirm_quit_during_update(app: &tauri::AppHandle) -> bool {+ use tauri_plugin_dialog::{DialogExt, MessageDialogButtons, MessageDialogKind};++ let Some(update_state) = app.try_state::<update::UpdateState>() else {+ return true;+ };+ if !update::is_update_running(&update_state) {+ return true;+ }+ app.dialog()+ .message(+ "Unsloth is still updating. Quitting now stops it part-way and \+ leaves the installation incomplete, so it will need to be repaired before \+ it can start.",+ )+ .kind(MessageDialogKind::Warning)+ .title("Update in progress")+ .buttons(MessageDialogButtons::OkCancelCustom(+ "Quit anyway".to_string(),+ "Keep updating".to_string(),+ ))+ .blocking_show()+}+fn cleanup_child_processes(app: &tauri::AppHandle) {// `call_once_force` rather than `call_once`: a panicking cleanup poisons the `Once`// instead of deadlocking the exit paths waiting on it, and the next caller retries@@ -286,6 +312,9 @@ fn setup_tray(app: &tauri::App) -> Result<(), Box<dyn std::error::Error>> {if !confirm_quit_during_install(&app_handle) {return;}+ if !confirm_quit_during_update(&app_handle) {+ return;+ }if !confirm_quit_during_training(&app_handle) {return;}diff --git a/studio/src-tauri/src/update.rs b/studio/src-tauri/src/update.rsindex bc9e4e7a83c..ff3872163d0 100644--- a/studio/src-tauri/src/update.rs+++ b/studio/src-tauri/src/update.rs@@ -213,7 +213,7 @@ fn wait_for_exit(state: &UpdateState) -> Result<(ExitStatus, bool), String> {return Err(format!("Error waiting for update: {}", e));}},- None if intentional => return Err("Update stopped.".to_string()),+ None if intentional => return Err(UPDATE_STOPPED.to_string()),None => return Err("Update process disappeared unexpectedly.".to_string()),}@@ -331,11 +331,11 @@ fn run_backend_update_with_terminal_events(&attempt,Some(status.to_string()),true,- Some("Update stopped.".to_string()),+ Some(UPDATE_STOPPED.to_string()),);clear_current_attempt(&state);info!("[update] Update stopped intentionally");- Err("Update stopped.".to_string())+ Err(UPDATE_STOPPED.to_string())}Ok((status, intentional)) => {let code = status.code().unwrap_or(-1);@@ -372,6 +372,13 @@ fn clear_current_attempt(state: &UpdateState) {}}+pub fn is_update_running(state: &UpdateState) -> bool {+ state+ .lock()+ .map(|update| update.child.is_some())+ .unwrap_or(false)+}+pub fn record_update_intentional_stop(state: &UpdateState, diagnostics: &DiagnosticsState) {let attempt = state.lock()@@ -388,6 +395,8 @@ pub fn record_update_intentional_stop(state: &UpdateState, diagnostics: &Diagnos}}+pub const UPDATE_STOPPED: &str = "Update stopped.";+pub fn stop_update(state: &UpdateState) -> Result<(), String> {let mut child = {let mut update = match state.lock() {