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 review: don't fail closed on Windows for WhatsApp/Telegram/Signal detection

Ezra Ellette2cb4dd9a051d
diff --git a/crates/screenpipe-engine/src/meeting_watcher/audio_process/resolve.rs b/crates/screenpipe-engine/src/meeting_watcher/audio_process/resolve.rs
index 7ee4f6f33..e8c37cc3c 100644
--- a/crates/screenpipe-engine/src/meeting_watcher/audio_process/resolve.rs
+++ b/crates/screenpipe-engine/src/meeting_watcher/audio_process/resolve.rs
@@ -252,20 +252,29 @@ pub(crate) fn resolve_process_candidate(
// process bundle ID: voice notes use the `.helper` subprocess while
// real calls use `.helper.Renderer`. If the bundle doesn't contain
// "renderer", it's a voice note — block it.
- if platform == "Signal" {
- let bundle = process
- .bundle_id
- .as_deref()
- .or(process.owner_bundle_id.as_deref())
- .unwrap_or("");
- if !bundle.to_lowercase().contains("renderer") {
- debug!(
- "audio-process meeting detector: Signal blocked — voice note helper \
- (bundle={:?}, no .Renderer suffix)",
- bundle
- );
- return ResolvedMeetingCandidate::NonMeeting;
- }
+ //
+ // `bundle_id`/`owner_bundle_id` are macOS-only fields (always `None` on
+ // Windows — see `screenpipe_audio::meeting_processes::platform`), so
+ // the heuristic only fires when one of them is actually present.
+ // Applying it unconditionally used to fail closed on Windows: with
+ // both fields `None`, `unwrap_or("")` always produced a string that
+ // never contains "renderer", so it silently blocked EVERY Windows
+ // Signal session, including real calls (#4998 review). When the
+ // discriminating field is structurally absent, fail open instead —
+ // matching pre-gate behavior on platforms this heuristic can't reach.
+ let signal_bundle = process
+ .bundle_id
+ .as_deref()
+ .or(process.owner_bundle_id.as_deref());
+ if platform == "Signal"
+ && signal_bundle.is_some_and(|b| !b.to_lowercase().contains("renderer"))
+ {
+ debug!(
+ "audio-process meeting detector: Signal blocked — voice note helper \
+ (bundle={:?}, no .Renderer suffix)",
+ signal_bundle
+ );
+ return ResolvedMeetingCandidate::NonMeeting;
}
let profile = profile_index.and_then(|idx| profiles.get(idx));
if candidate_is_ignored(&platform, profile, process, ignored_terms, None, None, None) {
@@ -338,11 +347,22 @@ pub(crate) fn resolve_native_platform(
}
for (idx, profile) in profiles.iter().enumerate() {
- let matches = profile.app_identifiers.macos_app_names.iter().any(|name| {
- fields
- .iter()
- .any(|field| field.eq_ignore_ascii_case(name) || field == &name.to_lowercase())
- });
+ // Match against both macOS app names and Windows process names: identity
+ // fields are macOS bundle ids/app names on macOS and Windows exe names
+ // (e.g. "whatsapp.exe") on Windows, so a profile with only
+ // `macos_app_names` populated (WhatsApp, Telegram, ...) would otherwise
+ // never resolve on Windows once it's not also in
+ // `known_native_bundle_platform` (#4998 review).
+ let matches = profile
+ .app_identifiers
+ .macos_app_names
+ .iter()
+ .chain(profile.app_identifiers.windows_process_names.iter())
+ .any(|name| {
+ fields
+ .iter()
+ .any(|field| field.eq_ignore_ascii_case(name) || field == &name.to_lowercase())
+ });
if matches {
return Some((platform_name_for_profile(profile, false), Some(idx)));
}
diff --git a/crates/screenpipe-engine/src/meeting_watcher/audio_process/tests.rs b/crates/screenpipe-engine/src/meeting_watcher/audio_process/tests.rs
index 875e13747..ee9cf45db 100644
--- a/crates/screenpipe-engine/src/meeting_watcher/audio_process/tests.rs
+++ b/crates/screenpipe-engine/src/meeting_watcher/audio_process/tests.rs
@@ -1408,3 +1408,120 @@ fn zoom_not_filtered_by_call_signal_gate() {
"Zoom must not be affected by call signal gate"
);
}
+
+// ---------------------------------------------------------------------------
+// #4998 review: Windows identity shape for WhatsApp/Telegram, and the Signal
+// bundle-id gate must not fail closed on Windows (where bundle_id/
+// owner_bundle_id are structurally absent, not merely non-"renderer").
+// ---------------------------------------------------------------------------
+
+/// Windows-shaped WhatsApp process: no bundle_id/owner_bundle_id (those are
+/// macOS-only fields), identity carried entirely by the `.exe` process name.
+fn whatsapp_process_windows() -> AudioInputProcess {
+ AudioInputProcess {
+ audio_session_id: Some("wasapi:whatsapp.exe:99".to_string()),
+ audio_object_id: None,
+ pid: Some(99),
+ bundle_id: None,
+ process_name: Some("whatsapp.exe".to_string()),
+ owner_app_name: None,
+ owner_bundle_id: None,
+ first_seen_at_ms: None,
+ }
+}
+
+/// Windows-shaped Telegram process: same shape as above.
+fn telegram_process_windows() -> AudioInputProcess {
+ AudioInputProcess {
+ audio_session_id: Some("wasapi:telegram.exe:102".to_string()),
+ audio_object_id: None,
+ pid: Some(102),
+ bundle_id: None,
+ process_name: Some("telegram.exe".to_string()),
+ owner_app_name: None,
+ owner_bundle_id: None,
+ first_seen_at_ms: None,
+ }
+}
+
+/// Windows-shaped Signal process: same shape as above (a real call — Windows
+/// has no `.helper`/`.helper.Renderer` bundle-id distinction to gate on).
+fn signal_process_windows() -> AudioInputProcess {
+ AudioInputProcess {
+ audio_session_id: Some("wasapi:signal.exe:200".to_string()),
+ audio_object_id: None,
+ pid: Some(200),
+ bundle_id: None,
+ process_name: Some("signal.exe".to_string()),
+ owner_app_name: None,
+ owner_bundle_id: None,
+ first_seen_at_ms: None,
+ }
+}
+
+#[test]
+fn whatsapp_resolves_to_native_on_windows_identity_shape() {
+ // Windows never populates bundle_id/owner_bundle_id, so identity is
+ // carried only by `process_name` = "whatsapp.exe". Before the #4998
+ // review fix, the profile-matching fallback loop only checked
+ // `macos_app_names` ("whatsapp"), which never matches "whatsapp.exe",
+ // so WhatsApp (and real WhatsApp calls, not just voice notes) could never
+ // resolve as a Native candidate on Windows at all.
+ let profiles = load_detection_profiles();
+ let process = whatsapp_process_windows();
+ let result = resolve_native_platform(&process, &profiles);
+ assert!(
+ result.is_some(),
+ "WhatsApp should resolve as native from Windows process_name alone"
+ );
+ let (platform, profile_index) = result.unwrap();
+ assert_eq!(platform, "WhatsApp");
+ assert!(
+ profile_index.is_some(),
+ "WhatsApp must still get a profile index on Windows for call signal gating"
+ );
+}
+
+#[test]
+fn telegram_resolves_to_native_on_windows_identity_shape() {
+ let profiles = load_detection_profiles();
+ let process = telegram_process_windows();
+ let result = resolve_native_platform(&process, &profiles);
+ assert!(
+ result.is_some(),
+ "Telegram should resolve as native from Windows process_name alone"
+ );
+ let (platform, profile_index) = result.unwrap();
+ assert_eq!(platform, "Telegram");
+ assert!(
+ profile_index.is_some(),
+ "Telegram must still get a profile index on Windows for call signal gating"
+ );
+}
+
+#[test]
+fn signal_windows_call_not_blocked_by_macos_only_renderer_gate() {
+ // On Windows, bundle_id/owner_bundle_id are always None (structurally
+ // absent, not merely "not containing renderer"). Before the #4998 review
+ // fix, `unwrap_or("")` fed into `.contains("renderer")` always evaluated
+ // to false, so this gate silently blocked EVERY Signal session on
+ // Windows, including real calls. It must fail open there instead.
+ let profiles = load_detection_profiles();
+ let process = signal_process_windows();
+ let session_key = ProcessKey::from_process(&process).unwrap();
+ let result = resolve_process_candidate(
+ session_key,
+ Instant::now(),
+ &process,
+ &profiles,
+ &[],
+ &[],
+ &[],
+ );
+ assert!(
+ matches!(result, ResolvedMeetingCandidate::Native { ref platform, .. } if platform == "Signal"),
+ "Signal on Windows should resolve as Native (fail open, no bundle-id \
+ discriminator available on this platform): got {:?}",
+ result
+ );
+}