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

[pr] webex: don't start phantom meetings when used for messaging (#4337)

Vitalik1ee07a2e4830
diff --git a/crates/screenpipe-engine/src/meeting_detector.rs b/crates/screenpipe-engine/src/meeting_detector.rs
index fafb0a4c8..bf52d2b94 100644
--- a/crates/screenpipe-engine/src/meeting_detector.rs
+++ b/crates/screenpipe-engine/src/meeting_detector.rs
@@ -106,6 +106,19 @@ pub struct MeetingDetectionProfile {
pub call_signals: Vec<CallSignal>,
/// Minimum number of distinct signals required (typically 1 for leave/hangup).
pub min_signals_required: usize,
+ /// Top-level window titles whose call signals must be IGNORED, even when they
+ /// match `call_signals`. Matched as exact, case-insensitive, trimmed equality
+ /// against each window's title.
+ ///
+ /// This is a per-window guard (not per-process): signals found in a window
+ /// whose title equals one of these are dropped, but signals in any *other*
+ /// window of the same process still count. It exists for apps that are used
+ /// for both messaging and meetings under one process — most notably Webex,
+ /// whose messaging window is titled exactly `Webex` while a real meeting
+ /// window carries the meeting/space name. Without this guard Webex's
+ /// messaging chrome (e.g. "Leave space"/"Leave team") trips the bare `leave`
+ /// signal and starts a phantom meeting. See issue #4145.
+ pub ignore_window_titles: &'static [&'static str],
}
/// Load all built-in detection profiles.
@@ -146,6 +159,7 @@ pub fn load_detection_profiles() -> Vec<MeetingDetectionProfile> {
},
],
min_signals_required: 1,
+ ignore_window_titles: &[],
},
// Zoom Desktop
// Note: Zoom on macOS does NOT expose AXWindow — only AXMenuBar.
@@ -218,6 +232,7 @@ pub fn load_detection_profiles() -> Vec<MeetingDetectionProfile> {
CallSignal::KeyboardShortcut("Alt+Q"),
],
min_signals_required: 1,
+ ignore_window_titles: &[],
},
// Google Meet (browser)
// NOTE: "google meet" removed from url_patterns — it's too broad and matches
@@ -246,6 +261,7 @@ pub fn load_detection_profiles() -> Vec<MeetingDetectionProfile> {
CallSignal::NameContains("leave call"),
],
min_signals_required: 1,
+ ignore_window_titles: &[],
},
// Slack Huddle (browser + desktop)
MeetingDetectionProfile {
@@ -266,6 +282,7 @@ pub fn load_detection_profiles() -> Vec<MeetingDetectionProfile> {
},
],
min_signals_required: 1,
+ ignore_window_titles: &[],
},
// FaceTime
MeetingDetectionProfile {
@@ -286,6 +303,7 @@ pub fn load_detection_profiles() -> Vec<MeetingDetectionProfile> {
},
],
min_signals_required: 1,
+ ignore_window_titles: &[],
},
// Webex
MeetingDetectionProfile {
@@ -296,7 +314,21 @@ pub fn load_detection_profiles() -> Vec<MeetingDetectionProfile> {
browser_title_patterns: &[],
},
call_signals: vec![
- CallSignal::AutomationIdContains("leave"),
+ // Webex runs messaging and meetings in one process. Its in-call
+ // controls carry locale-independent `callControl_*` automation ids
+ // (live-verified: the "End meeting" button is `callControl_end`).
+ // The messaging chrome's "Leave the space"/"Leave the team"
+ // affordance is an AXMenuItem with id `appMenuLeaveSpace` /
+ // `appMenuLeaveTeam` — which the previous `AutomationIdContains
+ // ("leave")` matched ("appMenu**Leave**Space" contains "leave"),
+ // firing a phantom meeting whenever Webex sat open for chat
+ // (#4145/#4337). Match the call-control id prefix instead, so only
+ // real in-call controls count. `appMenuLeaveSpace` does not contain
+ // "callcontrol", so messaging no longer trips it.
+ CallSignal::AutomationIdContains("callControl"),
+ // English-locale fallbacks. Both are role-constrained to AXButton,
+ // so the messaging "Leave the space" AXMenuItem can never match
+ // them (a real meeting's leave/end controls are buttons).
CallSignal::RoleWithName {
role: "AXButton",
name_contains: "leave",
@@ -307,6 +339,11 @@ pub fn load_detection_profiles() -> Vec<MeetingDetectionProfile> {
},
],
min_signals_required: 1,
+ // Defense-in-depth only. The signal-level discriminator above is the
+ // real fix: the phantom came from an app-menu item that has NO window
+ // title, so a window-title guard could never catch it. Kept because a
+ // window titled exactly `Webex` is unambiguously the messaging shell.
+ ignore_window_titles: &["webex"],
},
// Discord native — macOS.
// Electron exposes 0 windows on macOS but the app menu bar has
@@ -339,6 +376,7 @@ pub fn load_detection_profiles() -> Vec<MeetingDetectionProfile> {
},
],
min_signals_required: 2,
+ ignore_window_titles: &[],
},
// Discord native — Windows.
// UIA can't express MenuBarItem signals as PropertyConditions
@@ -369,6 +407,7 @@ pub fn load_detection_profiles() -> Vec<MeetingDetectionProfile> {
CallSignal::NameContains("Disconnect"),
],
min_signals_required: 1,
+ ignore_window_titles: &[],
},
// Discord in browser — require BOTH "Voice Connected" bar AND "Disconnect"
// button. Either alone can appear without being in a call (e.g. seeing other
@@ -388,6 +427,7 @@ pub fn load_detection_profiles() -> Vec<MeetingDetectionProfile> {
},
],
min_signals_required: 2,
+ ignore_window_titles: &[],
},
// Signal — voice/video calls
// macOS: "Signal" app with "End Call" / "Hang Up" button during active calls.
@@ -422,6 +462,7 @@ pub fn load_detection_profiles() -> Vec<MeetingDetectionProfile> {
},
],
min_signals_required: 1,
+ ignore_window_titles: &[],
},
// WhatsApp — voice/video calls
MeetingDetectionProfile {
@@ -447,6 +488,7 @@ pub fn load_detection_profiles() -> Vec<MeetingDetectionProfile> {
},
],
min_signals_required: 1,
+ ignore_window_titles: &[],
},
// Telegram — voice/video calls
MeetingDetectionProfile {
@@ -473,6 +515,7 @@ pub fn load_detection_profiles() -> Vec<MeetingDetectionProfile> {
},
],
min_signals_required: 1,
+ ignore_window_titles: &[],
},
// Generic fallback — catches apps like Skype, Around, Whereby, etc.
MeetingDetectionProfile {
@@ -574,6 +617,7 @@ pub fn load_detection_profiles() -> Vec<MeetingDetectionProfile> {
},
],
min_signals_required: 1,
+ ignore_window_titles: &[],
},
]
}
@@ -706,6 +750,21 @@ impl MeetingUiScanner {
let window = &windows[i];
let _ = window.set_messaging_timeout_secs(0.3);
+ // Per-window guard: drop signals from a window whose title is
+ // on the profile's ignore list (e.g. Webex's bare `Webex`
+ // messaging window). Scoped per-window, so a real meeting
+ // window of the same process is still scanned. See #4145.
+ if !profile.ignore_window_titles.is_empty() {
+ let window_title = get_ax_string_attr(window, cidre::ax::attr::title());
+ if window_title_is_ignored(window_title.as_deref(), profile) {
+ debug!(
+ "meeting scanner: skipping ignored window title {:?} for pid {}",
+ window_title, pid
+ );
+ continue;
+ }
+ }
+
// Walk this window's AX tree looking for signals
walk_for_signals(
window,
@@ -771,9 +830,17 @@ impl MeetingUiScanner {
let scan_timeout = self.scan_timeout;
let signals = profile.call_signals.clone();
let min_required = profile.min_signals_required;
+ let ignore_window_titles = profile.ignore_window_titles;
let scan_result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
- windows_scan_process_uia(pid, &signals, min_required, max_depth, scan_timeout)
+ windows_scan_process_uia(
+ pid,
+ &signals,
+ min_required,
+ max_depth,
+ scan_timeout,
+ ignore_window_titles,
+ )
}));
let matched_signals = match scan_result {
@@ -1117,6 +1184,41 @@ fn check_signal_match(
}
}
+/// Per-window guard: should call signals found in a window with this title be
+/// IGNORED?
+///
+/// Returns `true` when `window_title` (trimmed, case-insensitive) is exactly
+/// equal to one of `ignore_titles`. This is the discriminator that separates an
+/// app's messaging window from its meeting window when both live under one
+/// process.
+///
+/// Matching is exact-equality on purpose, not substring: Webex's messaging
+/// window title is *exactly* `Webex`, whereas a real meeting window is titled
+/// with the meeting/space name (e.g. `Project Update Call`, `VHM Calendar
+/// Hold`). A substring check would also drop a meeting whose name happened to
+/// contain "Webex", re-introducing the phantom-vs-real ambiguity. A window with
+/// no readable title (`None`) is never blocked — absence of a title can't prove
+/// it is the messaging window.
+#[cfg(any(target_os = "macos", target_os = "windows", test))]
+fn window_title_is_ignored_titles(window_title: Option<&str>, ignore_titles: &[&str]) -> bool {
+ let Some(title) = window_title else {
+ return false;
+ };
+ let title = title.trim();
+ if title.is_empty() {
+ return false;
+ }
+ ignore_titles
+ .iter()
+ .any(|ignored| title.eq_ignore_ascii_case(ignored.trim()))
+}
+
+/// Profile-scoped convenience over [`window_title_is_ignored_titles`].
+#[cfg(any(target_os = "macos", test))]
+fn window_title_is_ignored(window_title: Option<&str>, profile: &MeetingDetectionProfile) -> bool {
+ window_title_is_ignored_titles(window_title, profile.ignore_window_titles)
+}
+
/// Optimized signal match using pre-lowercased signal strings and pre-lowercased node fields.
/// Avoids per-signal and per-node `.to_lowercase()` allocations on the hot path.
#[cfg(target_os = "macos")]
@@ -1415,6 +1517,7 @@ fn windows_scan_process_uia(
min_required: usize,
_max_depth: usize,
timeout: Duration,
+ profile_ignore_window_titles: &[&str],
) -> Result<Vec<String>, String> {
use windows::Win32::System::Com::{
CoCreateInstance, CoInitializeEx, CoUninitialize, CLSCTX_ALL, COINIT_APARTMENTTHREADED,
@@ -1482,6 +1585,24 @@ fn windows_scan_process_uia(
Err(_) => continue,
};
+ // Per-window guard: drop signals from a window whose title is on the
+ // profile's ignore list (e.g. Webex's bare `Webex` messaging window).
+ // Scoped per-window, so a real meeting window of the same process is
+ // still scanned. See #4145.
+ if !profile_ignore_window_titles.is_empty() {
+ let window_title = element.CurrentName().ok().map(|n| n.to_string());
+ if window_title_is_ignored_titles(
+ window_title.as_deref(),
+ profile_ignore_window_titles,
+ ) {
+ debug!(
+ "meeting scanner (windows): skipping ignored window title {:?} for pid {}",
+ window_title, pid
+ );
+ continue;
+ }
+ }
+
// Strategy 0: Check root window element name against WindowTitle signals.
// Zoom on Windows has a window titled "Zoom Meeting" but exposes NO
// named descendant buttons — so we must check the window itself.
@@ -3821,6 +3942,7 @@ mod tests {
},
call_signals: vec![],
min_signals_required: 1,
+ ignore_window_titles: &[],
}
}
@@ -3880,6 +4002,178 @@ mod tests {
));
}
+ // ── Webex messaging-vs-meeting discrimination (#4145/#4337) ──────────
+ //
+ // Webex runs messaging and meetings under one process. The phantom meeting
+ // came from the messaging app-menu item "Leave the space"/"Leave the team"
+ // (role AXMenuItem, identifier `appMenuLeaveSpace`/`appMenuLeaveTeam`), which
+ // the over-broad `AutomationIdContains("leave")` signal matched. Real in-call
+ // controls carry locale-independent `callControl_*` ids (live-captured: the
+ // "End meeting" button is `callControl_end`). The fix narrows the automation-id
+ // signal to `callControl`, so the messaging menu item no longer matches while
+ // real meetings still do. The element attributes asserted below are the exact
+ // ones captured from a live Webex on macOS. The remaining `ignore_window_titles`
+ // guard is retained as defense-in-depth (see the profile comment).
+
+ /// The Webex profile as loaded in production.
+ fn webex_profile() -> MeetingDetectionProfile {
+ load_detection_profiles()
+ .into_iter()
+ .find(|p| p.app_identifiers.macos_app_names.contains(&"webex"))
+ .expect("webex profile present")
+ }
+
+ /// True if ANY of the profile's call signals match a single AX node. This is
+ /// the per-node decision the live tree-walk makes; combined with the window
+ /// guard it reproduces the per-window scan outcome.
+ fn any_signal_matches(
+ profile: &MeetingDetectionProfile,
+ role: &str,
+ title: Option<&str>,
+ desc: Option<&str>,
+ identifier: Option<&str>,
+ ) -> bool {
+ profile
+ .call_signals
+ .iter()
+ .any(|s| check_signal_match(s, role, title, desc, identifier))
+ }
+
+ #[test]
+ fn webex_profile_ignores_bare_webex_window_title() {
+ let p = webex_profile();
+ assert_eq!(
+ p.ignore_window_titles,
+ &["webex"],
+ "webex profile must guard the bare `Webex` messaging window"
+ );
+ }
+
+ #[test]
+ fn bare_webex_messaging_window_is_guarded() {
+ let p = webex_profile();
+ // Exact title, plus case/whitespace variants Webex/AX may report.
+ assert!(window_title_is_ignored(Some("Webex"), &p));
+ assert!(window_title_is_ignored(Some("webex"), &p));
+ assert!(window_title_is_ignored(Some(" Webex "), &p));
+ }
+
+ #[test]
+ fn real_webex_meeting_window_is_not_guarded() {
+ let p = webex_profile();
+ // Real meeting windows carry the meeting/space name, never bare `Webex`.
+ assert!(!window_title_is_ignored(Some("Project Update Call"), &p));
+ assert!(!window_title_is_ignored(Some("VHM Calendar Hold"), &p));
+ // A title that merely *contains* "Webex" is a meeting, not the bare
+ // messaging window — exact-equality (not substring) keeps it detectable.
+ assert!(!window_title_is_ignored(Some("Webex Standup"), &p));
+ assert!(!window_title_is_ignored(Some("Cisco Webex Meeting"), &p));
+ // No readable title can't prove it's the messaging window.
+ assert!(!window_title_is_ignored(None, &p));
+ assert!(!window_title_is_ignored(Some(""), &p));
+ }
+
+ #[test]
+ fn webex_messaging_leave_menuitem_produces_no_signal() {
+ // THE FIX (live-captured): the messaging "Leave the space"/"Leave the
+ // team" affordance is an AXMenuItem with identifier `appMenuLeaveSpace`/
+ // `appMenuLeaveTeam` — NOT an AXButton. The old `AutomationIdContains
+ // ("leave")` matched its id and started a phantom meeting. With the signal
+ // narrowed to `callControl`, it produces NO signal — and note this holds
+ // at the signal level, independent of any window-title guard (the node has
+ // no window title at all, which is why the title guard alone never fixed it).
+ let p = webex_profile();
+ assert!(
+ !any_signal_matches(
+ &p,
+ "AXMenuItem",
+ Some("Leave the space"),
+ None,
+ Some("appMenuLeaveSpace"),
+ ),
+ "messaging 'Leave the space' menu item must NOT count as a call signal"
+ );
+ assert!(
+ !any_signal_matches(
+ &p,
+ "AXMenuItem",
+ Some("Leave the team"),
+ None,
+ Some("appMenuLeaveTeam"),
+ ),
+ "messaging 'Leave the team' menu item must NOT count as a call signal"
+ );
+ }
+
+ #[test]
+ fn real_webex_meeting_call_controls_are_detected() {
+ // A real meeting's in-call controls carry `callControl_*` ids. Detection
+ // must still fire — the fix must not silence real meetings.
+ let p = webex_profile();
+ // Host: "End meeting" button, identifier callControl_end (live-captured).
+ assert!(
+ any_signal_matches(
+ &p,
+ "AXButton",
+ Some("End meeting"),
+ None,
+ Some("callControl_end"),
+ ),
+ "host 'End meeting' control (callControl_end) must be detected"
+ );
+ // Participant: a leave control with a callControl_* id.
+ assert!(
+ any_signal_matches(
+ &p,
+ "AXButton",
+ Some("Leave meeting"),
+ None,
+ Some("callControl_leave"),
+ ),
+ "participant leave control (callControl_*) must be detected"
+ );
+ // Even without a callControl id, the role-constrained AXButton name
+ // fallback catches a leave/end button (English locale).
+ assert!(
+ any_signal_matches(&p, "AXButton", Some("Leave Meeting"), None, None),
+ "AXButton named 'Leave Meeting' must be detected via the name fallback"
+ );
+ }
+
+ #[test]
+ fn webex_messaging_open_during_meeting_still_detects_meeting() {
+ // Both open at once: the messaging menu item contributes no signal (it is
+ // excluded at the signal level), while the meeting's call control fires —
+ // so the process is correctly in a call.
+ let p = webex_profile();
+ let messaging_signal = any_signal_matches(
+ &p,
+ "AXMenuItem",
+ Some("Leave the space"),
+ None,
+ Some("appMenuLeaveSpace"),
+ );
+ let meeting_signal = any_signal_matches(
+ &p,
+ "AXButton",
+ Some("End meeting"),
+ None,
+ Some("callControl_end"),
+ );
+ assert!(!messaging_signal, "messaging must contribute no signal");
+ assert!(meeting_signal, "meeting call control must be detected");
+ }
+
+ #[test]
+ fn window_title_guard_is_noop_for_profiles_without_ignore_list() {
+ // Every other profile has an empty ignore list, so the guard never
+ // suppresses their windows.
+ let zoom = zoom_test_profile();
+ assert!(zoom.ignore_window_titles.is_empty());
+ assert!(!window_title_is_ignored(Some("Zoom Meeting"), &zoom));
+ assert!(!window_title_is_ignored(Some("anything"), &zoom));
+ }
+
// ── AttrNeeds tests ────────────────────────────────────────────────
#[test]