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.165, Bump CLI to v0.3.322 — fix(macos,clipboard): dispatch NSPasteboard reads to the main thread (cidre) — release-app release-cli

Louis Beaumontc3598dc23dd1
diff --git a/Cargo.lock b/Cargo.lock
index 0046c6061..ffbfeb7ef 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -7107,7 +7107,7 @@ dependencies = [
[[package]]
name = "screenpipe-audio"
-version = "0.3.321"
+version = "0.3.322"
dependencies = [
"anyhow",
"audiopipe",
@@ -7168,7 +7168,7 @@ dependencies = [
[[package]]
name = "screenpipe-audio-eval"
-version = "0.3.321"
+version = "0.3.322"
dependencies = [
"anyhow",
"clap",
@@ -7183,7 +7183,7 @@ dependencies = [
[[package]]
name = "screenpipe-config"
-version = "0.3.321"
+version = "0.3.322"
dependencies = [
"dirs 6.0.0",
"serde",
@@ -7196,7 +7196,7 @@ dependencies = [
[[package]]
name = "screenpipe-connect"
-version = "0.3.321"
+version = "0.3.322"
dependencies = [
"anyhow",
"async-trait",
@@ -7229,7 +7229,7 @@ dependencies = [
[[package]]
name = "screenpipe-core"
-version = "0.3.321"
+version = "0.3.322"
dependencies = [
"accessibility",
"accessibility-sys",
@@ -7277,7 +7277,7 @@ dependencies = [
[[package]]
name = "screenpipe-db"
-version = "0.3.321"
+version = "0.3.322"
dependencies = [
"anyhow",
"chrono",
@@ -7303,7 +7303,7 @@ dependencies = [
[[package]]
name = "screenpipe-engine"
-version = "0.3.321"
+version = "0.3.322"
dependencies = [
"anyhow",
"arc-swap",
@@ -7378,7 +7378,7 @@ dependencies = [
[[package]]
name = "screenpipe-events"
-version = "0.3.321"
+version = "0.3.322"
dependencies = [
"anyhow",
"chrono",
@@ -7396,7 +7396,7 @@ dependencies = [
[[package]]
name = "screenpipe-redact"
-version = "0.3.321"
+version = "0.3.322"
dependencies = [
"anyhow",
"async-trait",
@@ -7422,7 +7422,7 @@ dependencies = [
[[package]]
name = "screenpipe-screen"
-version = "0.3.321"
+version = "0.3.322"
dependencies = [
"accessibility-sys",
"anyhow",
@@ -7480,7 +7480,7 @@ dependencies = [
[[package]]
name = "screenpipe-vault"
-version = "0.3.321"
+version = "0.3.322"
dependencies = [
"argon2",
"chacha20poly1305",
diff --git a/Cargo.toml b/Cargo.toml
index a33750c22..9b9045416 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,7 +6,7 @@ exclude = ["apps/screenpipe-app-tauri/src-tauri", "crates/screenpipe-integration
resolver = "2"
[workspace.package]
-version = "0.3.321"
+version = "0.3.322"
authors = ["louis030195 <[email protected]>"]
description = ""
repository = "https://github.com/screenpipe/screenpipe"
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
index f0cb43053..982f6a6f2 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.164"
+version = "2.4.165"
dependencies = [
"anyhow",
"arboard",
@@ -10088,7 +10088,7 @@ dependencies = [
[[package]]
name = "screenpipe-audio"
-version = "0.3.321"
+version = "0.3.322"
dependencies = [
"anyhow",
"audiopipe",
@@ -10144,7 +10144,7 @@ dependencies = [
[[package]]
name = "screenpipe-config"
-version = "0.3.321"
+version = "0.3.322"
dependencies = [
"dirs 6.0.0",
"serde",
@@ -10156,7 +10156,7 @@ dependencies = [
[[package]]
name = "screenpipe-connect"
-version = "0.3.321"
+version = "0.3.322"
dependencies = [
"anyhow",
"async-trait",
@@ -10189,7 +10189,7 @@ dependencies = [
[[package]]
name = "screenpipe-core"
-version = "0.3.321"
+version = "0.3.322"
dependencies = [
"accessibility",
"accessibility-sys",
@@ -10237,7 +10237,7 @@ dependencies = [
[[package]]
name = "screenpipe-db"
-version = "0.3.321"
+version = "0.3.322"
dependencies = [
"anyhow",
"chrono",
@@ -10262,7 +10262,7 @@ dependencies = [
[[package]]
name = "screenpipe-engine"
-version = "0.3.321"
+version = "0.3.322"
dependencies = [
"anyhow",
"arc-swap",
@@ -10330,7 +10330,7 @@ dependencies = [
[[package]]
name = "screenpipe-events"
-version = "0.3.321"
+version = "0.3.322"
dependencies = [
"anyhow",
"chrono",
@@ -10346,7 +10346,7 @@ dependencies = [
[[package]]
name = "screenpipe-redact"
-version = "0.3.321"
+version = "0.3.322"
dependencies = [
"anyhow",
"async-trait",
@@ -10371,7 +10371,7 @@ dependencies = [
[[package]]
name = "screenpipe-screen"
-version = "0.3.321"
+version = "0.3.322"
dependencies = [
"accessibility-sys",
"anyhow",
@@ -10424,7 +10424,7 @@ dependencies = [
[[package]]
name = "screenpipe-vault"
-version = "0.3.321"
+version = "0.3.322"
dependencies = [
"argon2",
"chacha20poly1305",
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
index 3e309a4cf..011c97868 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.164"
+version = "2.4.165"
description = "24/7 memory for your desktop. 100% local."
authors = ["you"]
license = ""
diff --git a/crates/screenpipe-a11y/src/platform/macos.rs b/crates/screenpipe-a11y/src/platform/macos.rs
index ebeebac5c..494413a41 100644
--- a/crates/screenpipe-a11y/src/platform/macos.rs
+++ b/crates/screenpipe-a11y/src/platform/macos.rs
@@ -1147,32 +1147,30 @@ fn get_focused_element_context(config: &UiCaptureConfig) -> Option<ElementContex
})
}
-// Dedicated serial queue for all NSPasteboard access. NSPasteboard / NSPasteboardItem
-// are not thread-safe — calling `[NSPasteboard stringForType:]` from a worker thread
-// races AppKit's internal type-cache invalidation when another app mutates the
-// pasteboard mid-read, segfaulting in `_updateTypeCacheIfNeeded` (seen on macOS 26.x,
-// crash reports 57E6EDAB-D2D1-44D3-9BD0-82DCA482DBFF and 56416840-0903-4FAB-8869-5D471B78335C).
-// The queue serializes every pasteboard read through one thread; the `_with_ar_pool`
-// variant wraps each block in an autorelease pool so AppKit's per-call temp objects
-// drain immediately.
+// All NSPasteboard access dispatches to the main thread. NSPasteboard /
+// NSPasteboardItem have undocumented main-thread-only semantics — calling
+// `[NSPasteboard stringForType:]` from any other thread races AppKit's
+// internal type-cache invalidation when another app mutates the pasteboard
+// mid-read, segfaulting in `_updateTypeCacheIfNeeded` (seen on macOS 26.x;
+// crash keys 57E6EDAB-D2D1-44D3-9BD0-82DCA482DBFF, 56416840-0903-4FAB-8869-5D471B78335C,
+// 5D2F76EF-BA4A-46EB-85F3-5126EE0C9B51). Confirmed by the arboard maintainer
+// in 1Password/arboard#218 — even a private serial queue with autorelease
+// pool isn't enough; the only safe place is the main thread, where AppKit's
+// pasteboard observers are already serialized.
//
-// We use a private serial queue rather than the main queue so heavy main-thread
-// activity (UI hitches, modal dialogs) can't stall clipboard capture.
+// We hop onto the main queue via `dispatch_sync`. The clipboard worker is a
+// dedicated `std::thread` (not a tokio worker), so blocking it for the
+// duration of a sync hop is fine. Main-thread cost is microseconds per read
+// (one `string(forType:)` call); it doesn't compete meaningfully with the
+// tao event loop.
//
-// Even with the serial queue + AR pool, the AppKit cache race can still SIGSEGV when
-// another app (system clipboard manager, paste app, etc.) calls
-// `setData:forType:` at the same instant we're reading. SIGSEGV can't be caught
-// in-process, so we use a dead-man-switch instead: write a marker file before each
-// read, delete after. On startup, if the marker exists, we know the previous run
-// crashed mid-read and disable clipboard capture for this session. The user can
+// The dead-man-switch below is kept as defense-in-depth: even with main-
+// thread dispatch, a future macOS regression or a bug in AppKit/arboard
+// could still SIGSEGV the read. SIGSEGV can't be caught in-process, so we
+// write a marker file before each read and delete it after. On startup, if
+// the marker exists, we know the previous run crashed mid-read and we
+// disable clipboard capture permanently for this install. The user can
// re-enable by deleting `~/.screenpipe/clipboard-disabled-after-crash`.
-static CLIPBOARD_QUEUE: std::sync::OnceLock<cidre::arc::R<cidre::dispatch::Queue>> =
- std::sync::OnceLock::new();
-
-fn clipboard_queue() -> &'static cidre::dispatch::Queue {
- CLIPBOARD_QUEUE.get_or_init(cidre::dispatch::Queue::serial_with_ar_pool)
-}
-
const CLIPBOARD_INFLIGHT_FILE: &str = "clipboard-read-inflight";
const CLIPBOARD_DISABLED_FILE: &str = "clipboard-disabled-after-crash";
@@ -1221,7 +1219,10 @@ fn get_clipboard() -> Option<String> {
// case is we don't detect a crash next startup.
let _ = std::fs::write(&inflight, std::process::id().to_string());
- let result = clipboard_queue().sync_once(|| {
+ // dispatch_sync onto the main queue — the only thread where NSPasteboard
+ // is documented to behave. AppKit serializes pasteboard observers on
+ // main, so this side-steps the cache-invalidation race entirely.
+ let result = cidre::dispatch::Queue::main().sync_once(|| {
let mut clipboard = arboard::Clipboard::new().ok()?;
let text = clipboard.get_text().ok()?;
if text.is_empty() {