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
chore(owned-browser): make cookie inject path observable in logs
Louis Beaumontfd5f1cf8b237
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/owned_browser.rs b/apps/screenpipe-app-tauri/src-tauri/src/owned_browser.rsindex 9106e2c5e..1ab2640b7 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/owned_browser.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/owned_browser.rs@@ -625,19 +625,35 @@ pub async fn owned_browser_hide(app: AppHandle) -> Result<(), String> {/// without injection.async fn inject_cookies_for_url(app: &AppHandle, url: &url::Url) {let Some(host) = url.host_str() else {+ info!("owned-browser cookies: skipping inject — url has no host");return;};+ info!(host, "owned-browser cookies: pre-navigate inject starting");let cookies = crate::owned_browser_cookies::cookies_for_host(host).await;if cookies.is_empty() {+ info!(+ host,+ "owned-browser cookies: 0 cookies available — navigating without inject \+ (causes: real browser not installed, Keychain denied, or no cookies stored \+ for this host yet)"+ );return;}info!(host,count = cookies.len(),- "owned-browser: injecting cookies before navigate"+ "owned-browser cookies: injecting before navigate");#[cfg(target_os = "macos")]- inject_cookies_macos(app, &cookies).await;+ {+ let n = inject_cookies_macos(app, &cookies).await;+ info!(+ host,+ attempted = cookies.len(),+ injected = n,+ "owned-browser cookies: WKHTTPCookieStore.setCookie completed"+ );+ }#[cfg(not(target_os = "macos"))]let _ = (app, &cookies); // until Windows/Linux injectors land}@@ -651,7 +667,10 @@ async fn inject_cookies_for_url(app: &AppHandle, url: &url::Url) {/// build error is logged and ignored — the navigate proceeds without/// the cookie that failed.#[cfg(target_os = "macos")]-async fn inject_cookies_macos(app: &AppHandle, cookies: &[crate::owned_browser_cookies::Cookie]) {+async fn inject_cookies_macos(+ app: &AppHandle,+ cookies: &[crate::owned_browser_cookies::Cookie],+) -> usize {use cocoa::base::{id, nil};use cocoa::foundation::{NSArray, NSDictionary, NSString};use objc::runtime::Object;@@ -763,13 +782,17 @@ async fn inject_cookies_macos(app: &AppHandle, cookies: &[crate::owned_browser_clet _ = tx.send(injected);});- match rx.await {- Ok(n) => debug!(injected = n, "owned-browser: cookies pushed to WKHTTPCookieStore"),- Err(_) => warn!("owned-browser: cookie inject channel closed"),- }+ let injected = match rx.await {+ Ok(n) => n,+ Err(_) => {+ warn!("owned-browser: cookie inject channel closed");+ 0+ }+ };// Tiny grace period so the WKHTTPCookieStore's own async commit to// its on-disk store flushes before the upcoming navigate fires its// request. Empirically <10ms; 50 covers slow startups.tokio::time::sleep(std::time::Duration::from_millis(50)).await;+ injected}diff --git a/apps/screenpipe-app-tauri/src-tauri/src/owned_browser_cookies.rs b/apps/screenpipe-app-tauri/src-tauri/src/owned_browser_cookies.rsindex 6ccb40980..6c277530b 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/owned_browser_cookies.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/owned_browser_cookies.rs@@ -181,7 +181,12 @@ async fn cookies_for_host_impl(host: &str) -> Vec<Cookie> {out.append(&mut c);}Err(e) => {- debug!(source = source.name, "owned-browser cookies: skip — {e}");+ // Info-level so we can see WHY each browser was+ // skipped without a rebuild — most "0 cookies"+ // reports turn out to be (a) browser not+ // installed, (b) Keychain prompt denied, or (c)+ // sqlite open failure on a locked file.+ info!(source = source.name, "owned-browser cookies: skip — {e}");}}}