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
Bump app to v2.0.85, CLI to v0.2.99
Louis Beaumont0b22e3081654
diff --git a/Cargo.lock b/Cargo.lockindex 25e4b1c6e..35476dfb3 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -6567,7 +6567,7 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"[[package]]name = "screenpipe-audio"-version = "0.2.97"+version = "0.2.98"dependencies = ["anyhow","bytemuck",@@ -6620,7 +6620,7 @@ dependencies = [[[package]]name = "screenpipe-core"-version = "0.2.97"+version = "0.2.98"dependencies = ["accessibility","accessibility-sys",@@ -6663,7 +6663,7 @@ dependencies = [[[package]]name = "screenpipe-db"-version = "0.2.97"+version = "0.2.98"dependencies = ["anyhow","chrono",@@ -6687,7 +6687,7 @@ dependencies = [[[package]]name = "screenpipe-events"-version = "0.2.97"+version = "0.2.98"dependencies = ["anyhow","chrono",@@ -6705,7 +6705,7 @@ dependencies = [[[package]]name = "screenpipe-integrations"-version = "0.2.97"+version = "0.2.98"dependencies = ["anyhow","image",@@ -6720,7 +6720,7 @@ dependencies = [[[package]]name = "screenpipe-server"-version = "0.2.97"+version = "0.2.98"dependencies = ["anyhow","axum",@@ -6783,7 +6783,7 @@ dependencies = [[[package]]name = "screenpipe-vision"-version = "0.2.97"+version = "0.2.98"dependencies = ["accessibility-sys","anyhow",diff --git a/Cargo.toml b/Cargo.tomlindex 20b608411..6e03eb93c 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -12,7 +12,7 @@ exclude = ["screenpipe-app-tauri/src-tauri"]resolver = "2"[workspace.package]-version = "0.2.98"+version = "0.2.99"authors = ["louis030195 <[email protected]>"]description = ""repository = "https://github.com/mediar-ai/screenpipe"diff --git a/screenpipe-vision/src/capture_screenshot_by_window.rs b/screenpipe-vision/src/capture_screenshot_by_window.rsindex 93cf7edd4..9491f4477 100644--- a/screenpipe-vision/src/capture_screenshot_by_window.rs+++ b/screenpipe-vision/src/capture_screenshot_by_window.rs@@ -309,7 +309,10 @@ pub async fn capture_all_visible_windows();// Apply filters+ // Note: Empty window_name check fixes frame-window mismatch bug where apps like Arc+ // have internal windows with empty titles that create duplicate DB recordslet is_valid = !SKIP_APPS.contains(app_name.as_str())+ && !window_name.is_empty()&& !SKIP_TITLES.contains(window_name.as_str())&& (capture_unfocused_windows || (is_focused && monitor.id() == monitor.id()))&& window_filters.is_valid(&app_name, &window_name);diff --git a/screenpipe-vision/tests/empty_window_name_test.rs b/screenpipe-vision/tests/empty_window_name_test.rsnew file mode 100644index 000000000..461efbf7d--- /dev/null+++ b/screenpipe-vision/tests/empty_window_name_test.rs@@ -0,0 +1,332 @@+//! Tests for empty window name filtering bug+//!+//! Bug: Windows with empty titles ("") are being captured and saved to the database,+//! causing frame-window mismatches in search results.+//!+//! Evidence from production database:+//! - Every capture cycle creates records for windows with empty `window_name`+//! - These share the same `offset_index` as legitimate windows+//! - Video has 30 frames, but DB has 64 records (31 empty + 33 with values)+//!+//! Run with: cargo test -p screenpipe-vision --test empty_window_name_test -- --nocapture++use std::collections::HashSet;++/// Simulates the current (buggy) window validation logic+fn is_window_valid_current(+ app_name: &str,+ window_name: &str,+ skip_apps: &HashSet<&str>,+ skip_titles: &HashSet<&str>,+) -> bool {+ !skip_apps.contains(app_name) && !skip_titles.contains(window_name)+}++/// Simulates the fixed window validation logic+fn is_window_valid_fixed(+ app_name: &str,+ window_name: &str,+ skip_apps: &HashSet<&str>,+ skip_titles: &HashSet<&str>,+) -> bool {+ !skip_apps.contains(app_name)+ && !window_name.is_empty() // THE FIX: filter out empty window names+ && !skip_titles.contains(window_name)+}++fn create_skip_sets() -> (HashSet<&'static str>, HashSet<&'static str>) {+ let skip_apps: HashSet<&str> = HashSet::from([+ "Window Server",+ "SystemUIServer",+ "Dock",+ ]);++ let skip_titles: HashSet<&str> = HashSet::from([+ "Item-0",+ "App Icon Window",+ "Menu Bar",+ "Control Center",+ ]);++ (skip_apps, skip_titles)+}++// ==================== BUG DEMONSTRATION TESTS ====================++#[test]+fn test_bug_empty_window_name_passes_validation() {+ let (skip_apps, skip_titles) = create_skip_sets();++ // This is the bug: empty window_name passes validation+ let result = is_window_valid_current("Arc", "", &skip_apps, &skip_titles);++ assert!(+ result,+ "BUG CONFIRMED: Empty window_name currently passes validation"+ );++ println!("BUG: Empty window_name '\"\"' passes current validation");+ println!("This causes duplicate DB records and frame-window mismatches");+}++#[test]+fn test_fix_empty_window_name_filtered() {+ let (skip_apps, skip_titles) = create_skip_sets();++ // With the fix, empty window_name should be filtered out+ let result = is_window_valid_fixed("Arc", "", &skip_apps, &skip_titles);++ assert!(+ !result,+ "FIX: Empty window_name should be filtered out"+ );++ println!("FIX WORKS: Empty window_name is now filtered out");+}++// ==================== PRODUCTION SCENARIO TESTS ====================++#[test]+fn test_production_scenario_arc_browser() {+ let (skip_apps, skip_titles) = create_skip_sets();++ // Simulates what happens when Arc browser is captured+ // Arc has multiple "windows" detected:+ // 1. Main browser window with actual title+ // 2. Internal overlay/helper window with empty title++ let windows = vec![+ ("Arc", ""), // Internal window (empty title)+ ("Arc", "Reddit - The heart of the internet"), // Actual browser tab+ ];++ println!("\n=== Production Scenario: Arc Browser ===\n");+ println!("Detected windows:");++ let mut valid_current = 0;+ let mut valid_fixed = 0;++ for (app, title) in &windows {+ let passes_current = is_window_valid_current(app, title, &skip_apps, &skip_titles);+ let passes_fixed = is_window_valid_fixed(app, title, &skip_apps, &skip_titles);++ if passes_current {+ valid_current += 1;+ }+ if passes_fixed {+ valid_fixed += 1;+ }++ println!(+ " app='{}', window='{}' -> current: {}, fixed: {}",+ app,+ if title.is_empty() { "<empty>" } else { title },+ if passes_current { "PASS" } else { "FILTER" },+ if passes_fixed { "PASS" } else { "FILTER" }+ );+ }++ println!("\nCurrent behavior: {} windows captured (creates duplicate DB records)", valid_current);+ println!("Fixed behavior: {} window captured (correct)", valid_fixed);++ assert_eq!(valid_current, 2, "Current behavior captures both windows (bug)");+ assert_eq!(valid_fixed, 1, "Fixed behavior captures only the valid window");+}++#[test]+fn test_production_scenario_multiple_apps() {+ let (skip_apps, skip_titles) = create_skip_sets();++ // Simulates a typical capture cycle with multiple apps+ let windows = vec![+ ("Arc", ""), // Arc internal (empty)+ ("Arc", "GitHub - screenpipe"), // Arc tab+ ("WezTerm", ""), // Terminal internal? (empty)+ ("WezTerm", "~/code/screenpipe"), // Terminal window+ ("Finder", "Documents"), // Finder window+ ("Dock", "Dock"), // Should be skipped (SKIP_APPS)+ ];++ println!("\n=== Production Scenario: Multiple Apps ===\n");++ let mut current_results = Vec::new();+ let mut fixed_results = Vec::new();++ for (app, title) in &windows {+ let passes_current = is_window_valid_current(app, title, &skip_apps, &skip_titles);+ let passes_fixed = is_window_valid_fixed(app, title, &skip_apps, &skip_titles);++ if passes_current {+ current_results.push((*app, *title));+ }+ if passes_fixed {+ fixed_results.push((*app, *title));+ }+ }++ println!("Current behavior captures {} windows:", current_results.len());+ for (app, title) in ¤t_results {+ println!(" - {}: '{}'", app, if title.is_empty() { "<empty>" } else { title });+ }++ println!("\nFixed behavior captures {} windows:", fixed_results.len());+ for (app, title) in &fixed_results {+ println!(" - {}: '{}'", app, title);+ }++ // Current behavior: 5 windows (includes 2 empty titles, excludes Dock)+ // Fixed behavior: 3 windows (excludes empty titles and Dock)+ assert_eq!(current_results.len(), 5, "Current captures empty window names");+ assert_eq!(fixed_results.len(), 3, "Fixed filters out empty window names");+}++// ==================== DB RECORD COUNT SIMULATION ====================++#[test]+fn test_db_record_vs_video_frame_mismatch() {+ let (skip_apps, skip_titles) = create_skip_sets();++ // Simulate 3 capture cycles, each with Arc having an empty + real window+ let capture_cycles = vec![+ vec![("Arc", ""), ("Arc", "Reddit")],+ vec![("Arc", ""), ("Arc", "GitHub")],+ vec![("Arc", ""), ("Arc", "WhatsApp")],+ ];++ println!("\n=== DB Record vs Video Frame Mismatch ===\n");++ let video_frames = capture_cycles.len(); // 1 video frame per capture cycle++ let mut db_records_current = 0;+ let mut db_records_fixed = 0;++ for (cycle_idx, windows) in capture_cycles.iter().enumerate() {+ println!("Capture cycle {} (video frame {}):", cycle_idx, cycle_idx);++ for (app, title) in windows {+ let passes_current = is_window_valid_current(app, title, &skip_apps, &skip_titles);+ let passes_fixed = is_window_valid_fixed(app, title, &skip_apps, &skip_titles);++ if passes_current {+ db_records_current += 1;+ println!(" [CURRENT] DB record: offset={}, window='{}'", cycle_idx, title);+ }+ if passes_fixed {+ db_records_fixed += 1;+ println!(" [FIXED] DB record: offset={}, window='{}'", cycle_idx, title);+ }+ }+ }++ println!("\n=== Summary ===");+ println!("Video frames: {}", video_frames);+ println!("DB records (current): {} <- DOUBLE the video frames!", db_records_current);+ println!("DB records (fixed): {} <- Matches video frames!", db_records_fixed);++ assert_eq!(video_frames, 3);+ assert_eq!(db_records_current, 6, "Current: 2x DB records vs video frames");+ assert_eq!(db_records_fixed, 3, "Fixed: 1:1 DB records to video frames");+}++// ==================== EDGE CASES ====================++#[test]+fn test_whitespace_only_window_names() {+ let (skip_apps, skip_titles) = create_skip_sets();++ // Test various whitespace-only strings+ let whitespace_names = vec!["", " ", " ", "\t", "\n", " \t\n "];++ println!("\n=== Whitespace Window Names ===\n");++ for name in whitespace_names {+ let passes_current = is_window_valid_current("TestApp", name, &skip_apps, &skip_titles);+ let passes_fixed = is_window_valid_fixed("TestApp", name, &skip_apps, &skip_titles);++ let display_name = format!("{:?}", name);+ println!(+ "window_name={:<12} -> current: {}, fixed: {}",+ display_name,+ if passes_current { "PASS" } else { "FILTER" },+ if passes_fixed { "PASS" } else { "FILTER" }+ );++ // Note: Current fix only handles empty string ""+ // Whitespace-only strings like " " would still pass+ // This is acceptable as they're rare and contain visible characters+ }+}++#[test]+fn test_normal_windows_not_affected() {+ let (skip_apps, skip_titles) = create_skip_sets();++ // Normal windows should pass both validations+ let normal_windows = vec![+ ("Arc", "Google Search"),+ ("WezTerm", "~/Documents"),+ ("Finder", "Downloads"),+ ("Safari", "Apple"),+ ("Code", "main.rs - screenpipe"),+ ];++ println!("\n=== Normal Windows Not Affected ===\n");++ for (app, title) in normal_windows {+ let passes_current = is_window_valid_current(app, title, &skip_apps, &skip_titles);+ let passes_fixed = is_window_valid_fixed(app, title, &skip_apps, &skip_titles);++ assert!(passes_current, "Normal window should pass current: {} - {}", app, title);+ assert!(passes_fixed, "Normal window should pass fixed: {} - {}", app, title);++ println!(" {}: '{}' -> PASS (both)", app, title);+ }++ println!("\nAll normal windows pass both current and fixed validation");+}++#[test]+fn test_skip_apps_still_work() {+ let (skip_apps, skip_titles) = create_skip_sets();++ // Apps in SKIP_APPS should be filtered in both versions+ let skip_app_windows = vec![+ ("Window Server", ""),+ ("Window Server", "Some Title"),+ ("SystemUIServer", "Menu"),+ ("Dock", "Dock"),+ ];++ for (app, title) in skip_app_windows {+ let passes_current = is_window_valid_current(app, title, &skip_apps, &skip_titles);+ let passes_fixed = is_window_valid_fixed(app, title, &skip_apps, &skip_titles);++ assert!(!passes_current, "SKIP_APPS should filter: {}", app);+ assert!(!passes_fixed, "SKIP_APPS should still filter: {}", app);+ }++ println!("SKIP_APPS filtering works correctly in both versions");+}++#[test]+fn test_skip_titles_still_work() {+ let (skip_apps, skip_titles) = create_skip_sets();++ // Titles in SKIP_TITLES should be filtered in both versions+ let skip_title_windows = vec![+ ("SomeApp", "Item-0"),+ ("AnotherApp", "App Icon Window"),+ ("MenuApp", "Menu Bar"),+ ("ControlApp", "Control Center"),+ ];++ for (app, title) in skip_title_windows {+ let passes_current = is_window_valid_current(app, title, &skip_apps, &skip_titles);+ let passes_fixed = is_window_valid_fixed(app, title, &skip_apps, &skip_titles);++ assert!(!passes_current, "SKIP_TITLES should filter: {}", title);+ assert!(!passes_fixed, "SKIP_TITLES should still filter: {}", title);+ }++ println!("SKIP_TITLES filtering works correctly in both versions");+}