Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(onboarding): Re-run onboarding legt die ganze Befehlsschicht still (T11 P2)

purple762aa2aaf0b8
diff --git a/src-tauri/src/commands/system.rs b/src-tauri/src/commands/system.rs
index 7cadb9a0..fff8db52 100644
--- a/src-tauri/src/commands/system.rs
+++ b/src-tauri/src/commands/system.rs
@@ -624,7 +624,23 @@ pub(crate) fn write_onboarding_marker(done: bool) -> Result<(), String> {
/// successful write — the marker is the one truth the windows are decided
/// from, and moving them on a marker that is not there would leave the main
/// window hidden behind a rule it can never satisfy.
-#[tauri::command]
+// ASYNC: this command BUILDS A WINDOW. `follow_marker(false)`, the
+// Settings "Re-run onboarding" path, goes through `onboarding_window::open`,
+// and that is the only WebviewWindowBuilder in the app. A synchronous Tauri
+// command runs in the CALLER's thread, and that is the main thread inside
+// WebView2's WebResourceRequested handler, with the deferral still open for
+// the very IPC request it is answering. Building a webview there pumps a
+// nested Windows message loop and waits on the same browser process that is
+// waiting for that answer: the command never returns, and with it the WHOLE
+// command layer stops answering anything (T11 point 2, 2026-09-11: four
+// empty chat replies, Models stuck on "Loading models", the window cross
+// dead, only taskkill /F /T helped). With `(async)` Tauri dispatches the body
+// off the main thread, so `Message::CreateWindow` is posted to the event loop
+// instead of being built in place. Same treatment `find_comfyui`
+// (commands/process.rs) and `fs_search` (commands/filesystem.rs) already got.
+// The window build arrived with be2e3849 (2026-09-01) and shipped in 2.6.8
+// and 2.6.9.
+#[tauri::command(async)]
pub fn set_onboarding_done(app: tauri::AppHandle, done: Option<bool>) -> Result<(), String> {
let done = done.unwrap_or(true);
write_onboarding_marker(done)?;
diff --git a/src-tauri/src/onboarding_window.rs b/src-tauri/src/onboarding_window.rs
index 913f2a82..ed3f6a6b 100644
--- a/src-tauri/src/onboarding_window.rs
+++ b/src-tauri/src/onboarding_window.rs
@@ -600,6 +600,43 @@ mod tests {
assert!(f.contains("?;"), "a failed write must not move the windows — the marker is the truth");
}
+ /// Der Fensterbau gehört NICHT in den synchronen IPC-Handler.
+ ///
+ /// `set_onboarding_done` ist der einzige Befehl, der zur Laufzeit ein
+ /// zweites WebView-Fenster baut: `follow_marker(false)` ruft `open()`,
+ /// und das ist der einzige `WebviewWindowBuilder` der App. Ein
+ /// synchroner Tauri-Befehl läuft im Faden des AUFRUFERS, und der ist auf
+ /// Windows der Hauptfaden mitten im WebResourceRequested-Handler von
+ /// WebView2, mit offenem Deferral für genau die IPC-Anfrage, die er
+ /// beantworten soll. Ein Fensterbau pumpt dort eine geschachtelte
+ /// Windows-Nachrichtenschleife und wartet auf denselben Browserprozess,
+ /// der auf diese Antwort wartet. Der Befehl kehrt nie zurück, und mit ihm
+ /// antwortet die GANZE Befehlsschicht auf nichts mehr: gemessen auf der
+ /// Testbox am 11.09.2026 (T11, Punkt 2) als vier leere Chatantworten,
+ /// Models-Tab dauerhaft auf `Loading models`, das Fensterkreuz ohne
+ /// Wirkung, und nur `taskkill /F /T` half.
+ ///
+ /// Quelltextwächter mit Absicht: der Fix ist, welches Attribut Tauris
+ /// Makro sieht. Er ändert, wie der BEFEHL ausgeliefert wird, nicht was
+ /// die Rust-Funktion tut, also kann kein Aufruf im Prozess ihn
+ /// beobachten. Gleiches Vorbild: `fs_search_is_dispatched_off_the_main_thread`
+ /// in `commands/filesystem.rs`.
+ #[test]
+ fn set_onboarding_done_baut_das_fenster_nicht_auf_dem_hauptfaden() {
+ let at = SYSTEM_RS.find("pub fn set_onboarding_done(").expect("exists");
+ let head = &SYSTEM_RS[..at];
+ let preamble = &head[head.rfind("\n\n").map(|i| i + 2).unwrap_or(0)..];
+ assert!(
+ preamble.contains("#[tauri::command(async)]"),
+ "set_onboarding_done builds a window and must not run on the main thread:\n{preamble}",
+ );
+ assert!(
+ !preamble.contains("#[tauri::command]"),
+ "set_onboarding_done is back on the plain (main-thread) command attribute:\n{preamble}",
+ );
+ assert!(preamble.len() < 2_000, "the slice ran past the attribute block");
+ }
+
#[test]
fn das_onboarding_fenster_schliesst_sich_nur_per_destroy() {
// `close()` würde CloseRequested auslösen; der Handler darunter