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
fix: serialize MLX GPU access to prevent Metal command buffer crashes
Louis Beaumontdc0511014c5c
diff --git a/README-ja.md b/README-ja.mdindex e48e1b34d..3715b52c7 100644--- a/README-ja.md+++ b/README-ja.md@@ -37,8 +37,8 @@<a href="https://discord.gg/screenpipe"><img src="https://img.shields.io/discord/823813159592001537?color=5865F2&logo=discord&logoColor=white&style=flat-square" alt="discord"></a>- <a href="https://twitter.com/screen_pipe">- <img alt="x" src="https://img.shields.io/twitter/url/https/twitter.com/diffuserslib.svg?style=social&label=フォロー%20%40screen_pipe">+ <a href="https://twitter.com/screenpipe">+ <img alt="x" src="https://img.shields.io/twitter/url/https/twitter.com/diffuserslib.svg?style=social&label=フォロー%20%40screenpipe"></a></p>@@ -81,5 +81,5 @@ screenpipeは画面と音声を24時間365日録画し、すべてをローカ<p align="center"><a href="https://docs.screenpi.pe">ドキュメント</a> ·<a href="https://discord.gg/screenpipe">discord</a> ·- <a href="https://twitter.com/screen_pipe">x</a>+ <a href="https://twitter.com/screenpipe">x</a></p>diff --git a/README-zh_CN.md b/README-zh_CN.mdindex 51e3c6763..fbe54fed8 100644--- a/README-zh_CN.md+++ b/README-zh_CN.md@@ -37,8 +37,8 @@<a href="https://discord.gg/screenpipe"><img src="https://img.shields.io/discord/823813159592001537?color=5865F2&logo=discord&logoColor=white&style=flat-square" alt="discord"></a>- <a href="https://twitter.com/screen_pipe">- <img alt="x" src="https://img.shields.io/twitter/url/https/twitter.com/diffuserslib.svg?style=social&label=关注%20%40screen_pipe">+ <a href="https://twitter.com/screenpipe">+ <img alt="x" src="https://img.shields.io/twitter/url/https/twitter.com/diffuserslib.svg?style=social&label=关注%20%40screenpipe"></a></p>@@ -81,5 +81,5 @@ screenpipe 全天候录制你的屏幕和音频,所有数据存储在本地,<p align="center"><a href="https://docs.screenpi.pe">文档</a> ·<a href="https://discord.gg/screenpipe">discord</a> ·- <a href="https://twitter.com/screen_pipe">x</a>+ <a href="https://twitter.com/screenpipe">x</a></p>diff --git a/README.md b/README.mdindex 7822dec4d..380c8898f 100644--- a/README.md+++ b/README.md@@ -22,10 +22,10 @@<a href="https://discord.gg/screenpipe"><img src="https://img.shields.io/discord/823813159592001537?style=for-the-badge&logo=discord&logoColor=white" alt="discord"></a>- <a href="https://twitter.com/screen_pipe">- <img src="https://img.shields.io/twitter/follow/screen_pipe?style=for-the-badge&logo=x&logoColor=white&label=follow" alt="twitter">+ <a href="https://twitter.com/screenpipe">+ <img src="https://img.shields.io/twitter/follow/screenpipe?style=for-the-badge&logo=x&logoColor=white&label=follow" alt="twitter"></a>- <a href="https://www.youtube.com/@screen_pipe">+ <a href="https://www.youtube.com/@screenpipe"><img src="https://img.shields.io/youtube/channel/subscribers/UCwjkpAsb70_mENKvy7hT5bw?style=for-the-badge&logo=youtube&logoColor=white&label=subscribers" alt="youtube"></a></p>@@ -93,8 +93,8 @@ then ask claude `what did i see in the last 5 mins?` or `summarize today convers<p align="center"><a href="https://docs.screenpi.pe">docs</a> ·<a href="https://discord.gg/screenpipe">discord</a> ·- <a href="https://twitter.com/screen_pipe">x</a> ·- <a href="https://www.youtube.com/@screen_pipe">youtube</a> ·+ <a href="https://twitter.com/screenpipe">x</a> ·+ <a href="https://www.youtube.com/@screenpipe">youtube</a> ·<a href="https://www.reddit.com/r/screen_pipe">reddit</a></p>@@ -303,7 +303,7 @@ Each pipe supports YAML frontmatter fields (allow-apps, deny-apps, deny-windows,Built by screenpipe (Mediar, Inc.). Founded 2024. Based in San Francisco, CA.- Founder: Louis Beaumont (@louis030195)-- Twitter: @screen_pipe+- Twitter: @screenpipe- Email: [email protected]</details>diff --git a/crates/screenpipe-audio/src/transcription/engine.rs b/crates/screenpipe-audio/src/transcription/engine.rsindex 29f7185cb..885688d75 100644--- a/crates/screenpipe-audio/src/transcription/engine.rs+++ b/crates/screenpipe-audio/src/transcription/engine.rs@@ -19,6 +19,19 @@ use std::sync::Mutex as StdMutex;use tracing::{error, info, warn};use whisper_rs::{WhisperContext, WhisperState};+/// Global GPU serialization lock for MLX Metal operations.+///+/// MLX uses asynchronous Metal command buffers that can overlap even when the+/// Rust model mutex is held. If a Metal command buffer fails (e.g. GPU memory+/// pressure, timeout), MLX calls abort() — killing the entire process. This+/// mutex ensures only ONE MLX transcription uses the GPU at any time,+/// preventing concurrent Metal submissions from different threads.+///+/// Uses std::sync::Mutex (not tokio) because transcription runs on blocking threads.+#[cfg(feature = "parakeet-mlx")]+static MLX_GPU_LOCK: std::sync::LazyLock<std::sync::Mutex<()>> =+ std::sync::LazyLock::new(|| std::sync::Mutex::new(()));+/// MLX Metal memory management — cap the GPU buffer cache to prevent unbounded growth./// MLX's caching allocator keeps freed GPU buffers for reuse; without a limit the/// cache grows to 10+ GB over hours of transcription on a 0.6B model.@@ -600,6 +613,17 @@ impl TranscriptionSession {#[cfg(feature = "parakeet-mlx")]Self::ParakeetMlx { model, .. } => {+ // Acquire the global GPU lock — only one MLX operation at a time.+ // This prevents concurrent Metal command buffer submissions that+ // cause abort() when the GPU can't handle overlapping workloads.+ let _gpu_guard = match MLX_GPU_LOCK.lock() {+ Ok(g) => Some(g),+ Err(poisoned) => {+ tracing::warn!("mlx gpu lock poisoned (previous panic), recovering");+ Some(poisoned.into_inner())+ }+ };+let mut engine = model.lock().map_err(|e| anyhow!("stt model lock: {}", e))?;// Clear GPU cache before transcription to reduce Metal command buffer// errors from GPU memory pressure (prevents abort in MLX completion handler)diff --git a/crates/screenpipe-engine/src/event_driven_capture.rs b/crates/screenpipe-engine/src/event_driven_capture.rsindex 3ce5a5c87..759c4f13e 100644--- a/crates/screenpipe-engine/src/event_driven_capture.rs+++ b/crates/screenpipe-engine/src/event_driven_capture.rs@@ -390,9 +390,7 @@ pub async fn event_driven_capture_loop(}// Skip capture while DRM streaming content is focused or outside schedule- if crate::drm_detector::drm_content_paused()- || crate::schedule_monitor::schedule_paused()- {+ if crate::drm_detector::drm_content_paused() || crate::schedule_monitor::schedule_paused() {tokio::time::sleep(poll_interval).await;continue;}diff --git a/crates/screenpipe-engine/src/vision_manager/monitor_watcher.rs b/crates/screenpipe-engine/src/vision_manager/monitor_watcher.rsindex 10044691c..cd96dac4b 100644--- a/crates/screenpipe-engine/src/vision_manager/monitor_watcher.rs+++ b/crates/screenpipe-engine/src/vision_manager/monitor_watcher.rs@@ -135,7 +135,10 @@ pub async fn start_monitor_watcher(if schedule_stopped {info!("within work-hours schedule — resuming capture");if let Err(e) = vision_manager.start().await {- warn!("failed to restart vision manager after schedule resume: {:?}", e);+ warn!(+ "failed to restart vision manager after schedule resume: {:?}",+ e+ );}if let Some(ref am) = audio_manager {if let Err(e) = am.start().await {diff --git a/docs/mintlify/docs-mintlify-mig-tmp/docs.json b/docs/mintlify/docs-mintlify-mig-tmp/docs.jsonindex d6cff9422..73a6772f5 100644--- a/docs/mintlify/docs-mintlify-mig-tmp/docs.json+++ b/docs/mintlify/docs-mintlify-mig-tmp/docs.json@@ -94,7 +94,7 @@"footer": {"socials": {"github": "https://github.com/screenpipe/screenpipe",- "x": "https://x.com/screen_pipe",+ "x": "https://x.com/screenpipe","discord": "https://discord.gg/screenpipe"}},@@ -104,7 +104,7 @@"metadata": {"og:site_name": "screenpipe docs","og:image": "https://screenpi.pe/og-image.png",- "twitter:site": "@screen_pipe"+ "twitter:site": "@screenpipe"},"integrations": {"posthog": {