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(app): drop misleading 'join and take notes' button from in-progress meeting toast (#3599)
Louis Beaumont1d6de2b151a9
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lockindex d9f155487..3bf9898c0 100644--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock@@ -10876,7 +10876,7 @@ dependencies = [[[package]]name = "screenpipe-app"-version = "2.4.276"+version = "2.4.272"dependencies = ["aes 0.8.4","aes-gcm 0.10.3",@@ -10999,7 +10999,7 @@ dependencies = [[[package]]name = "screenpipe-audio"-version = "0.3.346"+version = "0.3.345"dependencies = ["anyhow","audiopipe",@@ -11074,7 +11074,7 @@ dependencies = [[[package]]name = "screenpipe-config"-version = "0.3.346"+version = "0.3.345"dependencies = ["dirs 6.0.0","serde",@@ -11086,7 +11086,7 @@ dependencies = [[[package]]name = "screenpipe-connect"-version = "0.3.346"+version = "0.3.345"dependencies = ["anyhow","async-trait",@@ -11119,7 +11119,7 @@ dependencies = [[[package]]name = "screenpipe-core"-version = "0.3.346"+version = "0.3.345"dependencies = ["accessibility","accessibility-sys",@@ -11169,7 +11169,7 @@ dependencies = [[[package]]name = "screenpipe-db"-version = "0.3.346"+version = "0.3.345"dependencies = ["anyhow","chrono",@@ -11194,7 +11194,7 @@ dependencies = [[[package]]name = "screenpipe-engine"-version = "0.3.346"+version = "0.3.345"dependencies = ["anyhow","arc-swap",@@ -11263,7 +11263,7 @@ dependencies = [[[package]]name = "screenpipe-events"-version = "0.3.346"+version = "0.3.345"dependencies = ["anyhow","chrono",@@ -11279,7 +11279,7 @@ dependencies = [[[package]]name = "screenpipe-redact"-version = "0.3.346"+version = "0.3.345"dependencies = ["anyhow","async-trait",@@ -11308,7 +11308,7 @@ dependencies = [[[package]]name = "screenpipe-rfdetr-mlx"-version = "0.3.346"+version = "0.3.345"dependencies = ["image 0.25.10","mlx-rs",@@ -11319,7 +11319,7 @@ dependencies = [[[package]]name = "screenpipe-screen"-version = "0.3.346"+version = "0.3.345"dependencies = ["accessibility-sys","anyhow",@@ -11372,7 +11372,7 @@ dependencies = [[[package]]name = "screenpipe-sync"-version = "0.3.346"+version = "0.3.345"dependencies = ["async-trait","base64 0.22.1",@@ -11392,7 +11392,7 @@ dependencies = [[[package]]name = "screenpipe-vault"-version = "0.3.346"+version = "0.3.345"dependencies = ["argon2","chacha20poly1305",diff --git a/apps/screenpipe-app-tauri/src-tauri/src/calendar.rs b/apps/screenpipe-app-tauri/src-tauri/src/calendar.rsindex 32ad2ec95..48d2644f2 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/calendar.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/calendar.rs@@ -313,72 +313,87 @@ pub async fn calendar_get_current_meeting() -> Result<Vec<CalendarEventItem>, St/// Background loop that publishes calendar events to the event bus every 60s./// Consumed by meetings.rs for meeting detection signal #5.+///+/// Publishes on every cycle — even an empty list when there are no events or+/// no auth — so subscribers can distinguish "publisher hasn't run yet" from+/// "publisher ran and there's nothing." Subscribers (meeting_live_notes) use+/// the first publication to mark their cache as authoritative and stop+/// duplicating the fetch.pub async fn start_calendar_events_publisher() {info!("calendar events publisher: started");loop {- #[cfg(target_os = "macos")]+ let items: Vec<CalendarEventItem> = collect_calendar_events().await;++ if let Err(e) = screenpipe_events::send_event("calendar_events", items) {+ debug!("calendar publisher: failed to send event: {}", e);+ }++ tokio::time::sleep(tokio::time::Duration::from_secs(60)).await;+ }+}++async fn collect_calendar_events() -> Vec<CalendarEventItem> {+ #[cfg(target_os = "macos")]+ {+ use screenpipe_connect::calendar::ScreenpipeCalendar;++ let status = ScreenpipeCalendar::authorization_status();+ if format!("{}", status) != "Full Access" {+ return Vec::new();+ }++ match tokio::task::spawn_blocking(|| {+ let cal = ScreenpipeCalendar::new();+ cal.get_events(1, 2)+ })+ .await{- use screenpipe_connect::calendar::ScreenpipeCalendar;-- let status = ScreenpipeCalendar::authorization_status();- if format!("{}", status) == "Full Access" {- match tokio::task::spawn_blocking(|| {- let cal = ScreenpipeCalendar::new();- cal.get_events(1, 2)- })- .await- {- Ok(Ok(events)) => {- let items: Vec<CalendarEventItem> =- events.into_iter().map(calendar_event_to_item).collect();- if let Err(e) = screenpipe_events::send_event("calendar_events", items) {- debug!("calendar publisher: failed to send event: {}", e);- }- }- Ok(Err(e)) => {- debug!("calendar publisher: fetch failed: {}", e);- }- Err(e) => {- error!("calendar publisher: task panicked: {}", e);- }- }+ Ok(Ok(events)) => events.into_iter().map(calendar_event_to_item).collect(),+ Ok(Err(e)) => {+ debug!("calendar publisher: fetch failed: {}", e);+ Vec::new()+ }+ Err(e) => {+ error!("calendar publisher: task panicked: {}", e);+ Vec::new()}}+ }++ #[cfg(target_os = "windows")]+ {+ use screenpipe_connect::calendar_windows::ScreenpipeCalendar;- #[cfg(target_os = "windows")]+ match tokio::task::spawn_blocking(|| {+ let cal = ScreenpipeCalendar::new()?;+ let calendars = cal.list_calendars().unwrap_or_default();+ info!(+ "calendar publisher: found {} calendars: {:?}",+ calendars.len(),+ calendars+ );+ cal.get_events(1, 2)+ })+ .await{- use screenpipe_connect::calendar_windows::ScreenpipeCalendar;-- match tokio::task::spawn_blocking(|| {- let cal = ScreenpipeCalendar::new()?;- let calendars = cal.list_calendars().unwrap_or_default();- info!(- "calendar publisher: found {} calendars: {:?}",- calendars.len(),- calendars- );- cal.get_events(1, 2)- })- .await- {- Ok(Ok(events)) => {- info!("calendar publisher: fetched {} events", events.len());- let items: Vec<CalendarEventItem> =- events.into_iter().map(calendar_event_to_item_win).collect();- if let Err(e) = screenpipe_events::send_event("calendar_events", items) {- warn!("calendar publisher: failed to send event: {}", e);- }- }- Ok(Err(e)) => {- warn!("calendar publisher: fetch failed: {}", e);- }- Err(e) => {- error!("calendar publisher: task panicked: {}", e);- }+ Ok(Ok(events)) => {+ info!("calendar publisher: fetched {} events", events.len());+ events.into_iter().map(calendar_event_to_item_win).collect()+ }+ Ok(Err(e)) => {+ warn!("calendar publisher: fetch failed: {}", e);+ Vec::new()+ }+ Err(e) => {+ error!("calendar publisher: task panicked: {}", e);+ Vec::new()}}+ }- tokio::time::sleep(tokio::time::Duration::from_secs(60)).await;+ #[cfg(not(any(target_os = "macos", target_os = "windows")))]+ {+ Vec::new()}}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.rsindex 2f7a07e2b..039e473b7 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@@ -11,6 +11,7 @@ use futures::StreamExt;use serde::Deserialize;use serde_json::json;use std::collections::HashMap;+use std::sync::atomic::{AtomicBool, Ordering};use std::sync::Arc;use std::time::Instant;use tauri::{AppHandle, Emitter, Manager};@@ -80,16 +81,13 @@ struct CalendarEventSignal {is_all_day: bool,}-#[derive(Clone, Debug)]-struct JoinLink {- url: String,- label: String,-}-#[derive(Clone, Debug, Default)]struct CalendarMatch {title: Option<String>,- join_link: Option<JoinLink>,+ /// RFC3339 start time of the matched event — paired with title in the+ /// prewarm dedup key so recurring same-title meetings (the 9:00 and 9:30+ /// standups) are tracked independently.+ start: Option<String>,}impl From<crate::calendar::CalendarEventItem> for CalendarEventSignal {@@ -166,7 +164,12 @@ pub fn start(app: AppHandle) {);let calendar_events = Arc::new(RwLock::new(Vec::<CalendarEventSignal>::new()));+ // Flips to true on first publication from `start_calendar_events_publisher`,+ // signalling the cache is authoritative (max ~60s stale). Until then,+ // the started-toast handler does an inline re-fetch on cache miss.+ let cache_initialized = Arc::new(AtomicBool::new(false));let calendar_events_for_sub = Arc::clone(&calendar_events);+ let cache_initialized_for_sub = Arc::clone(&cache_initialized);tauri::async_runtime::spawn(async move {let mut sub =screenpipe_events::subscribe_to_event::<Vec<CalendarEventSignal>>("calendar_events");@@ -177,6 +180,7 @@ pub fn start(app: AppHandle) {.into_iter().filter(|event| !event.is_all_day).collect();+ cache_initialized_for_sub.store(true, Ordering::Release);}});@@ -189,9 +193,8 @@ pub fn start(app: AppHandle) {let prewarm_app = app.clone();let prewarm_suppressed = Arc::clone(&suppressed_titles);tauri::async_runtime::spawn(async move {- let mut sub = screenpipe_events::subscribe_to_event::<MeetingPrewarmEvent>(- "meeting_about_to_start",- );+ let mut sub =+ screenpipe_events::subscribe_to_event::<MeetingPrewarmEvent>("meeting_about_to_start");while let Some(event) = sub.next().await {if !meeting_notifications_enabled(&prewarm_app) {debug!("meeting prewarm: notification skipped by preference");@@ -241,6 +244,7 @@ pub fn start(app: AppHandle) {});let started_suppressed = Arc::clone(&suppressed_titles);+ let cache_initialized_for_started = Arc::clone(&cache_initialized);tauri::async_runtime::spawn(async move {let mut sub =screenpipe_events::subscribe_to_event::<MeetingStartedEvent>("meeting_started");@@ -270,10 +274,18 @@ pub fn start(app: AppHandle) {find_calendar_match(&events, &event.data)};- if calendar_match+ // Re-fetch when the cache hasn't been initialized yet (publisher+ // hasn't completed its first cycle) AND we couldn't enrich a+ // title. Once the publisher has run, the cache is authoritative+ // (≤60s stale) and re-fetching just wastes API calls — most+ // expensively for users with no calendar connected, where every+ // `meeting_started` would otherwise fan out to native + ICS ++ // Google for zero benefit.+ let cache_ready = cache_initialized_for_started.load(Ordering::Acquire);+ let needs_title = calendar_match.as_ref()- .is_none_or(|m| m.join_link.is_none())- {+ .is_none_or(|m| m.title.as_deref().is_none_or(|t| t.trim().is_empty()));+ if !cache_ready && needs_title {let fresh_events = fetch_fresh_calendar_events(&app).await;if !fresh_events.is_empty() {calendar_match = find_calendar_match(&fresh_events, &event.data);@@ -306,27 +318,18 @@ pub fn start(app: AppHandle) {continue;}- let mut actions = Vec::new();- if let Some(join) = calendar_match.and_then(|m| m.join_link) {- actions.push(json!({- "id": "join-meeting",- "action": "join-meeting",- "label": join.label,- "type": "meeting_join",- "url": join.url,- "deeplink_url": url.clone(),- "primary": true,- }));- } else {- actions.push(json!({- "id": "open-live-notes",- "action": "open-live-notes",- "label": "open note",- "type": "deeplink",- "url": url.clone(),- "primary": true,- }));- }+ // "join and take notes" is exclusively the prewarm CTA — the v2+ // detector only fires `meeting_started` after UI/audio confirms+ // the user is already in the call, so a join button here is+ // misleading. The started toast always opens the live note.+ let actions = vec![json!({+ "id": "open-live-notes",+ "action": "open-live-notes",+ "label": "open note",+ "type": "deeplink",+ "url": url.clone(),+ "primary": true,+ })];client::send_typed_with_actions("meeting detected",@@ -351,9 +354,10 @@ fn forward_screenpipe_event(app: AppHandle, source: &'static str, target: &'stat}/// Returns true when we have already prewarmed the live-note toast for the-/// calendar event that this `meeting_started` corresponds to. Matches by-/// both the calendar-enriched title and the raw display title (the prewarm-/// suppression key is `title|start` from the events crate).+/// calendar event that this `meeting_started` corresponds to. Prefers an+/// exact `title|start` match when the start time is known so back-to-back+/// same-title events (recurring standups) don't bleed into each other.+/// Falls back to title-only when we couldn't enrich a start time.async fn was_prewarmed(suppressed: &Arc<RwLock<HashMap<String, Instant>>>,calendar_match: &Option<CalendarMatch>,@@ -368,15 +372,29 @@ async fn was_prewarmed(let candidate_titles: Vec<String> = [Some(chosen_title.to_string()),Some(display_title.to_string()),- calendar_match- .as_ref()- .and_then(|m| m.title.clone()),+ calendar_match.as_ref().and_then(|m| m.title.clone()),].into_iter().flatten().map(|s| s.trim().to_lowercase()).filter(|s| !s.is_empty()).collect();++ // When we know the calendar event's start, suppress only on an exact+ // `title|start` match — recurring same-title events must not bleed into+ // each other (the 9:00 standup's prewarm doesn't dedup the 9:30 one).+ if let Some(start) = calendar_match+ .as_ref()+ .and_then(|m| m.start.as_deref())+ .filter(|s| !s.trim().is_empty())+ {+ return candidate_titles+ .iter()+ .any(|t| guard.contains_key(&format!("{t}|{start}")));+ }++ // Fallback only when calendar enrichment failed — title is the best+ // signal we have, accept the small risk of cross-instance suppression.guard.keys().any(|key| {let key_title = key.split('|').next().unwrap_or("");candidate_titles.iter().any(|t| t == key_title)@@ -471,18 +489,9 @@ fn find_calendar_match(.max_by_key(|(score, _)| *score).map(|(_, event)| event)?;- let join_link = events- .iter()- .filter_map(|event| {- let url = event_join_url(event)?;- score_calendar_event(event, &title, now).map(|score| (score, provider_join_link(url)))- })- .max_by_key(|(score, _)| *score)- .map(|(_, link)| link);-Some(CalendarMatch {title: Some(best_event.title.clone()).filter(|s| !s.trim().is_empty()),- join_link,+ start: Some(best_event.start.clone()).filter(|s| !s.trim().is_empty()),})}@@ -524,13 +533,6 @@ fn parse_rfc3339_utc(value: &str) -> Option<chrono::DateTime<chrono::Utc>> {.map(|dt| dt.with_timezone(&chrono::Utc))}-fn provider_join_link(url: String) -> JoinLink {- JoinLink {- url,- label: "join and take notes".to_string(),- }-}-fn normalize_meeting_url(raw: Option<String>) -> Option<String> {let trimmed = raw?.trim()@@ -570,7 +572,7 @@ mod tests {use super::*;#[test]- fn finds_current_meeting_join_link() {+ fn finds_current_meeting_title() {let now = chrono::Utc::now();let events = vec![CalendarEventSignal {title: "Design review".to_string(),@@ -584,11 +586,8 @@ mod tests {..Default::default()};- let link = find_calendar_match(&events, &meeting)- .and_then(|m| m.join_link)- .expect("join link");- assert_eq!(link.url, "https://meet.google.com/abc-defg-hij");- assert_eq!(link.label, "join and take notes");+ let matched = find_calendar_match(&events, &meeting).expect("calendar match");+ assert_eq!(matched.title.as_deref(), Some("Design review"));}#[test]@@ -608,9 +607,6 @@ mod tests {let matched = find_calendar_match(&events, &meeting).expect("calendar match");assert_eq!(matched.title.as_deref(), Some("Customer onboarding"));- let link = matched.join_link.expect("join link");- assert_eq!(link.url, "https://zoom.us/j/123");- assert_eq!(link.label, "join and take notes");}#[test]@@ -641,4 +637,42 @@ mod tests {assert!(find_calendar_match(&events, &MeetingStartedEvent::default()).is_none());}++ #[tokio::test]+ async fn dedup_distinguishes_recurring_same_title_events() {+ let suppressed: Arc<RwLock<HashMap<String, Instant>>> =+ Arc::new(RwLock::new(HashMap::new()));+ let nine_am = "2026-05-25T09:00:00+00:00";+ let nine_thirty = "2026-05-25T09:30:00+00:00";++ // Prewarm fired for the 9:00 standup only.+ suppressed+ .write()+ .await+ .insert(format!("standup|{nine_am}"), Instant::now());++ // 9:00 started toast → should be suppressed (prewarm already fired).+ let match_nine = Some(CalendarMatch {+ title: Some("Standup".into()),+ start: Some(nine_am.into()),+ });+ assert!(+ was_prewarmed(&suppressed, &match_nine, "Standup", "Standup").await,+ "9:00 started toast must be suppressed — its prewarm fired"+ );++ // 9:30 started toast (same title, different start) → should NOT be+ // suppressed. The 9:30 prewarm hasn't fired (e.g., user hasn't+ // returned to the calendar publisher's window yet, or it was+ // skipped). Before this fix, the title-only fallback would have+ // wrongly suppressed it.+ let match_nine_thirty = Some(CalendarMatch {+ title: Some("Standup".into()),+ start: Some(nine_thirty.into()),+ });+ assert!(+ !was_prewarmed(&suppressed, &match_nine_thirty, "Standup", "Standup").await,+ "9:30 started toast must fire — its prewarm never did"+ );+ }}diff --git a/crates/screenpipe-events/src/custom_events/meetings.rs b/crates/screenpipe-events/src/custom_events/meetings.rsindex 68e259886..34e41bd2c 100644--- a/crates/screenpipe-events/src/custom_events/meetings.rs+++ b/crates/screenpipe-events/src/custom_events/meetings.rs@@ -242,14 +242,15 @@ pub async fn poll_meetings_events() -> Result<()> {if prewarmed.contains_key(&key) {continue;}- let join_url = extract_join_url(cal_event);- // Skip events that have no join link AND no- // attendees beyond the organizer — those are- // typically in-person blocks or focus time- // and don't benefit from a prewarm toast.- if join_url.is_none() && cal_event.attendees.len() < 2 {+ // Prewarm exists to let the user click "join and+ // take notes" before the call starts. Without a+ // join URL there's no actionable CTA, so the+ // toast would fire with just a header and no+ // buttons — skip those (in-person meetings,+ // focus blocks, dial-in-only invites).+ let Some(join_url) = extract_join_url(cal_event) else {continue;- }+ };prewarmed.insert(key, Instant::now());let _ = send_event("meeting_about_to_start",@@ -257,7 +258,7 @@ pub async fn poll_meetings_events() -> Result<()> {title: cal_event.title.clone(),start: cal_event.start.clone(),end: cal_event.end.clone(),- meeting_url: join_url,+ meeting_url: Some(join_url),seconds_until_start,timestamp: now,},