Skip to content

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

Bump app to v2.4.163 — fix(macos): catch panics in ObjC->Rust trampolines so they don't abort the app — release-app

Louis Beaumonta6849e3fc605
diff --git a/Cargo.lock b/Cargo.lock
index 1dd8c0689..5b89ba5fc 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1244,7 +1244,7 @@ dependencies = [
[[package]]
name = "cidre"
version = "0.15.0"
-source = "git+https://github.com/yury/cidre.git#3bd68fa9d9809f43bc5e2b7172d358f41c50bd19"
+source = "git+https://github.com/yury/cidre.git#3d095ba94486ffc4745ce0d4fcf4e92033ffff98"
dependencies = [
"cc",
"cidre-macros 0.5.0",
@@ -1399,7 +1399,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c"
dependencies = [
"lazy_static",
- "windows-sys 0.59.0",
+ "windows-sys 0.48.0",
]
[[package]]
@@ -6109,7 +6109,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d"
dependencies = [
"anyhow",
- "itertools 0.14.0",
+ "itertools 0.10.5",
"proc-macro2",
"quote",
"syn 2.0.117",
@@ -7040,7 +7040,7 @@ dependencies = [
[[package]]
name = "sck-rs"
version = "0.1.0"
-source = "git+https://github.com/screenpipe/sck-rs#cc39b0fee819f470b881d37658c940e7172c6431"
+source = "git+https://github.com/screenpipe/sck-rs#50a49ccafae68f81a468a5726684da365c1cfa43"
dependencies = [
"cidre 0.15.0",
"image",
@@ -7107,7 +7107,7 @@ dependencies = [
[[package]]
name = "screenpipe-audio"
-version = "0.3.320"
+version = "0.3.321"
dependencies = [
"anyhow",
"audiopipe",
@@ -7168,7 +7168,7 @@ dependencies = [
[[package]]
name = "screenpipe-audio-eval"
-version = "0.3.320"
+version = "0.3.321"
dependencies = [
"anyhow",
"clap",
@@ -7183,7 +7183,7 @@ dependencies = [
[[package]]
name = "screenpipe-config"
-version = "0.3.320"
+version = "0.3.321"
dependencies = [
"dirs 6.0.0",
"serde",
@@ -7196,7 +7196,7 @@ dependencies = [
[[package]]
name = "screenpipe-connect"
-version = "0.3.320"
+version = "0.3.321"
dependencies = [
"anyhow",
"async-trait",
@@ -7229,7 +7229,7 @@ dependencies = [
[[package]]
name = "screenpipe-core"
-version = "0.3.320"
+version = "0.3.321"
dependencies = [
"accessibility",
"accessibility-sys",
@@ -7277,7 +7277,7 @@ dependencies = [
[[package]]
name = "screenpipe-db"
-version = "0.3.320"
+version = "0.3.321"
dependencies = [
"anyhow",
"chrono",
@@ -7303,7 +7303,7 @@ dependencies = [
[[package]]
name = "screenpipe-engine"
-version = "0.3.320"
+version = "0.3.321"
dependencies = [
"anyhow",
"arc-swap",
@@ -7378,7 +7378,7 @@ dependencies = [
[[package]]
name = "screenpipe-events"
-version = "0.3.320"
+version = "0.3.321"
dependencies = [
"anyhow",
"chrono",
@@ -7396,7 +7396,7 @@ dependencies = [
[[package]]
name = "screenpipe-redact"
-version = "0.3.320"
+version = "0.3.321"
dependencies = [
"anyhow",
"async-trait",
@@ -7422,7 +7422,7 @@ dependencies = [
[[package]]
name = "screenpipe-screen"
-version = "0.3.320"
+version = "0.3.321"
dependencies = [
"accessibility-sys",
"anyhow",
@@ -7480,7 +7480,7 @@ dependencies = [
[[package]]
name = "screenpipe-vault"
-version = "0.3.320"
+version = "0.3.321"
dependencies = [
"argon2",
"chacha20poly1305",
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
index f0e76344c..7cdb9fda1 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -9976,7 +9976,7 @@ dependencies = [
[[package]]
name = "screenpipe-app"
-version = "2.4.161"
+version = "2.4.162"
dependencies = [
"anyhow",
"arboard",
@@ -10088,7 +10088,7 @@ dependencies = [
[[package]]
name = "screenpipe-audio"
-version = "0.3.320"
+version = "0.3.321"
dependencies = [
"anyhow",
"audiopipe",
@@ -10144,7 +10144,7 @@ dependencies = [
[[package]]
name = "screenpipe-config"
-version = "0.3.320"
+version = "0.3.321"
dependencies = [
"dirs 6.0.0",
"serde",
@@ -10156,7 +10156,7 @@ dependencies = [
[[package]]
name = "screenpipe-connect"
-version = "0.3.320"
+version = "0.3.321"
dependencies = [
"anyhow",
"async-trait",
@@ -10189,7 +10189,7 @@ dependencies = [
[[package]]
name = "screenpipe-core"
-version = "0.3.320"
+version = "0.3.321"
dependencies = [
"accessibility",
"accessibility-sys",
@@ -10237,7 +10237,7 @@ dependencies = [
[[package]]
name = "screenpipe-db"
-version = "0.3.320"
+version = "0.3.321"
dependencies = [
"anyhow",
"chrono",
@@ -10262,7 +10262,7 @@ dependencies = [
[[package]]
name = "screenpipe-engine"
-version = "0.3.320"
+version = "0.3.321"
dependencies = [
"anyhow",
"arc-swap",
@@ -10330,7 +10330,7 @@ dependencies = [
[[package]]
name = "screenpipe-events"
-version = "0.3.320"
+version = "0.3.321"
dependencies = [
"anyhow",
"chrono",
@@ -10346,7 +10346,7 @@ dependencies = [
[[package]]
name = "screenpipe-redact"
-version = "0.3.320"
+version = "0.3.321"
dependencies = [
"anyhow",
"async-trait",
@@ -10371,7 +10371,7 @@ dependencies = [
[[package]]
name = "screenpipe-screen"
-version = "0.3.320"
+version = "0.3.321"
dependencies = [
"accessibility-sys",
"anyhow",
@@ -10424,7 +10424,7 @@ dependencies = [
[[package]]
name = "screenpipe-vault"
-version = "0.3.320"
+version = "0.3.321"
dependencies = [
"argon2",
"chacha20poly1305",
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
index c1dcdd0ca..3becd409d 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "2.4.162"
+version = "2.4.163"
description = "24/7 memory for your desktop. 100% local."
authors = ["you"]
license = ""
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/commands.rs b/apps/screenpipe-app-tauri/src-tauri/src/commands.rs
index c2c797221..65f102184 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/commands.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/commands.rs
@@ -47,8 +47,20 @@ static GLOBAL_APP_HANDLE: std::sync::OnceLock<tauri::AppHandle> = std::sync::Onc
/// Callback invoked from Swift when user clicks a notification action.
/// Handles "manage" directly in Rust (opens home window to notifications settings).
/// Other actions are forwarded as Tauri events to JS.
+///
+/// A Rust panic crossing this Cocoa→Rust trampoline aborts the whole app via
+/// `panic_cannot_unwind` (extern "C" can't unwind through ObjC frames). Catch
+/// any panic and log it instead — losing one notification click is much better
+/// than killing the user's session.
#[cfg(target_os = "macos")]
extern "C" fn native_notif_action_callback(json_ptr: *const std::os::raw::c_char) {
+ let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
+ native_notif_action_callback_inner(json_ptr);
+ }));
+}
+
+#[cfg(target_os = "macos")]
+fn native_notif_action_callback_inner(json_ptr: *const std::os::raw::c_char) {
if json_ptr.is_null() {
return;
}
@@ -146,8 +158,18 @@ extern "C" fn native_notif_action_callback(json_ptr: *const std::os::raw::c_char
}
/// Callback invoked from Swift when user clicks a shortcut reminder action.
+///
+/// Same panic_cannot_unwind hazard as native_notif_action_callback — wrap the
+/// body in catch_unwind so a runtime hiccup doesn't abort the app.
#[cfg(target_os = "macos")]
extern "C" fn native_shortcut_action_callback(action_ptr: *const std::os::raw::c_char) {
+ let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
+ native_shortcut_action_callback_inner(action_ptr);
+ }));
+}
+
+#[cfg(target_os = "macos")]
+fn native_shortcut_action_callback_inner(action_ptr: *const std::os::raw::c_char) {
if action_ptr.is_null() {
return;
}
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/dock_menu.rs b/apps/screenpipe-app-tauri/src-tauri/src/dock_menu.rs
index 7c2af9623..9795325a0 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/dock_menu.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/dock_menu.rs
@@ -26,36 +26,44 @@ pub fn setup_dock_menu(app_handle: AppHandle) {
let _ = DOCK_APP_HANDLE.set(app_handle);
unsafe {
- // Callback functions for dock menu items
+ // Callback functions for dock menu items.
+ // All run inside the ObjC→Rust trampoline (nounwind) — wrap in
+ // catch_unwind so a panic logs instead of aborting the app.
extern "C" fn show_screenpipe(_this: &Object, _sel: Sel, _sender: id) {
- if let Some(app) = DOCK_APP_HANDLE.get() {
- let app_for_closure = app.clone();
- let _ = app.run_on_main_thread(move || {
- show_main_window(&app_for_closure, false);
- });
- }
+ let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
+ if let Some(app) = DOCK_APP_HANDLE.get() {
+ let app_for_closure = app.clone();
+ let _ = app.run_on_main_thread(move || {
+ show_main_window(&app_for_closure, false);
+ });
+ }
+ }));
}
extern "C" fn open_settings(_this: &Object, _sel: Sel, _sender: id) {
- if let Some(app) = DOCK_APP_HANDLE.get() {
- let app_for_closure = app.clone();
- let _ = app.run_on_main_thread(move || {
- let _ = ShowRewindWindow::Home {
- page: Some("general".to_string()),
- }
- .show(&app_for_closure);
- });
- }
+ let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
+ if let Some(app) = DOCK_APP_HANDLE.get() {
+ let app_for_closure = app.clone();
+ let _ = app.run_on_main_thread(move || {
+ let _ = ShowRewindWindow::Home {
+ page: Some("general".to_string()),
+ }
+ .show(&app_for_closure);
+ });
+ }
+ }));
}
extern "C" fn check_updates(_this: &Object, _sel: Sel, _sender: id) {
- if let Some(app) = DOCK_APP_HANDLE.get() {
- let app = app.clone();
- tauri::async_runtime::spawn(async move {
- let state = app.state::<std::sync::Arc<crate::updates::UpdatesManager>>();
- if let Err(e) = state.check_for_updates(true).await {
- tracing::error!("dock menu: check for updates failed: {}", e);
- }
- });
- }
+ let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
+ if let Some(app) = DOCK_APP_HANDLE.get() {
+ let app = app.clone();
+ tauri::async_runtime::spawn(async move {
+ let state = app.state::<std::sync::Arc<crate::updates::UpdatesManager>>();
+ if let Err(e) = state.check_for_updates(true).await {
+ tracing::error!("dock menu: check for updates failed: {}", e);
+ }
+ });
+ }
+ }));
}
extern "C" fn dock_menu(_this: &Object, _sel: Sel, _sender: id) -> id {
unsafe {
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/window/content_process.rs b/apps/screenpipe-app-tauri/src-tauri/src/window/content_process.rs
index 7517ed388..aec60636a 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/window/content_process.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/window/content_process.rs
@@ -66,10 +66,16 @@ pub fn setup_content_process_handler(window: &tauri::WebviewWindow) {
}
extern "C" fn on_content_process_terminate(_this: &Object, _cmd: Sel, webview: id) {
- tracing::warn!("[WKWebView] content process terminated; reloading webview");
- unsafe {
- let _: () = msg_send![webview, reload];
- }
+ // Cocoa→Rust trampolines abort the process on panic via
+ // `panic_cannot_unwind`. Catch any panic so a runtime issue
+ // here (tracing subscriber, dangling webview ptr, etc.) can't
+ // kill the app.
+ let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
+ tracing::warn!("[WKWebView] content process terminated; reloading webview");
+ unsafe {
+ let _: () = msg_send![webview, reload];
+ }
+ }));
}
let selector = sel!(webViewWebContentProcessDidTerminate:);
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/window/gesture.rs b/apps/screenpipe-app-tauri/src-tauri/src/window/gesture.rs
index 367db2e51..86c36fbfc 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/window/gesture.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/window/gesture.rs
@@ -39,16 +39,21 @@ pub fn init_magnify_handler(app: tauri::AppHandle) {
let superclass = Class::get("NSObject").unwrap();
let mut decl = ClassDecl::new("ScreenpipeMagnifyHandler", superclass).unwrap();
extern "C" fn handle_magnify(_this: &Object, _sel: Sel, recognizer: *mut Object) {
- with_autorelease_pool(|| unsafe {
- use objc::{msg_send, sel, sel_impl};
- use tauri::Emitter;
- let magnification: f64 = msg_send![recognizer, magnification];
- // Reset so next callback gives delta, not cumulative
- let _: () = msg_send![recognizer, setMagnification: 0.0f64];
- if let Some(app) = MAGNIFY_APP_HANDLE.get() {
- let _ = app.emit("native-magnify", magnification);
- }
- });
+ // ObjC→Rust trampoline: a panic here aborts the app via
+ // panic_cannot_unwind. Catch it so a hiccup in `app.emit` /
+ // serde / channel poisoning can't kill the process mid-gesture.
+ let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
+ with_autorelease_pool(|| unsafe {
+ use objc::{msg_send, sel, sel_impl};
+ use tauri::Emitter;
+ let magnification: f64 = msg_send![recognizer, magnification];
+ // Reset so next callback gives delta, not cumulative
+ let _: () = msg_send![recognizer, setMagnification: 0.0f64];
+ if let Some(app) = MAGNIFY_APP_HANDLE.get() {
+ let _ = app.emit("native-magnify", magnification);
+ }
+ });
+ }));
}
unsafe {
use objc::{sel, sel_impl};
@@ -74,35 +79,40 @@ pub fn init_magnify_handler(app: tauri::AppHandle) {
> = std::sync::OnceLock::new();
extern "C" fn swizzled_scroll_wheel(this: &Object, sel: Sel, event: *mut Object) {
- with_autorelease_pool(|| unsafe {
- use objc::{msg_send, sel, sel_impl};
- use tauri::Emitter;
- // Emit Tauri event with scroll data
- if let Some(app) = MAGNIFY_APP_HANDLE.get() {
- let delta_y: f64 = msg_send![event, scrollingDeltaY];
- let delta_x: f64 = msg_send![event, scrollingDeltaX];
- let modifier_flags: u64 = msg_send![event, modifierFlags];
- let ctrl_key = (modifier_flags & (1 << 18)) != 0;
- let meta_key = (modifier_flags & (1 << 20)) != 0;
-
- let _ = app.emit(
- "native-scroll",
- serde_json::json!({
- "deltaX": delta_x,
- "deltaY": delta_y,
- "ctrlKey": ctrl_key,
- "metaKey": meta_key,
- }),
- );
- }
- // Always call the original scrollWheel: so native CSS
- // overflow scrolling keeps working in all windows.
- // The native-scroll Tauri event is emitted above for
- // timeline/search components that need it.
- if let Some(original) = ORIGINAL_SCROLL_WHEEL.get() {
- original(this, sel, event);
- }
- });
+ // This fires on EVERY WKWebView scroll event — a panic in
+ // `app.emit` / serde would abort the app via panic_cannot_unwind.
+ // Catch the panic but always still forward to the original
+ // scrollWheel: implementation so native scrolling never breaks.
+ let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
+ with_autorelease_pool(|| unsafe {
+ use objc::{msg_send, sel, sel_impl};
+ use tauri::Emitter;
+ // Emit Tauri event with scroll data
+ if let Some(app) = MAGNIFY_APP_HANDLE.get() {
+ let delta_y: f64 = msg_send![event, scrollingDeltaY];
+ let delta_x: f64 = msg_send![event, scrollingDeltaX];
+ let modifier_flags: u64 = msg_send![event, modifierFlags];
+ let ctrl_key = (modifier_flags & (1 << 18)) != 0;
+ let meta_key = (modifier_flags & (1 << 20)) != 0;
+
+ let _ = app.emit(
+ "native-scroll",
+ serde_json::json!({
+ "deltaX": delta_x,
+ "deltaY": delta_y,
+ "ctrlKey": ctrl_key,
+ "metaKey": meta_key,
+ }),
+ );
+ }
+ });
+ }));
+ // Always forward to the original scrollWheel: — outside the
+ // catch_unwind so it runs even if our event-emit code panicked.
+ // Native CSS overflow scrolling must keep working in all windows.
+ if let Some(original) = ORIGINAL_SCROLL_WHEEL.get() {
+ original(this, sel, event);
+ }
}
// Swizzle WKWebView scrollWheel: