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(meeting): stop google meet's end page starting a phantom meeting on windows (#6267)
Louis Beaumont8d33ee4a1e06
diff --git a/crates/screenpipe-engine/src/meeting_watcher/shared/ignore.rs b/crates/screenpipe-engine/src/meeting_watcher/shared/ignore.rsindex 2f06fe364..9035b69f3 100644--- a/crates/screenpipe-engine/src/meeting_watcher/shared/ignore.rs+++ b/crates/screenpipe-engine/src/meeting_watcher/shared/ignore.rs@@ -168,6 +168,63 @@ pub(crate) fn browser_window_matches_meeting(false}+/// Why a Windows browser window was accepted as a meeting candidate.+#[derive(Debug, Clone, Copy, PartialEq, Eq)]+#[cfg(any(target_os = "windows", test))]+pub(crate) enum WindowsTitleMatch {+ /// A `browser_url_patterns` entry (e.g. `meet.google.com`) appeared+ /// verbatim in the window title.+ UrlPattern,+ /// An anchored `browser_title_patterns` entry matched AND the title carries+ /// a standalone Meet-code token.+ AnchoredTitle,+}++/// Per-window decision for the Windows window-title sweep.+///+/// Windows exposes no per-tab URL, so both checks run against the window title:+///+/// - `browser_url_patterns` must appear verbatim with boundary matching — this+/// keeps a real meeting host matching while closing the `daily.co` ⊂+/// `thedaily.com` substring leak.+/// - Anchored `browser_title_patterns` are gated on a standalone Meet-code+/// token, exactly as the macOS AX sweep gates them in+/// `ax_window_matches_meeting`.+///+/// The code gate is what stops the post-call page from starting a meeting.+/// Chrome titles both the "You left the meeting" end page and the Meet landing+/// page `Meet - Google Chrome`, whereas a live call is titled after the calendar+/// event ("Weekly Reflections - Google Chrome"), the bare meeting code, or+/// `Meet – abc-defg-hij`. Ungated, the bare `Meet` anchor therefore fired almost+/// exclusively on the states that are *not* a call, handing the audio-process+/// detector a Meet candidate the instant the user landed on the end page. A+/// browser candidate skips the call-signal check, so a Chrome mic session that+/// outlived the call it belonged to was then enough to start a phantom meeting+/// immediately after a real one ended. Requiring the code keeps the genuine+/// URL-less pop-out and drops the idle states.+#[cfg(any(target_os = "windows", test))]+pub(crate) fn windows_browser_title_match(+ title: &str,+ profile: &MeetingDetectionProfile,+) -> Option<WindowsTitleMatch> {+ let ids = &profile.app_identifiers;+ if ids+ .browser_url_patterns+ .iter()+ .any(|p| browser_url_pattern_matches(title, p))+ {+ return Some(WindowsTitleMatch::UrlPattern);+ }+ if ids.browser_title_patterns.is_empty() || !title_contains_meeting_code(title) {+ return None;+ }+ let title_lower = title.to_lowercase();+ ids.browser_title_patterns+ .iter()+ .any(|p| browser_title_matches_pattern(&title_lower, p))+ .then_some(WindowsTitleMatch::AnchoredTitle)+}+/// Per-window decision for the macOS AX window sweep, which sees each window's/// AXDocument (the page URL, when the browser exposes one — Safari does,/// Chrome mostly doesn't) and its title.@@ -245,11 +302,12 @@ pub(crate) fn ax_window_matches_meeting(/// ("how-to-run-fast-fyi") does not count as standalone.////// A real Chrome/Edge Meet pop-out is titled "Meet – abc-defg-hij"; this is-/// the gate `ax_window_matches_meeting` applies on top of the anchored-/// `browser_title_patterns` fallback for URL-less windows. Byte-level scan is+/// the gate `ax_window_matches_meeting` (macOS AX sweep) and+/// `find_running_meeting_apps` (Windows window-title sweep) apply on top of the+/// anchored `browser_title_patterns` fallback for URL-less windows. Byte-level scan is/// UTF-8 safe: multi-byte separators (the en dash above) have non-ASCII bytes,/// which neither form the code nor extend the token.-#[cfg(any(target_os = "macos", test))]+#[cfg(any(target_os = "macos", target_os = "windows", test))]pub(crate) fn title_contains_meeting_code(title: &str) -> bool {const CODE_LEN: usize = 12; // aaa-bbbb-ccclet bytes = title.as_bytes();diff --git a/crates/screenpipe-engine/src/meeting_watcher/ui_scan/tests.rs b/crates/screenpipe-engine/src/meeting_watcher/ui_scan/tests.rsindex d20a4b3a8..7f6801441 100644--- a/crates/screenpipe-engine/src/meeting_watcher/ui_scan/tests.rs+++ b/crates/screenpipe-engine/src/meeting_watcher/ui_scan/tests.rs@@ -2846,6 +2846,97 @@ fn ax_window_title_fallback_requires_meeting_code() {}}+#[test]+fn windows_title_sweep_ignores_meet_end_and_landing_pages() {+ // Windows has no per-tab URL, so the anchored `Meet` title pattern is the+ // only thing this sweep can key on. Chrome titles the post-call ("You left+ // the meeting") page and the Meet landing page identically — `Meet - Google+ // Chrome` — so ungated they became meeting candidates. A browser candidate+ // skips the call-signal check in the audio-process detector, so a Chrome mic+ // session that outlived the call was then enough to start a phantom meeting+ // the moment the user hit the end page.+ let profiles = load_detection_profiles();+ let meet = google_meet_profile(&profiles);++ let non_call_titles = [+ // Post-call "You left the meeting" page and the landing page.+ "Meet - Google Chrome",+ "Meet - Google Chrome — Personal",+ "Meet and MicrosoftEdge",+ // Ordinary pages that merely start with the anchor.+ "Meet the Team | Acme - Google Chrome",+ "Meet Kevin - YouTube - Google Chrome",+ "Meet: quarterly planning - Google Chrome",+ ];+ for title in &non_call_titles {+ assert_eq!(+ windows_browser_title_match(title, meet),+ None,+ "non-call window title {:?} must NOT become a Meet candidate",+ title+ );+ }+}++#[test]+fn windows_title_sweep_still_matches_real_meet_windows() {+ let profiles = load_detection_profiles();+ let meet = google_meet_profile(&profiles);++ // Chrome/Edge Meet pop-out: anchored title + standalone meeting code.+ for title in &[+ "Meet - abc-defg-hij - Google Chrome",+ "Meet – abc-defg-hij",+ "Meet - abc-defg-hij and 3 more pages - Personal - Microsoft Edge",+ ] {+ assert_eq!(+ windows_browser_title_match(title, meet),+ Some(WindowsTitleMatch::AnchoredTitle),+ "live Meet pop-out {:?} must still match",+ title+ );+ }++ // A verbatim domain in the title still wins on the URL-pattern path, with+ // or without a meeting code — this branch is unchanged by the code gate.+ for title in &[+ "meet.google.com/abc-defg-hij - Google Chrome",+ "meet.google.com - Google Chrome",+ ] {+ assert_eq!(+ windows_browser_title_match(title, meet),+ Some(WindowsTitleMatch::UrlPattern),+ "verbatim Meet domain in title {:?} must still match",+ title+ );+ }+}++#[test]+fn windows_title_sweep_ignores_calendar_named_calls_as_before() {+ // Real in-call Chrome titles are the calendar event name, which never+ // started with the `Meet` anchor and so never matched this sweep. The code+ // gate does not change that: those calls are detected via DB frame evidence+ // (`browser_window_matches_meeting`) and the UIA call-signal scan, both+ // untouched here. Asserted so a future widening of the anchor is a+ // deliberate, visible change.+ let profiles = load_detection_profiles();+ let meet = google_meet_profile(&profiles);++ for title in &[+ "Weekly Reflections (time change) - Google Chrome",+ "Screenpipe troubleshooting with Rajat - Google Chrome",+ "apd-yzrk-jxn - Google Chrome",+ ] {+ assert_eq!(+ windows_browser_title_match(title, meet),+ None,+ "calendar-named / bare-code title {:?} is out of scope for this sweep",+ title+ );+ }+}+#[test]fn title_contains_meeting_code_requires_standalone_lowercase_token() {// Real pop-out shapes.diff --git a/crates/screenpipe-engine/src/meeting_watcher/ui_scan/windows.rs b/crates/screenpipe-engine/src/meeting_watcher/ui_scan/windows.rsindex bbeba406a..2b5b3c040 100644--- a/crates/screenpipe-engine/src/meeting_watcher/ui_scan/windows.rs+++ b/crates/screenpipe-engine/src/meeting_watcher/ui_scan/windows.rs@@ -536,25 +536,11 @@ pub fn find_running_meeting_apps(continue;}- // url_patterns are matched against the window TITLE on Windows (no- // per-tab URL available). Boundary matching still applies — it keeps- // a real meeting host in a title matching while closing the- // `daily.co` ⊂ `thedaily.com` substring leak.- let url_match = profile- .app_identifiers- .browser_url_patterns- .iter()- .any(|p| browser_url_pattern_matches(title, p));- // See `browser_title_matches_pattern` for the matching rules.- let title_match = !profile.app_identifiers.browser_title_patterns.is_empty() && {- let title_lower = title.to_lowercase();- profile- .app_identifiers- .browser_title_patterns- .iter()- .any(|p| browser_title_matches_pattern(&title_lower, p))- };- if url_match || title_match {+ // Pure decision, unit-tested in `shared::ignore` — see+ // `windows_browser_title_match` for the URL-pattern / anchored-title+ // rules and the Meet-code gate.+ let matched = windows_browser_title_match(title, profile);+ if matched.is_some() {// Confirms screenpipe saw the meeting window; pairs with the// scanner's UIA scan line via pid + profile_idx. DEBUG, not// INFO: titles can contain sensitive context (URLs, attendee@@ -565,8 +551,8 @@ pub fn find_running_meeting_apps(pid,proc_name.as_deref().unwrap_or("?"),title,- url_match,- title_match+ matched == Some(WindowsTitleMatch::UrlPattern),+ matched == Some(WindowsTitleMatch::AnchoredTitle));results.push(RunningMeetingApp {pid: *pid,