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

chore: push local changes from parallel agents

Louis Beaumont81c34214ffe0
diff --git a/apps/screenpipe-app-tauri/components/standalone-chat.tsx b/apps/screenpipe-app-tauri/components/standalone-chat.tsx
index 777306587..4f12e895c 100644
--- a/apps/screenpipe-app-tauri/components/standalone-chat.tsx
+++ b/apps/screenpipe-app-tauri/components/standalone-chat.tsx
@@ -2236,25 +2236,23 @@ export function StandaloneChat({ className }: { className?: string } = {}) {
piContentBlocksRef.current = [];
piThinkingStartRef.current = null;
piMessageIdRef.current = msgId;
- setMessages((prev) => {
- if (prev.some((m) => m.id === msgId)) return prev;
- return [
- ...prev,
- {
- id: `pipe-user-${executionId}`,
- role: "user" as const,
- content: `Watching pipe: ${pipeName}`,
- timestamp: Date.now(),
- },
- {
- id: msgId,
- role: "assistant" as const,
- content: "",
- timestamp: Date.now(),
- contentBlocks: [],
- },
- ];
- });
+ // Clear previous messages and reset conversation so pipe history doesn't bleed across pipes
+ setConversationId(null);
+ setMessages([
+ {
+ id: `pipe-user-${executionId}`,
+ role: "user" as const,
+ content: `Watching pipe: ${pipeName}`,
+ timestamp: Date.now(),
+ },
+ {
+ id: msgId,
+ role: "assistant" as const,
+ content: "",
+ timestamp: Date.now(),
+ contentBlocks: [],
+ },
+ ]);
setIsStreaming(true);
// Poll immediately in case execution already finished before we started listening
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/sync.rs b/apps/screenpipe-app-tauri/src-tauri/src/sync.rs
index 43a726b84..a21141f87 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/sync.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/sync.rs
@@ -5,6 +5,7 @@ use base64::{engine::general_purpose::STANDARD as BASE64, Engine};
use chrono::Utc;
use screenpipe_core::sync::{SyncClientConfig, SyncManager};
use serde::{Deserialize, Serialize};
+use sha2::Digest;
use std::sync::Arc;
use tauri::{AppHandle, State};
use tokio::sync::RwLock;
@@ -441,26 +442,7 @@ pub async fn lock_sync(app: AppHandle, state: State<'_, SyncState>) -> Result<()
/// Auto-start cloud sync on app launch if previously enabled.
/// Called from main.rs during startup.
pub async fn auto_start_sync(app: &AppHandle, state: &SyncState) {
- let settings = match CloudSyncSettingsStore::get(app) {
- Ok(Some(s)) if s.enabled && !s.encrypted_password.is_empty() => s,
- _ => return,
- };
-
- let password = match BASE64.decode(&settings.encrypted_password) {
- Ok(bytes) => match String::from_utf8(bytes) {
- Ok(p) => p,
- Err(_) => {
- warn!("cloud sync: saved password is not valid UTF-8");
- return;
- }
- },
- Err(_) => {
- warn!("cloud sync: saved password is not valid base64");
- return;
- }
- };
-
- // Get auth token from settings
+ // Get user settings first — needed for both stored-password and auto-derive paths
let fresh_settings = match SettingsStore::get(app) {
Ok(Some(s)) => s,
_ => {
@@ -470,13 +452,60 @@ pub async fn auto_start_sync(app: &AppHandle, state: &SyncState) {
};
let token = match fresh_settings.user.token {
- Some(t) if !t.is_empty() => t,
+ Some(ref t) if !t.is_empty() => t.clone(),
_ => {
info!("cloud sync: no auth token, skipping auto-start");
return;
}
};
+ let password = match CloudSyncSettingsStore::get(app) {
+ Ok(Some(s)) if s.enabled && !s.encrypted_password.is_empty() => {
+ // Use stored password
+ match BASE64.decode(&s.encrypted_password) {
+ Ok(bytes) => match String::from_utf8(bytes) {
+ Ok(p) => p,
+ Err(_) => {
+ warn!("cloud sync: saved password is not valid UTF-8");
+ return;
+ }
+ },
+ Err(_) => {
+ warn!("cloud sync: saved password is not valid base64");
+ return;
+ }
+ }
+ }
+ _ => {
+ // No stored password — auto-derive from user ID if Pro subscriber
+ let is_pro = fresh_settings.user.cloud_subscribed == Some(true);
+ let user_id = fresh_settings.user.id.as_ref().filter(|id| !id.is_empty());
+
+ match (is_pro, user_id) {
+ (true, Some(uid)) => {
+ info!("cloud sync auto-start: no stored password, deriving from user ID");
+ let input = format!("{}screenpipe-cloud-sync-v1", uid);
+ let derived = format!("{:x}", sha2::Sha256::digest(input.as_bytes()));
+
+ // Save so next restart uses stored password path
+ let encoded = BASE64.encode(derived.as_bytes());
+ let store = CloudSyncSettingsStore {
+ enabled: true,
+ encrypted_password: encoded,
+ };
+ if let Err(e) = store.save(app) {
+ warn!("cloud sync auto-start: failed to save derived password: {}", e);
+ }
+
+ derived
+ }
+ _ => {
+ return;
+ }
+ }
+ }
+ };
+
let device_name = hostname::get()
.map(|h| h.to_string_lossy().to_string())
.unwrap_or_else(|_| "Unknown".to_string());