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

Prepare app v2.4.235 live meeting reliability

Louis Beaumont38296cf62e54
diff --git a/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx b/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx
index f38fb6a98..af7fa4504 100644
--- a/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx
+++ b/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx
@@ -174,9 +174,9 @@ export type Settings = SettingsStore & {
enableWorkflowEvents?: boolean;
/** Audio transcription scheduling: "realtime" (default) or "batch" (longer chunks for quality) */
transcriptionMode?: "realtime" | "smart" | "batch";
- /** Meeting-only live notes. Separate from background 24/7 transcription. */
+ /** Live notes for manually-started meetings. Separate from background 24/7 transcription. */
meetingLiveTranscriptionEnabled?: boolean;
- /** Provider for meeting-only live notes. Defaults to the selected transcription engine. */
+ /** Provider for manually-started live notes. Defaults to the selected transcription engine. */
meetingLiveTranscriptionProvider?: "selected-engine" | "screenpipe-cloud" | "disabled" | "openai-realtime" | "deepgram-live";
/** User's name for speaker identification — input device audio will be labeled with this name */
userName?: string;
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
index 84a223ab0..c161db8c0 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -10580,7 +10580,7 @@ dependencies = [
[[package]]
name = "screenpipe-app"
-version = "2.4.234"
+version = "2.4.235"
dependencies = [
"aes",
"anyhow",
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
index 3f506f1ee..cfb94e7b6 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.234"
+version = "2.4.235"
description = "24/7 memory for your desktop. 100% local."
authors = ["you"]
license = ""
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/meeting_live_notes.rs b/apps/screenpipe-app-tauri/src-tauri/src/meeting_live_notes.rs
index 78fc12366..00d2caf90 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/meeting_live_notes.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/meeting_live_notes.rs
@@ -172,7 +172,7 @@ pub fn start(app: AppHandle) {
continue;
}
- let url = format!("screenpipe://meeting/{meeting_id}?live=1");
+ let url = format!("screenpipe://meeting/{meeting_id}?live=0");
let mut calendar_match = {
let events = calendar_events.read().await;
find_calendar_match(&events, &event.data)
@@ -220,7 +220,7 @@ pub fn start(app: AppHandle) {
actions.push(json!({
"id": "open-live-notes",
"action": "open-live-notes",
- "label": "open live notes",
+ "label": "open note",
"type": "deeplink",
"url": url.clone(),
"primary": true,
@@ -235,7 +235,7 @@ pub fn start(app: AppHandle) {
client::send_typed_with_actions(
"meeting detected",
- format!("screenpipe is capturing notes for {title}"),
+ format!("screenpipe is saving this meeting for transcription: {title}"),
"meeting",
Some(30_000),
actions,
diff --git a/crates/screenpipe-audio/src/meeting_streaming/controller.rs b/crates/screenpipe-audio/src/meeting_streaming/controller.rs
index 469e3efc6..a70934267 100644
--- a/crates/screenpipe-audio/src/meeting_streaming/controller.rs
+++ b/crates/screenpipe-audio/src/meeting_streaming/controller.rs
@@ -19,8 +19,8 @@ use crate::{core::engine::AudioTranscriptionEngine, transcription::engine::Trans
use super::{
deepgram_live,
events::{
- MeetingAudioFrame, MeetingAudioTap, MeetingLifecycleEvent, MeetingStreamingError,
- MeetingStreamingSessionEnded, MeetingStreamingSessionStarted,
+ is_manual_live_marker, MeetingAudioFrame, MeetingAudioTap, MeetingLifecycleEvent,
+ MeetingStreamingError, MeetingStreamingSessionEnded, MeetingStreamingSessionStarted,
MeetingStreamingStatusChanged, MeetingTranscriptDelta, MeetingTranscriptFinal,
},
openai_realtime, selected_engine, MeetingStreamingConfig, MeetingStreamingProvider,
@@ -93,20 +93,32 @@ pub fn start_meeting_streaming_loop(
match db.get_most_recent_active_meeting().await {
Ok(Some(meeting)) => {
- info!(
- "meeting streaming: reattaching active meeting on coordinator start (meeting_id={})",
- meeting.id
- );
- start_streaming_session(
- &config,
- &audio_tap,
- &transcription_engine,
- &mut active,
- meeting.id,
- Some(meeting.meeting_app),
- meeting.title,
- )
- .await;
+ if should_reattach_manual_live_session(
+ &meeting.meeting_app,
+ &meeting.detection_source,
+ ) {
+ info!(
+ "meeting streaming: reattaching active meeting on coordinator start (meeting_id={})",
+ meeting.id
+ );
+ start_streaming_session(
+ &config,
+ &audio_tap,
+ &transcription_engine,
+ &mut active,
+ meeting.id,
+ Some(meeting.meeting_app),
+ meeting.title,
+ )
+ .await;
+ } else {
+ debug!(
+ "meeting streaming: active meeting {} is background-only (source={}); not reattaching live stream",
+ meeting.id, meeting.detection_source
+ );
+ audio_tap.set_active(false);
+ audio_tap.set_background_suppressed(false);
+ }
}
Ok(None) => {}
Err(err) => {
@@ -130,6 +142,18 @@ pub fn start_meeting_streaming_loop(
continue;
}
+ if !event.data.is_manual_live_start() {
+ debug!(
+ "meeting streaming: meeting {} is background-only (source={:?}, app={:?}); not starting live stream",
+ meeting_id,
+ event.data.detection_source,
+ event.data.app
+ );
+ audio_tap.set_active(false);
+ audio_tap.set_background_suppressed(false);
+ continue;
+ }
+
start_streaming_session(
&config,
&audio_tap,
@@ -260,6 +284,10 @@ pub fn start_meeting_streaming_loop(
})
}
+fn should_reattach_manual_live_session(meeting_app: &str, detection_source: &str) -> bool {
+ is_manual_live_marker(Some(detection_source)) || is_manual_live_marker(Some(meeting_app))
+}
+
async fn start_streaming_session(
config: &MeetingStreamingConfig,
audio_tap: &MeetingAudioTap,
@@ -736,6 +764,36 @@ mod tests {
MeetingAudioTap::new(tx, Arc::new(std::sync::atomic::AtomicBool::new(false)))
}
+ #[test]
+ fn auto_detected_meeting_event_is_background_only() {
+ let event = MeetingLifecycleEvent {
+ meeting_id: Some(7),
+ app: Some("zoom.us".to_string()),
+ detection_source: Some("ui_scan".to_string()),
+ ..Default::default()
+ };
+
+ assert!(!event.is_manual_live_start());
+ }
+
+ #[test]
+ fn manual_meeting_event_starts_live_mode() {
+ let event = MeetingLifecycleEvent {
+ meeting_id: Some(7),
+ app: Some("manual".to_string()),
+ detection_source: Some("manual".to_string()),
+ ..Default::default()
+ };
+
+ assert!(event.is_manual_live_start());
+ }
+
+ #[test]
+ fn active_auto_meeting_does_not_reattach_live_stream() {
+ assert!(!should_reattach_manual_live_session("zoom.us", "ui_scan"));
+ assert!(should_reattach_manual_live_session("manual", "manual"));
+ }
+
#[tokio::test]
async fn live_ready_session_keeps_background_recording_until_transcript_arrives() {
let audio_tap = test_audio_tap();
diff --git a/crates/screenpipe-audio/src/meeting_streaming/events.rs b/crates/screenpipe-audio/src/meeting_streaming/events.rs
index aa09b0653..aebec94fe 100644
--- a/crates/screenpipe-audio/src/meeting_streaming/events.rs
+++ b/crates/screenpipe-audio/src/meeting_streaming/events.rs
@@ -108,6 +108,8 @@ pub struct MeetingLifecycleEvent {
#[serde(default)]
pub calendar_title: Option<String>,
#[serde(default)]
+ pub detection_source: Option<String>,
+ #[serde(default)]
pub timestamp: Option<DateTime<Utc>>,
}
@@ -126,6 +128,15 @@ impl MeetingLifecycleEvent {
.filter(|s| !s.trim().is_empty())
})
}
+
+ pub fn is_manual_live_start(&self) -> bool {
+ is_manual_live_marker(self.detection_source.as_deref())
+ || is_manual_live_marker(self.app.as_deref())
+ }
+}
+
+pub(crate) fn is_manual_live_marker(value: Option<&str>) -> bool {
+ value.is_some_and(|value| value.trim().eq_ignore_ascii_case("manual"))
}
#[derive(Clone, Debug, Serialize)]
diff --git a/crates/screenpipe-config/src/recording.rs b/crates/screenpipe-config/src/recording.rs
index 9d8c56c3d..7a0f007ec 100644
--- a/crates/screenpipe-config/src/recording.rs
+++ b/crates/screenpipe-config/src/recording.rs
@@ -62,13 +62,13 @@ pub struct RecordingSettings {
#[serde(rename = "transcriptionMode")]
pub transcription_mode: String,
- /// Stream live notes only while a meeting is active. This is separate
- /// from 24/7 background transcription: the recorder still writes durable
- /// chunks, while this powers the low-latency meeting note UI.
+ /// Stream live notes only for manually-started live meetings. This is
+ /// separate from 24/7 background transcription: the recorder still writes
+ /// durable chunks, while this powers the low-latency meeting note UI.
#[serde(rename = "meetingLiveTranscriptionEnabled")]
pub meeting_live_transcription_enabled: bool,
- /// Provider for meeting-only live notes. Defaults to the selected audio
+ /// Provider for manually-started live notes. Defaults to the selected audio
/// transcription engine so local/custom engines work without Cloud.
#[serde(rename = "meetingLiveTranscriptionProvider")]
pub meeting_live_transcription_provider: String,
diff --git a/crates/screenpipe-engine/src/meeting_detector.rs b/crates/screenpipe-engine/src/meeting_detector.rs
index 18890b15b..6a7ea8f4f 100644
--- a/crates/screenpipe-engine/src/meeting_detector.rs
+++ b/crates/screenpipe-engine/src/meeting_detector.rs
@@ -2908,7 +2908,12 @@ async fn insert_new_meeting(
// Emit event so triggered pipes can react
if let Err(e) = screenpipe_events::send_event(
"meeting_started",
- serde_json::json!({ "meeting_id": id, "app": app, "title": title }),
+ serde_json::json!({
+ "meeting_id": id,
+ "app": app,
+ "title": title,
+ "detection_source": "ui_scan",
+ }),
) {
warn!("meeting v2: failed to emit meeting_started event: {}", e);
}
diff --git a/packages/ai-gateway/src/handlers/realtime-transcription.ts b/packages/ai-gateway/src/handlers/realtime-transcription.ts
index 43f9f0828..bca083de3 100644
--- a/packages/ai-gateway/src/handlers/realtime-transcription.ts
+++ b/packages/ai-gateway/src/handlers/realtime-transcription.ts
@@ -10,6 +10,8 @@ const DEEPGRAM_LIVE_URL = 'https://api.deepgram.com/v1/listen';
const DEFAULT_DEEPGRAM_MODEL = 'nova-3';
const DEFAULT_DEEPGRAM_LIVE_COST_PER_HOUR = 0.26;
const LEGACY_OPENAI_SAMPLE_RATE = '24000';
+const DEEPGRAM_LIVE_UPGRADE_ATTEMPTS = 3;
+const DEEPGRAM_LIVE_UPGRADE_RETRY_DELAYS_MS = [150, 500];
const FORWARDED_QUERY_PARAMS = new Set([
'channels',
@@ -55,18 +57,18 @@ export async function handleRealtimeTranscriptionUpgrade(
}
const model = upstreamUrl.searchParams.get('model') || DEFAULT_DEEPGRAM_MODEL;
- const upstreamResponse = await fetch(upstreamUrl.toString(), {
- headers: {
- Upgrade: 'websocket',
- Authorization: `Token ${env.DEEPGRAM_API_KEY}`,
- 'User-Agent': 'screenpipe-ai-gateway-deepgram-live',
- },
- });
-
- if (upstreamResponse.status !== 101 || !upstreamResponse.webSocket) {
- const body = await upstreamResponse.text().catch(() => '');
- console.error('Deepgram live upgrade failed', upstreamResponse.status, body.slice(0, 500));
- return createErrorResponse(502, `Realtime transcription upstream failed (${upstreamResponse.status})`);
+ const upstreamResult = await connectDeepgramLiveWithRetry(upstreamUrl, env);
+ const upstreamResponse = upstreamResult.response;
+ if (!upstreamResponse || upstreamResponse.status !== 101 || !upstreamResponse.webSocket) {
+ console.error(
+ 'Deepgram live upgrade failed',
+ upstreamResult.status ?? 'network_error',
+ upstreamResult.body.slice(0, 500),
+ );
+ return createErrorResponse(
+ 503,
+ `Realtime transcription upstream unavailable (${upstreamResult.status ?? 'network_error'})`,
+ );
}
const pair = new WebSocketPair();
@@ -133,6 +135,57 @@ export async function handleRealtimeTranscriptionUpgrade(
});
}
+type DeepgramLiveUpgradeResult = {
+ response?: Response;
+ status?: number;
+ body: string;
+};
+
+async function connectDeepgramLiveWithRetry(
+ upstreamUrl: URL,
+ env: Env,
+): Promise<DeepgramLiveUpgradeResult> {
+ let last: DeepgramLiveUpgradeResult = { body: '' };
+
+ for (let attempt = 1; attempt <= DEEPGRAM_LIVE_UPGRADE_ATTEMPTS; attempt++) {
+ try {
+ const response = await fetch(upstreamUrl.toString(), {
+ headers: {
+ Upgrade: 'websocket',
+ Authorization: `Token ${env.DEEPGRAM_API_KEY}`,
+ 'User-Agent': 'screenpipe-ai-gateway-deepgram-live',
+ },
+ });
+
+ if (response.status === 101 && response.webSocket) {
+ return { response, status: response.status, body: '' };
+ }
+
+ const body = await response.text().catch(() => '');
+ last = { response, status: response.status, body };
+ if (!isRetryableDeepgramLiveUpgradeStatus(response.status)) {
+ return last;
+ }
+ } catch (error: any) {
+ last = { body: error?.message || 'unknown error' };
+ }
+
+ if (attempt < DEEPGRAM_LIVE_UPGRADE_ATTEMPTS) {
+ await sleep(DEEPGRAM_LIVE_UPGRADE_RETRY_DELAYS_MS[attempt - 1] ?? 500);
+ }
+ }
+
+ return last;
+}
+
+function isRetryableDeepgramLiveUpgradeStatus(status: number): boolean {
+ return [429, 500, 502, 503, 504, 520, 522, 524].includes(status);
+}
+
+function sleep(ms: number): Promise<void> {
+ return new Promise((resolve) => setTimeout(resolve, ms));
+}
+
type ClientProtocol = 'deepgram-live' | 'legacy-openai-realtime';
function detectClientProtocol(request: Request): ClientProtocol {
diff --git a/packages/ai-gateway/src/services/transcription-ab.ts b/packages/ai-gateway/src/services/transcription-ab.ts
index dff68fca7..4c66cfac2 100644
--- a/packages/ai-gateway/src/services/transcription-ab.ts
+++ b/packages/ai-gateway/src/services/transcription-ab.ts
@@ -251,6 +251,14 @@ function callProvider(provider: TranscriptionProvider, req: TranscriptionRequest
}
}
+function availableFallbackProviders(primary: TranscriptionProvider, env: Env): TranscriptionProvider[] {
+ const providers: TranscriptionProvider[] = [];
+ if (primary !== 'whisper' && getWhisperUrl(env)) providers.push('whisper');
+ if (primary !== 'parakeet' && getParakeetUrl(env)) providers.push('parakeet');
+ if (primary !== 'deepgram') providers.push('deepgram');
+ return providers;
+}
+
// ─── Orchestrator ───────────────────────────────────────────────────────────
/**
@@ -261,19 +269,25 @@ export async function runTranscriptionABTest(
req: TranscriptionRequest,
env: Env,
deviceId: string | null,
-): Promise<{ result: TranscriptionResult; status: 'success' | 'fallback'; logEntry: ABTestLog; extraLogs: ABTestLog[] }> {
+): Promise<{ result: TranscriptionResult; status: 'success' | 'fallback' | 'error'; logEntry: ABTestLog; extraLogs: ABTestLog[] }> {
const { primary, dualSend } = pickProvider(env);
const estimatedDuration = req.audioBuffer.byteLength / 8000;
// Call primary
let primaryResult = await callProvider(primary, req, env);
- let status: 'success' | 'fallback' = 'success';
-
- // Fallback to Deepgram if self-hosted failed
- if (!primaryResult.ok && primary !== 'deepgram') {
- console.warn(`${primary} failed (${primaryResult.error}), falling back to deepgram`);
- primaryResult = await callDeepgram(req, env);
- status = primaryResult.ok ? 'fallback' : 'error' as any;
+ let status: 'success' | 'fallback' | 'error' = primaryResult.ok ? 'success' : 'error';
+
+ if (!primaryResult.ok) {
+ for (const fallback of availableFallbackProviders(primary, env)) {
+ console.warn(`${primaryResult.provider} failed (${primaryResult.error}), falling back to ${fallback}`);
+ const fallbackResult = await callProvider(fallback, req, env);
+ if (fallbackResult.ok) {
+ primaryResult = fallbackResult;
+ status = 'fallback';
+ break;
+ }
+ primaryResult = fallbackResult;
+ }
}
// Primary log entry
diff --git a/packages/ai-gateway/src/test/transcription-ab.unit.test.ts b/packages/ai-gateway/src/test/transcription-ab.unit.test.ts
index 8e486287b..0e31e910f 100644
--- a/packages/ai-gateway/src/test/transcription-ab.unit.test.ts
+++ b/packages/ai-gateway/src/test/transcription-ab.unit.test.ts
@@ -19,6 +19,7 @@ import {
getDualSendPct,
getSelfHostedUrl,
extractTranscript,
+ runTranscriptionABTest,
} from '../services/transcription-ab';
// ─── Config parsing ─────────────────────────────────────────────────────────
@@ -207,3 +208,52 @@ describe('callDeepgram', () => {
}
});
});
+
+describe('runTranscriptionABTest', () => {
+ it('falls back to configured self-hosted transcription when Deepgram fails', async () => {
+ const originalFetch = globalThis.fetch;
+ const urls: string[] = [];
+
+ globalThis.fetch = (async (input: RequestInfo | URL) => {
+ const url = String(input);
+ urls.push(url);
+ if (url.startsWith('https://api.deepgram.com/')) {
+ return new Response('upstream timeout', { status: 500 });
+ }
+ return new Response(
+ JSON.stringify({
+ results: {
+ channels: [{
+ alternatives: [{ transcript: 'fallback worked', confidence: 0.9 }],
+ }],
+ },
+ }),
+ { status: 200, headers: { 'Content-Type': 'application/json' } },
+ );
+ }) as typeof fetch;
+
+ try {
+ const { result, status } = await runTranscriptionABTest(
+ {
+ audioBuffer: new Uint8Array([1, 2, 3]).buffer,
+ contentType: 'audio/wav',
+ sampleRate: '16000',
+ languages: [],
+ },
+ {
+ DEEPGRAM_API_KEY: 'dg-test-key',
+ SELF_HOSTED_TRANSCRIPTION_URL: 'https://whisper.example',
+ } as any,
+ 'device-1',
+ );
+
+ expect(status).toBe('fallback');
+ expect(result.provider).toBe('whisper');
+ expect(result.ok).toBe(true);
+ expect(urls.some((url) => url.startsWith('https://api.deepgram.com/'))).toBe(true);
+ expect(urls.some((url) => url.startsWith('https://whisper.example/v1/listen'))).toBe(true);
+ } finally {
+ globalThis.fetch = originalFetch;
+ }
+ });
+});