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

fix: disable prefetch, add 10s timeouts to VisionKit semaphores, bump app to v2.2.153

Louis Beaumont397f46133a2e
diff --git a/apps/screenpipe-app-tauri/components/rewind/hooks/use-live-text.ts b/apps/screenpipe-app-tauri/components/rewind/hooks/use-live-text.ts
index 5e84ff22c..c147275da 100644
--- a/apps/screenpipe-app-tauri/components/rewind/hooks/use-live-text.ts
+++ b/apps/screenpipe-app-tauri/components/rewind/hooks/use-live-text.ts
@@ -144,35 +144,10 @@ export function useLiveText(opts: {
return () => { cancelled = true; clearTimeout(timer); };
}, [nativeLiveTextActive, debouncedFrame?.frameId]);
- // Prefetch VisionKit analysis for adjacent frames so scrolling is instant.
- // Fire-and-forget: Swift caches results in an LRU for future hits.
- useEffect(() => {
- if (!nativeLiveTextActive || !adjacentFrames?.length) return;
-
- const paths: string[] = [];
- const seen = new Set<string>();
- if (debouncedFrame?.filePath) seen.add(debouncedFrame.filePath);
-
- for (const frame of adjacentFrames) {
- const dev = frame?.devices?.[0];
- if (!dev?.frame_id) continue;
- const filePath = dev.metadata?.file_path;
- const lower = filePath?.toLowerCase() ?? "";
- const isSnapshot = lower.endsWith(".jpg") || lower.endsWith(".jpeg") || lower.endsWith(".png");
-
- const imagePath = isSnapshot && filePath
- ? filePath
- : `http://localhost:3030/frames/${dev.frame_id}`;
-
- if (seen.has(imagePath)) continue;
- seen.add(imagePath);
- paths.push(imagePath);
- }
-
- if (paths.length > 0) {
- invoke("livetext_prefetch", { paths }).catch(() => {});
- }
- }, [nativeLiveTextActive, debouncedFrame?.frameId, adjacentFrames]);
+ // Prefetch disabled — each prefetch call blocks a GCD thread via
+ // DispatchSemaphore in Swift's analyzeImage(), causing thread exhaustion
+ // and app freeze when scrolling fast. The LRU cache still works for
+ // revisited frames; prefetch can be re-enabled once analyzeImage is async.
// Update overlay position on resize or when renderedImageInfo first becomes available
useEffect(() => {
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
index bca250c7d..11f2e4c08 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -9329,7 +9329,7 @@ dependencies = [
[[package]]
name = "screenpipe-app"
-version = "2.2.151"
+version = "2.2.152"
dependencies = [
"anyhow",
"arboard",
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
index a7da4c022..c06f5d09a 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.2.152"
+version = "2.2.153"
description = "24/7 memory for your desktop. 100% local."
authors = ["you"]
license = ""
diff --git a/apps/screenpipe-app-tauri/src-tauri/swift/livetext_bridge.swift b/apps/screenpipe-app-tauri/src-tauri/swift/livetext_bridge.swift
index 5071b8f67..e78707e2f 100644
--- a/apps/screenpipe-app-tauri/src-tauri/swift/livetext_bridge.swift
+++ b/apps/screenpipe-app-tauri/src-tauri/swift/livetext_bridge.swift
@@ -133,7 +133,8 @@ private class LiveTextManager {
fetchedData = data
sem.signal()
}.resume()
- sem.wait()
+ let waitResult = sem.wait(timeout: .now() + 10)
+ if waitResult == .timedOut { return }
if let data = fetchedData, !data.isEmpty {
result = NSImage(data: data)
}
@@ -146,6 +147,8 @@ private class LiveTextManager {
}
/// Run VisionKit analysis on an image. Returns the analysis or nil.
+ /// Uses a 10-second timeout to prevent indefinite thread blocking
+ /// when GCD thread pool is saturated.
func analyzeImage(_ image: NSImage) -> ImageAnalysis? {
let analyzer = ensureAnalyzer()
let semaphore = DispatchSemaphore(value: 0)
@@ -159,7 +162,8 @@ private class LiveTextManager {
} catch {}
semaphore.signal()
}
- semaphore.wait()
+ let result = semaphore.wait(timeout: .now() + 10)
+ if result == .timedOut { return nil }
return analysisResult
}
}