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(updates): respect disabled auto-update on Windows (#3526)

Louis Beaumont8d1ea0fd76b5
diff --git a/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx b/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx
index 226a30357..a58041acb 100644
--- a/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx
+++ b/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx
@@ -485,6 +485,8 @@ let DEFAULT_SETTINGS: Settings = {
port: 11434,
},
updateChannel: "stable",
+ autoUpdate: false,
+ autoUpdatePipes: true,
autoStartEnabled: true,
platform: "unknown",
disabledShortcuts: [],
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/analytics.rs b/apps/screenpipe-app-tauri/src-tauri/src/analytics.rs
index 0a766a893..da24a81ea 100755
--- a/apps/screenpipe-app-tauri/src-tauri/src/analytics.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/analytics.rs
@@ -354,7 +354,7 @@ impl AnalyticsManager {
// Other features
"setting_use_pii_removal": get_bool("usePiiRemoval").unwrap_or(true),
- "setting_auto_update": get_bool("autoUpdate").unwrap_or(true),
+ "setting_auto_update": get_bool("autoUpdate").unwrap_or(false),
"setting_languages_count": get_arr_len("languages"),
})
}
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/store.rs b/apps/screenpipe-app-tauri/src-tauri/src/store.rs
index dabe62995..a093864e4 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/store.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/store.rs
@@ -643,7 +643,7 @@ pub struct SettingsStore {
pub device_id: String,
/// Auto-install updates and restart when a new version is available.
/// When disabled, users must click "update now" in the tray menu.
- #[serde(rename = "autoUpdate", default = "default_true")]
+ #[serde(rename = "autoUpdate", default = "default_false")]
pub auto_update: bool,
/// Auto-update store-installed pipes that haven't been locally modified.
#[serde(rename = "autoUpdatePipes", default = "default_true")]
@@ -699,6 +699,10 @@ fn default_true() -> bool {
true
}
+fn default_false() -> bool {
+ false
+}
+
fn default_overlay_size() -> String {
"small".to_string()
}
@@ -1519,6 +1523,32 @@ mod tests {
const FALLBACK_ENGINE: &str = "whisper-large-v3-turbo-quantized";
+ #[test]
+ fn auto_update_defaults_to_disabled() {
+ assert!(!SettingsStore::default().auto_update);
+ }
+
+ #[test]
+ fn missing_auto_update_deserializes_disabled() {
+ let settings: SettingsStore = serde_json::from_value(json!({
+ "aiPresets": []
+ }))
+ .unwrap();
+
+ assert!(!settings.auto_update);
+ }
+
+ #[test]
+ fn explicit_auto_update_true_is_respected() {
+ let settings: SettingsStore = serde_json::from_value(json!({
+ "aiPresets": [],
+ "autoUpdate": true
+ }))
+ .unwrap();
+
+ assert!(settings.auto_update);
+ }
+
#[test]
fn screenpipe_cloud_falls_back_when_not_logged_in() {
let mut store = SettingsStore::default();
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/updates.rs b/apps/screenpipe-app-tauri/src-tauri/src/updates.rs
index 0a11ffc1a..5f10baff9 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/updates.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/updates.rs
@@ -164,6 +164,27 @@ pub struct PendingUpdateSnapshot {
pub auth_required: bool,
}
+fn auto_update_enabled_from_settings(settings: Result<Option<SettingsStore>, String>) -> bool {
+ settings
+ .ok()
+ .flatten()
+ .map(|settings| settings.auto_update)
+ .unwrap_or(false)
+}
+
+fn load_auto_update_enabled(app: &tauri::AppHandle) -> bool {
+ let settings = SettingsStore::get(app);
+ match &settings {
+ Ok(Some(settings)) => debug!("auto-update setting: {}", settings.auto_update),
+ Ok(None) => warn!("settings missing during update check; auto-update disabled"),
+ Err(err) => warn!(
+ "failed to read settings during update check; auto-update disabled: {}",
+ err
+ ),
+ }
+ auto_update_enabled_from_settings(settings)
+}
+
pub struct UpdatesManager {
interval: Duration,
update_available: Arc<Mutex<bool>>,
@@ -315,11 +336,7 @@ impl UpdatesManager {
auth_required: false,
});
- let auto_update = SettingsStore::get(&self.app)
- .ok()
- .flatten()
- .map(|s| s.auto_update)
- .unwrap_or(false);
+ let auto_update = load_auto_update_enabled(&self.app);
if let Some(ref item) = self.update_menu_item {
item.set_enabled(true)?;
@@ -755,3 +772,36 @@ pub fn start_update_check(
Ok(updates_manager)
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn auto_update_setting_respects_false() {
+ let mut settings = SettingsStore::default();
+ settings.auto_update = false;
+
+ assert!(!auto_update_enabled_from_settings(Ok(Some(settings))));
+ }
+
+ #[test]
+ fn auto_update_setting_respects_true() {
+ let mut settings = SettingsStore::default();
+ settings.auto_update = true;
+
+ assert!(auto_update_enabled_from_settings(Ok(Some(settings))));
+ }
+
+ #[test]
+ fn auto_update_setting_fails_closed_when_missing() {
+ assert!(!auto_update_enabled_from_settings(Ok(None)));
+ }
+
+ #[test]
+ fn auto_update_setting_fails_closed_when_unreadable() {
+ assert!(!auto_update_enabled_from_settings(Err(
+ "store unavailable".to_string()
+ )));
+ }
+}