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(meetings): mic switch in the meeting app no longer ends/restarts the meeting
Ezra Ellette020233cb8fd8
diff --git a/TESTING.md b/TESTING.mdindex 34f5e50db..b794d19eb 100644--- a/TESTING.md+++ b/TESTING.md@@ -114,6 +114,7 @@ commits: `28e5c247`- [ ] **piggyback fallback: no pid (manual/ui_scan/reattach)** — a meeting without a detected pid behaves exactly like flag-off (stable path).- [ ] **piggyback on unsupported OS** — flag on, macOS <14.4 / Windows <20348: one-time log "using the stable capture path", capture identical to flag-off. Windows must fail the PID-specific tap and let the normal configured/default output capture path run; the Meeting Tap stream itself must not silently downgrade to endpoint-wide loopback.- [ ] **mid-call mic switch in the app** — change Zoom's mic mid-call: capture follows within ~4s (old session mic stops, new one starts); changing the OS default while Zoom is pinned elsewhere does NOT switch capture.+- [ ] **mic switch must not flap the meeting** — switch the meeting app's mic (AirPods → phone → built-in, several times): `meeting_status_changed` stays active=true throughout — NO end/re-start pair ~20s after each switch, no Meeting Tap teardown/rebuild, no System Audio resume/suspend churn. (Root cause was device-derived session keys: macOS synthesized the audio-session id from the device set and WASAPI GUIDs are per-endpoint, so a mic switch re-keyed the session and the meeting rode the 20s ending grace into EndMeeting + instant restart.)- [ ] **mic-silent alert discipline** — muting in the meeting app for 5+ min produces NO notification (app not recording ⇒ real silence); a genuinely broken resolved-mic capture (zeros while the app records) first restarts silently, then notifies "screenpipe may not be hearing your mic" after ~4 min total, ≤1 per 30 min.- [ ] **per-pid tap silence watchdog (macOS)** — during a piggybacked call, tap silent 45s+ while the app renders audio → one rebuild (60s→960s backoff), never a rebuild while the app is genuinely idle.- [ ] **Windows per-process tap supervisor** — Windows 20348+: verify target-exit detection (app quits -> Meeting Tap stops and stable capture resumes), default-endpoint loopback re-anchor for explicit global loopback, and per-pid silence watchdog (target rendering + no tap packets for 45s -> rebuild with 60s->960s backoff). Confirm tap startup failure falls back through the user's normal/default audio settings, not through an implicit low-level endpoint-loopback downgrade inside the Meeting Tap.diff --git a/crates/screenpipe-audio/src/meeting_processes.rs b/crates/screenpipe-audio/src/meeting_processes.rsindex 907821056..fe21575f5 100644--- a/crates/screenpipe-audio/src/meeting_processes.rs+++ b/crates/screenpipe-audio/src/meeting_processes.rs@@ -111,7 +111,17 @@ mod platform {}let audio_object_id = Some(process.0 .0);- let audio_session_id = audio_session_id(&process);+ // Deliberately NO synthesized audio_session_id on macOS: CoreAudio+ // has no real session identity, and the previous synthesis+ // (`coreaudio-process:{object}:input:{device uids}`) embedded the+ // device set the process records from — so switching the mic+ // inside the meeting app rotated the id, the meeting watcher's+ // ProcessKey changed, and every mic switch ended the live meeting+ // after the 20s grace and restarted it as a "new" one (tearing+ // down capture each time). With `None`, ProcessKey falls back to+ // the pid — the only identity that is stable across device+ // switches. Windows keeps real WASAPI session GUIDs.+ let audio_session_id = None;let pid = process.pid().ok().map(|pid| pid as i32);let bundle_id = process.bundle_id().ok().map(|s| s.to_string());let (owner_app_name, owner_bundle_id) = owner_metadata(pid);@@ -148,40 +158,6 @@ mod platform {Ok(out)}- fn audio_session_id(process: &ca::Process) -> Option<String> {- let object_id = process.0 .0;- if object_id == 0 {- return None;- }-- let mut input_devices: Vec<String> = process- .prop_vec::<ca::Device>(&ca::PropSelector::PROCESS_DEVICES.input_addr())- .unwrap_or_default()- .into_iter()- .filter(|device| !device.is_unknown())- .map(|device| {- device- .uid()- .ok()- .map(|uid| uid.to_string())- .filter(|uid| !uid.trim().is_empty())- .unwrap_or_else(|| device.0 .0.to_string())- })- .collect();- input_devices.sort();- input_devices.dedup();-- if input_devices.is_empty() {- Some(format!("coreaudio-process:{}", object_id))- } else {- Some(format!(- "coreaudio-process:{}:input:{}",- object_id,- input_devices.join(",")- ))- }- }-fn owner_metadata(pid: Option<i32>) -> (Option<String>, Option<String>) {let Some(pid) = pid else {return (None, None);diff --git a/crates/screenpipe-engine/src/meeting_watcher/audio_process/suppress.rs b/crates/screenpipe-engine/src/meeting_watcher/audio_process/suppress.rsindex b7597a240..4720e92c1 100644--- a/crates/screenpipe-engine/src/meeting_watcher/audio_process/suppress.rs+++ b/crates/screenpipe-engine/src/meeting_watcher/audio_process/suppress.rs@@ -30,11 +30,23 @@ pub(crate) fn session_present(// Non-reattached sessions must match on the real process key (the// `is_reattached()` branch above is the only place a synthetic key matches).candidates.iter().any(|candidate| match candidate {+ // A native meeting's session key is NOT stable across the app+ // switching input devices: macOS synthesized it from the device set+ // the process records from (fixed to pid-keying now, but stale keys+ // can persist in live state), and Windows WASAPI sessions are+ // per-endpoint, so picking a different mic mints a new GUID. Ending a+ // live call over that rotation — Active → Ending → 20s grace →+ // EndMeeting, then an instant "new" meeting under the new key — tears+ // capture down for ~20s per mic switch. The same native platform+ // holding ANY mic is proof the call is ongoing, so keep-alive matches+ // on platform alone; keys still gate meeting START. (One audio-holding+ // process per native platform is the operating assumption, and+ // back-to-back calls in the same app were already glued by the+ // ending grace.)ResolvedMeetingCandidate::Native {platform: candidate_platform,- session_key: key,..- } => meeting_url.is_none() && key == session_key && candidate_platform == platform,+ } => meeting_url.is_none() && candidate_platform == platform,// A confirmed browser meeting is keyed by its audio session. Once it is// live, the same browser audio session still holding the mic is sufficient// proof the call is ongoing — so keep it alive on the `session_key` alone.diff --git a/crates/screenpipe-engine/src/meeting_watcher/audio_process/tests.rs b/crates/screenpipe-engine/src/meeting_watcher/audio_process/tests.rsindex ee9cf45db..cb2f6357c 100644--- a/crates/screenpipe-engine/src/meeting_watcher/audio_process/tests.rs+++ b/crates/screenpipe-engine/src/meeting_watcher/audio_process/tests.rs@@ -1525,3 +1525,100 @@ fn signal_windows_call_not_blocked_by_macos_only_renderer_gate() {result);}++#[test]+fn native_meeting_survives_mic_switch_rekey() {+ // Switching the mic inside the meeting app rotates its session key: macOS+ // synthesizes the id from the device set the process records from, and+ // Windows WASAPI sessions are per-endpoint, so a new device means a new+ // GUID. The active meeting must NOT slide into Ending (and 20s later+ // EndMeeting) just because the key rotated — the same native platform+ // holding ANY mic is proof the call is ongoing.+ let now = Instant::now();+ let mut airpods = zoom_process();+ airpods.audio_session_id = Some("coreaudio-process:200:input:airpods-uid".to_string());+ let old_key = ProcessKey::from_process(&airpods).unwrap();++ let mut samsung = zoom_process();+ samsung.audio_session_id = Some("coreaudio-process:200:input:samsung-uid".to_string());+ let new_key = ProcessKey::from_process(&samsung).unwrap();+ assert_ne!(old_key, new_key, "fixture must model a re-keyed session");++ let candidates = [ResolvedMeetingCandidate::Native {+ platform: "Zoom".to_string(),+ session_key: new_key,+ first_seen_at: now,+ process: samsung,+ }];++ let (next, action) = advance_audio_process_state(+ AudioProcessMeetingState::Active {+ meeting_id: 67,+ platform: "Zoom".to_string(),+ session_key: old_key,+ meeting_url: None,+ first_seen_at: now - Duration::from_secs(120),+ last_seen_at: now - Duration::from_secs(1),+ is_browser: false,+ },+ &[],+ &candidates,+ now,+ Duration::from_secs(1),+ Duration::from_secs(20),+ );+ assert!(action.is_none(), "expected no action, got {action:?}");+ assert!(+ matches!(+ next,+ AudioProcessMeetingState::Active { meeting_id: 67, .. }+ ),+ "meeting must stay active across a mic-switch re-key, got {next:?}"+ );+}++#[test]+fn ending_native_meeting_revives_on_rekeyed_session() {+ // Same re-key mid-grace: a meeting already in Ending (e.g. the switch+ // briefly showed no session at all) must revive when the platform's+ // session reappears under a new key, not wait out the grace and end.+ let now = Instant::now();+ let mut airpods = zoom_process();+ airpods.audio_session_id = Some("coreaudio-process:200:input:airpods-uid".to_string());+ let old_key = ProcessKey::from_process(&airpods).unwrap();++ let mut samsung = zoom_process();+ samsung.audio_session_id = Some("coreaudio-process:200:input:samsung-uid".to_string());++ let candidates = [ResolvedMeetingCandidate::Native {+ platform: "Zoom".to_string(),+ session_key: ProcessKey::from_process(&samsung).unwrap(),+ first_seen_at: now,+ process: samsung,+ }];++ let (next, action) = advance_audio_process_state(+ AudioProcessMeetingState::Ending {+ meeting_id: 67,+ platform: "Zoom".to_string(),+ session_key: old_key,+ meeting_url: None,+ first_seen_at: now - Duration::from_secs(120),+ since: now - Duration::from_secs(10),+ is_browser: false,+ },+ &[],+ &candidates,+ now,+ Duration::from_secs(1),+ Duration::from_secs(20),+ );+ assert!(action.is_none(), "expected no action, got {action:?}");+ assert!(+ matches!(+ next,+ AudioProcessMeetingState::Active { meeting_id: 67, .. }+ ),+ "ending meeting must revive on a re-keyed session, got {next:?}"+ );+}