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(calendar): stop defaulting untitled events to "(no title)" + dedup prewarm toast (#4657)

Ezra Ellette2de6f9ad1830
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.rs
index d522be18e..1d348f7db 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
@@ -300,12 +300,7 @@ pub fn start(app: AppHandle) {
}
}
- let title = calendar_match
- .as_ref()
- .and_then(|m| m.title.as_ref())
- .filter(|s| !s.trim().is_empty())
- .cloned()
- .unwrap_or_else(|| event.data.display_title());
+ let title = choose_started_notification_title(calendar_match.as_ref(), &event.data);
// Dedup: if a prewarm toast already fired for this calendar
// event, don't fire a second toast when audio/UI later
@@ -364,6 +359,17 @@ fn forward_screenpipe_event(app: AppHandle, source: &'static str, target: &'stat
});
}
+fn choose_started_notification_title(
+ calendar_match: Option<&CalendarMatch>,
+ event: &MeetingStartedEvent,
+) -> String {
+ calendar_match
+ .and_then(|m| m.title.as_deref())
+ .filter(|s| !s.trim().is_empty())
+ .map(str::to_string)
+ .unwrap_or_else(|| event.display_title())
+}
+
/// Returns true when we have already prewarmed the live-note toast for the
/// calendar event that this `meeting_started` corresponds to. Prefers an
/// exact `title|start` match when the start time is known so back-to-back
@@ -399,6 +405,19 @@ async fn was_prewarmed(
.and_then(|m| m.start.as_deref())
.filter(|s| !s.trim().is_empty())
{
+ // The bare `|{start}` key is only ever emitted by an *untitled*
+ // event's prewarm. Honor it only when this started event is itself
+ // untitled, so a stray untitled prewarm can't swallow a distinct
+ // *titled* meeting that merely shares the same start instant
+ // (e.g. a double-booked slot).
+ let calendar_title_empty = calendar_match
+ .as_ref()
+ .and_then(|m| m.title.as_deref())
+ .map(|t| t.trim().is_empty())
+ .unwrap_or(true);
+ if calendar_title_empty && guard.contains_key(&format!("|{start}")) {
+ return true;
+ }
return candidate_titles
.iter()
.any(|t| guard.contains_key(&format!("{t}|{start}")));
@@ -715,6 +734,40 @@ mod tests {
assert!(find_calendar_match(&events, &MeetingStartedEvent::default()).is_none());
}
+ #[test]
+ fn started_notification_title_uses_app_when_calendar_title_absent() {
+ let calendar_match = CalendarMatch {
+ title: None,
+ start: Some("2026-06-11T09:00:00Z".to_string()),
+ };
+ let meeting = MeetingStartedEvent {
+ app: Some("Google Meet".to_string()),
+ ..Default::default()
+ };
+
+ assert_eq!(
+ choose_started_notification_title(Some(&calendar_match), &meeting),
+ "Google Meet"
+ );
+ }
+
+ #[test]
+ fn started_notification_title_preserves_literal_no_title() {
+ let calendar_match = CalendarMatch {
+ title: Some("No Title".to_string()),
+ start: Some("2026-06-11T09:00:00Z".to_string()),
+ };
+ let meeting = MeetingStartedEvent {
+ app: Some("Google Meet".to_string()),
+ ..Default::default()
+ };
+
+ assert_eq!(
+ choose_started_notification_title(Some(&calendar_match), &meeting),
+ "No Title"
+ );
+ }
+
#[tokio::test]
async fn dedup_distinguishes_recurring_same_title_events() {
let suppressed: Arc<RwLock<HashMap<String, Instant>>> =
@@ -752,4 +805,49 @@ mod tests {
"9:30 started toast must fire — its prewarm never did"
);
}
+
+ #[tokio::test]
+ async fn dedup_suppresses_untitled_prewarm_by_start() {
+ let suppressed: Arc<RwLock<HashMap<String, Instant>>> =
+ Arc::new(RwLock::new(HashMap::new()));
+ let start = "2026-05-25T09:00:00+00:00";
+ suppressed
+ .write()
+ .await
+ .insert(prewarm_key("", start), Instant::now());
+
+ let calendar_match = Some(CalendarMatch {
+ title: None,
+ start: Some(start.into()),
+ });
+
+ assert!(
+ was_prewarmed(&suppressed, &calendar_match, "Google Meet", "Google Meet").await,
+ "untitled calendar prewarm should still suppress the matching started toast"
+ );
+ }
+
+ #[tokio::test]
+ async fn dedup_untitled_prewarm_does_not_suppress_titled_meeting_at_same_start() {
+ let suppressed: Arc<RwLock<HashMap<String, Instant>>> =
+ Arc::new(RwLock::new(HashMap::new()));
+ let start = "2026-05-25T09:00:00+00:00";
+ // An untitled event prewarmed at this start → guard holds `|{start}`.
+ suppressed
+ .write()
+ .await
+ .insert(prewarm_key("", start), Instant::now());
+
+ // A distinct, *titled* meeting starts at the same instant (double-booked).
+ // The bare `|{start}` key belongs to the untitled event, not this one,
+ // so this started toast must still fire.
+ let titled_match = Some(CalendarMatch {
+ title: Some("Standup".into()),
+ start: Some(start.into()),
+ });
+ assert!(
+ !was_prewarmed(&suppressed, &titled_match, "Standup", "Standup").await,
+ "a titled meeting must not be suppressed by an untitled event's prewarm at the same start"
+ );
+ }
}
diff --git a/crates/screenpipe-connect/src/ics_calendar.rs b/crates/screenpipe-connect/src/ics_calendar.rs
index e2e9ff73e..498532f0f 100644
--- a/crates/screenpipe-connect/src/ics_calendar.rs
+++ b/crates/screenpipe-connect/src/ics_calendar.rs
@@ -314,7 +314,7 @@ pub fn parse_ics_to_events(
continue;
}
- let title = event.get_summary().unwrap_or("(no title)").to_string();
+ let title = event.get_summary().unwrap_or_default().to_string();
let location = event.get_location().map(|s| s.to_string());
let meeting_url = normalize_meeting_url(event.get_url().map(str::to_string))
.or_else(|| extract_meeting_url(location.as_deref()))
@@ -541,4 +541,36 @@ mod tests {
assert!(parse_ics_to_events(&ics_data, "test", now, 0, 8).is_empty());
assert_eq!(parse_ics_to_events(&ics_data, "test", now, 0, 72).len(), 1);
}
+
+ #[test]
+ fn event_without_summary_keeps_empty_title() {
+ let now = Utc::now();
+ let starts_at = now + chrono::Duration::hours(1);
+ let ends_at = now + chrono::Duration::hours(2);
+ let ics_data = format!(
+ "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nBEGIN:VEVENT\r\nUID:empty-title-test\r\nDTSTAMP:20241010T101010Z\r\nDTSTART:{}\r\nDTEND:{}\r\nEND:VEVENT\r\nEND:VCALENDAR",
+ starts_at.format("%Y%m%dT%H%M%SZ"),
+ ends_at.format("%Y%m%dT%H%M%SZ")
+ );
+
+ let events = parse_ics_to_events(&ics_data, "test", now, 0, 8);
+ assert_eq!(events.len(), 1);
+ assert_eq!(events[0].title, "");
+ }
+
+ #[test]
+ fn literal_no_title_summary_is_preserved() {
+ let now = Utc::now();
+ let starts_at = now + chrono::Duration::hours(1);
+ let ends_at = now + chrono::Duration::hours(2);
+ let ics_data = format!(
+ "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nBEGIN:VEVENT\r\nUID:literal-no-title-test\r\nDTSTAMP:20241010T101010Z\r\nDTSTART:{}\r\nDTEND:{}\r\nSUMMARY:No Title\r\nEND:VEVENT\r\nEND:VCALENDAR",
+ starts_at.format("%Y%m%dT%H%M%SZ"),
+ ends_at.format("%Y%m%dT%H%M%SZ")
+ );
+
+ let events = parse_ics_to_events(&ics_data, "test", now, 0, 8);
+ assert_eq!(events.len(), 1);
+ assert_eq!(events[0].title, "No Title");
+ }
}
diff --git a/crates/screenpipe-engine/src/connections_api.rs b/crates/screenpipe-engine/src/connections_api.rs
index d563fb0fc..0c52793ed 100644
--- a/crates/screenpipe-engine/src/connections_api.rs
+++ b/crates/screenpipe-engine/src/connections_api.rs
@@ -1278,46 +1278,48 @@ async fn gcal_fetch_events(
let items = resp["items"].as_array().cloned().unwrap_or_default();
let events: Vec<Value> = items
.into_iter()
- .map(|item| {
- let start = item["start"]["dateTime"]
- .as_str()
- .or_else(|| item["start"]["date"].as_str())
- .unwrap_or("")
- .to_string();
- let end = item["end"]["dateTime"]
- .as_str()
- .or_else(|| item["end"]["date"].as_str())
- .unwrap_or("")
- .to_string();
- let is_all_day = item["start"]["date"].is_string();
-
- let attendees: Vec<String> = item["attendees"]
- .as_array()
- .map(|arr| {
- arr.iter()
- .filter_map(|a| a["email"].as_str().map(String::from))
- .collect()
- })
- .unwrap_or_default();
- let meeting_url = google_calendar_meeting_url(&item);
-
- json!({
- "id": item["id"].as_str().unwrap_or(""),
- "title": item["summary"].as_str().unwrap_or("(No title)"),
- "start": start,
- "end": end,
- "attendees": attendees,
- "location": item["location"].as_str(),
- "meetingUrl": meeting_url,
- "calendarName": calendar_label,
- "isAllDay": is_all_day,
- })
- })
+ .map(|item| google_calendar_event_json(&item, calendar_label))
.collect();
Ok(events)
}
+fn google_calendar_event_json(item: &Value, calendar_label: &str) -> Value {
+ let start = item["start"]["dateTime"]
+ .as_str()
+ .or_else(|| item["start"]["date"].as_str())
+ .unwrap_or("")
+ .to_string();
+ let end = item["end"]["dateTime"]
+ .as_str()
+ .or_else(|| item["end"]["date"].as_str())
+ .unwrap_or("")
+ .to_string();
+ let is_all_day = item["start"]["date"].is_string();
+
+ let attendees: Vec<String> = item["attendees"]
+ .as_array()
+ .map(|arr| {
+ arr.iter()
+ .filter_map(|a| a["email"].as_str().map(String::from))
+ .collect()
+ })
+ .unwrap_or_default();
+ let meeting_url = google_calendar_meeting_url(item);
+
+ json!({
+ "id": item["id"].as_str().unwrap_or(""),
+ "title": item["summary"].as_str().unwrap_or(""),
+ "start": start,
+ "end": end,
+ "attendees": attendees,
+ "location": item["location"].as_str(),
+ "meetingUrl": meeting_url,
+ "calendarName": calendar_label,
+ "isAllDay": is_all_day,
+ })
+}
+
/// Merge per-account Google Calendar event lists into one timeline. An invite
/// visible in more than one connected account keeps its Google event id, so
/// duplicates are dropped by id (first account wins). Sorted by start time;
@@ -3532,6 +3534,37 @@ mod tests {
);
}
+ #[test]
+ fn google_calendar_event_without_summary_has_empty_title() {
+ let item = json!({
+ "id": "untitled",
+ "start": { "dateTime": "2026-06-11T09:00:00Z" },
+ "end": { "dateTime": "2026-06-11T09:30:00Z" },
+ "conferenceData": {
+ "entryPoints": [
+ { "entryPointType": "video", "uri": "meet.google.com/abc-defg-hij" }
+ ]
+ }
+ });
+
+ let event = google_calendar_event_json(&item, "primary");
+ assert_eq!(event["title"], "");
+ assert_eq!(event["meetingUrl"], "https://meet.google.com/abc-defg-hij");
+ }
+
+ #[test]
+ fn google_calendar_event_preserves_literal_no_title_summary() {
+ let item = json!({
+ "id": "literal-no-title",
+ "summary": "No Title",
+ "start": { "dateTime": "2026-06-11T09:00:00Z" },
+ "end": { "dateTime": "2026-06-11T09:30:00Z" }
+ });
+
+ let event = google_calendar_event_json(&item, "primary");
+ assert_eq!(event["title"], "No Title");
+ }
+
// -- resolve_base_url ---------------------------------------------------
#[test]