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
fix: memories pipeline silently stopped updating (#3018)
Ansh Groverb8a1ae6c23c2
diff --git a/apps/screenpipe-app-tauri/components/pipe-store.tsx b/apps/screenpipe-app-tauri/components/pipe-store.tsxindex 32dd2304b..f1957fb62 100644--- a/apps/screenpipe-app-tauri/components/pipe-store.tsx+++ b/apps/screenpipe-app-tauri/components/pipe-store.tsx@@ -333,27 +333,25 @@ export function PipeStoreView() {.catch(() => setInstalledCount(0));}, []);- // Read initial tab from URL param (e.g. ?section=pipes&tab=discover)- // Default to "discover" when user has no pipes installed- const [activeTab, setActiveTab] = useState<"discover" | "my-pipes">(() => {- if (typeof window !== "undefined") {- const params = new URLSearchParams(window.location.search);- if (params.get("tab") === "discover") return "discover";- if (params.get("tab") === "my-pipes") return "my-pipes";+ const [activeTab, setActiveTab] = useState<"discover" | "my-pipes">("my-pipes");++ // Read ?tab= from URL after mount, then strip it so it doesn't persist+ useEffect(() => {+ const params = new URLSearchParams(window.location.search);+ const tab = params.get("tab");+ if (tab === "discover") setActiveTab("discover");+ else if (tab === "my-pipes") setActiveTab("my-pipes");+ if (tab) {+ params.delete("tab");+ window.history.replaceState({}, "", `${window.location.pathname}?${params}`);}- return "my-pipes";- });+ }, []);// Once we know installed count, switch new users to discoveruseEffect(() => {if (installedCount !== null && installedCount === 0) {- // Only auto-switch if no explicit tab param was set- if (typeof window !== "undefined") {- const params = new URLSearchParams(window.location.search);- if (!params.get("tab")) {- setActiveTab("discover");- }- }+ const params = new URLSearchParams(window.location.search);+ if (!params.get("tab")) setActiveTab("discover");}}, [installedCount]);@@ -408,6 +406,18 @@ function DiscoverView({ onInstalled }: { onInstalled?: () => void }) {const [loading, setLoading] = useState(true);const [searchQuery, setSearchQuery] = useState("");const [debouncedQuery, setDebouncedQuery] = useState("");++ // Prefill search from ?q= URL param after mount, then strip it so it doesn't persist+ useEffect(() => {+ const params = new URLSearchParams(window.location.search);+ const q = params.get("q") ?? "";+ if (q) {+ setSearchQuery(q);+ setDebouncedQuery(q);+ params.delete("q");+ window.history.replaceState({}, "", `${window.location.pathname}?${params}`);+ }+ }, []);const [category, setCategory] = useState("All");const [sort, setSort] = useState("popular");@@ -736,12 +746,13 @@ function DiscoverView({ onInstalled }: { onInstalled?: () => void }) {}// First-visit banner — show once, dismiss permanently- const [showWelcome, setShowWelcome] = useState(() => {- if (typeof window !== "undefined") {- return !localStorage.getItem("screenpipe:pipes-welcome-dismissed");+ // Initialize false to match server render, set true after mount if not dismissed+ const [showWelcome, setShowWelcome] = useState(false);+ useEffect(() => {+ if (!localStorage.getItem("screenpipe:pipes-welcome-dismissed")) {+ setShowWelcome(true);}- return true;- });+ }, []);const dismissWelcome = () => {setShowWelcome(false);diff --git a/apps/screenpipe-app-tauri/components/settings/memories-section.tsx b/apps/screenpipe-app-tauri/components/settings/memories-section.tsxindex 5d96b6100..037303354 100644--- a/apps/screenpipe-app-tauri/components/settings/memories-section.tsx+++ b/apps/screenpipe-app-tauri/components/settings/memories-section.tsx@@ -27,6 +27,7 @@ import {Pencil,ChevronDown,ChevronUp,+ AlertCircle,} from "lucide-react";import { Input } from "@/components/ui/input";import { MemoizedReactMarkdown } from "@/components/markdown";@@ -267,6 +268,28 @@ export function MemoriesSection() {fetchPage(0, false);}, [sortField, sortDir]); // eslint-disable-line react-hooks/exhaustive-deps+ // Separate state for the newest memory timestamp — used only for the stale warning.+ // Kept outside fetchPage so the background poll can update it without resetting the list.+ const [newestCreatedAt, setNewestCreatedAt] = useState<string | null>(null);+ const [bgTotal, setBgTotal] = useState<number | null>(null);++ // Silent background check every 30s — fetches only 1 record to detect new memories.+ // Updates the stale-warning state without touching the displayed list or showing a spinner.+ useEffect(() => {+ const check = async () => {+ try {+ const res = await localFetch("/memories?limit=1&order_by=created_at&order_dir=desc");+ if (!res.ok) return;+ const data: MemoryListResponse = await res.json();+ setBgTotal(data.pagination.total);+ if (data.data[0]) setNewestCreatedAt(data.data[0].created_at);+ } catch {}+ };+ check();+ const id = setInterval(check, 30_000);+ return () => clearInterval(id);+ }, []);+// infinite scroll via IntersectionObserveruseEffect(() => {const sentinel = sentinelRef.current;@@ -419,12 +442,38 @@ export function MemoriesSection() {}};+ // Stale warning: use the background-polled newest timestamp so it auto-clears+ // without disrupting the displayed list.+ const staleDays =+ newestCreatedAt && (bgTotal ?? total) > 0+ ? Math.floor((Date.now() - new Date(newestCreatedAt).getTime()) / 86400000)+ : 0;+ const isStale = staleDays >= 1;+return (<div className="space-y-4 h-full flex flex-col"><p className="text-muted-foreground text-sm mb-4">facts and preferences the AI has learned from your activity</p>+ {/* stale memories warning */}+ {isStale && (+ <div className="flex items-start gap-2 rounded-md border border-yellow-500/30 bg-yellow-500/5 px-3 py-2 text-xs text-yellow-600 dark:text-yellow-400">+ <AlertCircle className="h-3.5 w-3.5 mt-0.5 shrink-0" />+ <span>+ memories haven't updated in {staleDays} day{staleDays !== 1 ? "s" : ""}.+ check that a memory-writing pipe is installed and enabled —{" "}+ <a+ href="?section=pipes&tab=discover&q=memory"+ className="underline hover:opacity-80 transition-opacity"+ >+ browse memory pipes+ </a>+ .+ </span>+ </div>+ )}+{/* search bar + add button */}<div className="flex items-center gap-2"><div className="relative flex-1">diff --git a/crates/screenpipe-core/src/pipes/mod.rs b/crates/screenpipe-core/src/pipes/mod.rsindex 04c150388..6afc6f826 100644--- a/crates/screenpipe-core/src/pipes/mod.rs+++ b/crates/screenpipe-core/src/pipes/mod.rs@@ -3295,13 +3295,31 @@ impl PipeManager {),}} else {- (- config.model.clone(),- config.provider.clone(),- None,- None,- None,- )+ // No preset in pipe config — use the user's default preset+ // so scheduled pipes respect the user's AI settings instead+ // of silently falling through to screenpipe cloud.+ match resolve_preset(&pipes_dir, "default") {+ Some(resolved) => {+ info!(+ "scheduler: pipe '{}' has no preset configured, using user's default preset → model={}, provider={:?}",+ name, resolved.model, resolved.provider+ );+ (+ resolved.model,+ resolved.provider,+ resolved.url,+ resolved.api_key,+ resolved.prompt,+ )+ }+ None => (+ config.model.clone(),+ config.provider.clone(),+ None,+ None,+ None,+ ),+ }};// Pre-configure pi with the pipe's providerdiff --git a/crates/screenpipe-core/src/pipes/preset_fallback.rs b/crates/screenpipe-core/src/pipes/preset_fallback.rsindex e5b644bc4..77493a1ae 100644--- a/crates/screenpipe-core/src/pipes/preset_fallback.rs+++ b/crates/screenpipe-core/src/pipes/preset_fallback.rs@@ -325,8 +325,17 @@ impl PresetFallbackRegistry {for (id, breaker) in state.presets.iter_mut() {if breaker.state == BreakerState::Open && now >= breaker.cooldown_until {- breaker.state = BreakerState::HalfOpen;- info!("startup recovery: preset '{}' moved to half-open", id);+ // Cooldown expired >24h ago — fully reset so a prolonged outage+ // (e.g. auth drift) doesn't leave the breaker stuck indefinitely.+ if now.saturating_sub(breaker.cooldown_until) > 86400 {+ breaker.state = BreakerState::Closed;+ breaker.failure_count = 0;+ breaker.success_streak = 0;+ info!("startup recovery: preset '{}' reset to closed (stale open >24h)", id);+ } else {+ breaker.state = BreakerState::HalfOpen;+ info!("startup recovery: preset '{}' moved to half-open", id);+ }changed = true;}// Sanity: if cooldown_until is more than 24h in the future, reset it