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: prevent silent audio drops and surface transcription warnings

Louis Beaumont17c9a385c206
diff --git a/apps/screenpipe-app-tauri/components/screenpipe-status.tsx b/apps/screenpipe-app-tauri/components/screenpipe-status.tsx
index bece17db4..a877813e4 100644
--- a/apps/screenpipe-app-tauri/components/screenpipe-status.tsx
+++ b/apps/screenpipe-app-tauri/components/screenpipe-status.tsx
@@ -306,6 +306,20 @@ const HealthStatus = ({ className }: { className?: string }) => {
</div>
</div>
+ {/* Audio Drops Warning */}
+ {!settings.disableAudio &&
+ health?.audio_pipeline &&
+ health.audio_pipeline.chunks_channel_full > 0 && (
+ <div className="flex items-center gap-2 p-2 bg-yellow-500/10 border border-yellow-500/20 rounded-md">
+ <AlertTriangle className="h-4 w-4 text-yellow-500 flex-shrink-0" />
+ <span className="text-xs text-yellow-700 dark:text-yellow-400">
+ {health.audio_pipeline.chunks_channel_full} audio chunk(s)
+ dropped — transcription engine is too slow. try a smaller
+ whisper model or switch to cloud transcription.
+ </span>
+ </div>
+ )}
+
{/* Audio Devices Status */}
{!settings.disableAudio && health?.device_status_details && (
<div className="mt-1 mb-2 relative">
diff --git a/apps/screenpipe-app-tauri/lib/hooks/use-health-check.tsx b/apps/screenpipe-app-tauri/lib/hooks/use-health-check.tsx
index ab12db753..15f242f1b 100644
--- a/apps/screenpipe-app-tauri/lib/hooks/use-health-check.tsx
+++ b/apps/screenpipe-app-tauri/lib/hooks/use-health-check.tsx
@@ -1,6 +1,22 @@
import { useState, useEffect, useCallback, useRef } from "react";
import { debounce } from "lodash";
+interface AudioPipelineHealth {
+ chunks_sent: number;
+ chunks_channel_full: number;
+ stream_timeouts: number;
+ vad_passed: number;
+ vad_rejected: number;
+ transcriptions_completed: number;
+ transcription_errors: number;
+ db_inserted: number;
+ total_words: number;
+ words_per_minute: number;
+ transcription_paused?: boolean;
+ meeting_detected?: boolean;
+ meeting_app?: string;
+}
+
interface HealthCheckResponse {
status: string;
status_code: number;
@@ -13,6 +29,7 @@ interface HealthCheckResponse {
message: string;
verbose_instructions?: string | null;
device_status_details?: string | null;
+ audio_pipeline?: AudioPipelineHealth | null;
}
function isHealthChanged(
diff --git a/crates/screenpipe-audio/src/core/run_record_and_transcribe.rs b/crates/screenpipe-audio/src/core/run_record_and_transcribe.rs
index d047daf05..e8ffef741 100644
--- a/crates/screenpipe-audio/src/core/run_record_and_transcribe.rs
+++ b/crates/screenpipe-audio/src/core/run_record_and_transcribe.rs
@@ -103,13 +103,20 @@ pub async fn run_record_and_transcribe(
.duration_since(UNIX_EPOCH)
.expect("Time went backwards")
.as_secs();
- match whisper_sender.try_send(AudioInput {
- data: Arc::new(collected_audio.clone()),
- device: audio_stream.device.clone(),
- sample_rate: audio_stream.device_config.sample_rate().0,
- channels: audio_stream.device_config.channels(),
- capture_timestamp,
- }) {
+ // Use send_timeout instead of try_send to apply backpressure when the
+ // Whisper consumer falls behind. The 30s timeout matches the chunk
+ // accumulation duration — if the consumer can't clear one slot in 30s
+ // it is truly stuck and dropping is the only option.
+ match whisper_sender.send_timeout(
+ AudioInput {
+ data: Arc::new(collected_audio.clone()),
+ device: audio_stream.device.clone(),
+ sample_rate: audio_stream.device_config.sample_rate().0,
+ channels: audio_stream.device_config.channels(),
+ capture_timestamp,
+ },
+ Duration::from_secs(30),
+ ) {
Ok(_) => {
debug!("sent audio segment to audio model");
metrics.record_chunk_sent();
@@ -122,10 +129,12 @@ pub async fn run_record_and_transcribe(
if e.is_disconnected() {
error!("whisper channel disconnected, restarting recording process");
return Err(anyhow!("Whisper channel disconnected"));
- } else if e.is_full() {
+ } else if e.is_timeout() {
metrics.record_channel_full();
- warn!("whisper channel full, dropping audio segment");
- tokio::time::sleep(Duration::from_millis(100)).await;
+ warn!(
+ "whisper channel still full after 30s, dropping audio segment for {}",
+ device_name
+ );
}
}
}
diff --git a/crates/screenpipe-server/src/routes/health.rs b/crates/screenpipe-server/src/routes/health.rs
index c66e3bca5..6840a125c 100644
--- a/crates/screenpipe-server/src/routes/health.rs
+++ b/crates/screenpipe-server/src/routes/health.rs
@@ -236,10 +236,27 @@ pub async fn health_check(State(state): State<Arc<AppState>>) -> JsonResponse<He
false
};
+ // Audio degradation: chunks_channel_full > 0 means the Whisper consumer
+ // couldn't keep up and audio was dropped even after a 30s backpressure wait.
+ let audio_degraded = if !state.audio_disabled && audio_snap.uptime_secs > 120.0 {
+ if audio_snap.chunks_channel_full > 0 {
+ warn!(
+ "health_check: {} audio chunk(s) dropped (transcription engine too slow)",
+ audio_snap.chunks_channel_full
+ );
+ true
+ } else {
+ false
+ }
+ } else {
+ false
+ };
+
let (overall_status, message, verbose_instructions, status_code) = if (frame_status == "ok"
|| frame_status == "disabled")
&& (audio_status == "ok" || audio_status == "disabled")
&& !vision_degraded
+ && !audio_degraded
{
(
"healthy",
@@ -258,6 +275,9 @@ pub async fn health_check(State(state): State<Arc<AppState>>) -> JsonResponse<He
if audio_status != "ok" && audio_status != "disabled" {
unhealthy_systems.push("audio");
}
+ if audio_degraded && !unhealthy_systems.contains(&"audio") {
+ unhealthy_systems.push("audio");
+ }
let mut detail_parts = Vec::new();
if vision_degraded {
@@ -274,6 +294,12 @@ pub async fn health_check(State(state): State<Arc<AppState>>) -> JsonResponse<He
));
}
}
+ if audio_degraded {
+ detail_parts.push(format!(
+ "{} audio chunk(s) dropped — transcription too slow",
+ audio_snap.chunks_channel_full
+ ));
+ }
let systems_str = unhealthy_systems.join(", ");
let msg = if detail_parts.is_empty() {
@@ -451,7 +477,7 @@ pub(crate) fn get_verbose_instructions(unhealthy_systems: &[&str]) -> String {
}
if unhealthy_systems.contains(&"audio") {
- instructions.push_str("Audio system is not working properly. Check if microphone permissions are enabled and devices are connected.\n");
+ instructions.push_str("Audio system is not working properly. Check if microphone permissions are enabled and devices are connected. If audio chunks are being dropped, try switching to a smaller Whisper model or using cloud transcription.\n");
}
if instructions.is_empty() {