YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
destroy onboarding window on close (#5220)
Ezra Ellette1d7513a7f66d
diff --git a/apps/screenpipe-app-tauri/e2e/specs/onboarding-redirect.spec.ts b/apps/screenpipe-app-tauri/e2e/specs/onboarding-redirect.spec.tsindex 797fe47df..f31ba5a94 100644--- a/apps/screenpipe-app-tauri/e2e/specs/onboarding-redirect.spec.ts+++ b/apps/screenpipe-app-tauri/e2e/specs/onboarding-redirect.spec.ts@@ -28,6 +28,14 @@import { existsSync } from "node:fs";import { E2E_SEED_FLAGS } from "../helpers/app-launcher.js";import { saveScreenshot } from "../helpers/screenshot-utils.js";+import {+ closeWindow,+ invokeOrThrow,+ showWindow,+ waitForWindowClosed,+ waitForWindowHandle,+ waitForWindowUrl,+} from "../helpers/tauri.js";import { t, waitForAppReady } from "../helpers/test-utils.js";const seedFlags = E2E_SEED_FLAGS.split(",")@@ -91,5 +99,29 @@ const canRun = !seedFlags.includes("onboarding");const filepath = await saveScreenshot("onboarding-redirect");expect(existsSync(filepath)).toBe(true);});++ it("destroys a closed onboarding webview without completing onboarding", async () => {+ await showWindow({ Home: { page: "home" } });+ await waitForWindowHandle("home", t(10_000));+ await browser.switchToWindow("home");++ await closeWindow("Onboarding");+ await waitForWindowClosed("onboarding", t(10_000));++ const status = await invokeOrThrow<{+ isCompleted: boolean;+ currentStep: string | null;+ }>("get_onboarding_status");+ expect(status.isCompleted).toBe(false);+ expect(status.currentStep).toBeNull();++ await showWindow("Onboarding");+ await waitForWindowHandle("onboarding", t(10_000));+ await browser.switchToWindow("onboarding");+ await waitForWindowUrl("/onboarding", undefined, t(15_000));++ const filepath = await saveScreenshot("onboarding-recreated-after-close");+ expect(existsSync(filepath)).toBe(true);+ });},);diff --git a/apps/screenpipe-app-tauri/src-tauri/src/main.rs b/apps/screenpipe-app-tauri/src-tauri/src/main.rsindex bf355365d..8d8e4b9db 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/main.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/main.rs@@ -219,6 +219,10 @@ fn should_skip_onboarding() -> bool {.unwrap_or(false)}+fn should_prevent_window_close(label: &str) -> bool {+ label != "onboarding"+}+/// Flag passed by tauri-plugin-autostart when the OS launches us at login./// Used to skip Home so login starts stay in the tray.const AUTOSTART_ARG: &str = "--autostart";@@ -724,6 +728,15 @@ async fn main() {});}tauri::WindowEvent::CloseRequested { api, .. } => {+ // Onboarding is disposable. Let Tauri destroy its webview so+ // page effects (notably the live-feed search poller) are torn+ // down as soon as the user closes the window. Other app+ // windows stay warm for fast reopen and NSPanel safety.+ if !should_prevent_window_close(window.label()) {+ info!("onboarding window close requested — destroying webview");+ return;+ }+let _ = window.set_always_on_top(false);let _ = window.set_visible_on_all_workspaces(false);@@ -2118,6 +2131,23 @@ mod autostart_arg_tests {}}+#[cfg(test)]+mod window_close_policy_tests {+ use super::should_prevent_window_close;++ #[test]+ fn onboarding_close_destroys_its_webview() {+ assert!(!should_prevent_window_close("onboarding"));+ }++ #[test]+ fn persistent_windows_keep_their_existing_close_behavior() {+ for label in ["home", "main", "main-window", "search", "chat"] {+ assert!(should_prevent_window_close(label), "label: {label}");+ }+ }+}+#[cfg(all(test, target_os = "macos"))]mod mic_focus_recovery_tests {use super::MicFocusRecoveryTracker;