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(app): stop shortcut-reminder error loop + surface S3 upload reason

Louis Beaumontc68c5c8cdfef
diff --git a/apps/screenpipe-app-tauri/app/shortcut-reminder/page.tsx b/apps/screenpipe-app-tauri/app/shortcut-reminder/page.tsx
index 9c2895009..094dcb1be 100644
--- a/apps/screenpipe-app-tauri/app/shortcut-reminder/page.tsx
+++ b/apps/screenpipe-app-tauri/app/shortcut-reminder/page.tsx
@@ -9,7 +9,7 @@ import { listen } from "@tauri-apps/api/event";
import { getCurrentWindow } from "@tauri-apps/api/window";
import { invoke } from "@tauri-apps/api/core";
import { localFetch } from "@/lib/api";
-import { readTextFile } from "@tauri-apps/plugin-fs";
+import { exists, readTextFile } from "@tauri-apps/plugin-fs";
import { homeDir } from "@tauri-apps/api/path";
import posthog from "posthog-js";
import { usePlatform } from "@/lib/hooks/use-platform";
@@ -122,7 +122,13 @@ export default function ShortcutReminderPage() {
const loadShortcutsFromFile = useCallback(async () => {
try {
const home = await homeDir();
- const raw = await readTextFile(`${home}/.screenpipe/store.bin`);
+ const path = `${home}/.screenpipe/store.bin`;
+ // Missing file is a valid first-run state (defaults will be applied by caller).
+ // Silently skipping avoids a webview→Rust error roundtrip per call, which
+ // compounded into thousands of log lines when the store-change listener fires.
+ if (!(await exists(path))) return;
+ const raw = await readTextFile(path);
+ if (!raw) return;
const data = JSON.parse(raw);
const settings = data?.settings;
if (settings?.showScreenpipeShortcut) {
@@ -139,7 +145,10 @@ export default function ShortcutReminderPage() {
setOverlayScale(s === "large" ? 2 : s === "medium" ? 1.5 : 1);
}
} catch (e) {
- console.error("Failed to read shortcuts from store file:", e);
+ // Error objects don't survive JSON.stringify — extract the human-readable parts
+ // so the report isn't just "{}".
+ const msg = e instanceof Error ? `${e.name}: ${e.message}` : String(e);
+ console.error("Failed to read shortcuts from store file:", msg);
}
}, []);
@@ -155,17 +164,25 @@ export default function ShortcutReminderPage() {
setSearchShortcut(prev => prev ?? (isMac ? "⌘⌃K" : "Alt+K"));
});
- // Also listen for store changes via plugin (for live updates when user changes shortcuts)
+ // Also listen for store changes via plugin (for live updates when user changes shortcuts).
+ // Coalesce bursts of settings writes (every keystroke in some flows) into a single read.
let unlistenStore: (() => void) | null = null;
- getStore().then(store => {
- store.onKeyChange("settings", () => {
+ let reloadTimer: ReturnType<typeof setTimeout> | null = null;
+ const scheduleReload = () => {
+ if (reloadTimer) clearTimeout(reloadTimer);
+ reloadTimer = setTimeout(() => {
+ reloadTimer = null;
loadShortcutsFromFile();
- }).then(unlisten => {
+ }, 250);
+ };
+ getStore().then(store => {
+ store.onKeyChange("settings", scheduleReload).then(unlisten => {
unlistenStore = unlisten;
});
}).catch(() => {});
return () => {
+ if (reloadTimer) clearTimeout(reloadTimer);
unlistenStore?.();
};
}, [isLoading, isMac, loadShortcutsFromFile]);
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/main.rs b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
index bc6cab381..64d93d274 100755
--- a/apps/screenpipe-app-tauri/src-tauri/src/main.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -292,11 +292,17 @@ async fn upload_file_to_s3(file_path: &str, signed_url: &str) -> Result<bool, St
.await
{
Ok(response) => {
- if response.status().is_success() {
+ let status = response.status();
+ if status.is_success() {
debug!("Successfully uploaded file on attempt {}", attempt);
return Ok(true);
}
- last_error = format!("Upload failed with status: {}", response.status());
+ // Surface the response body — S3/Supabase wraps the reason for
+ // 400/403 (signed URL expired, content-type mismatch, etc.) in
+ // an XML payload that we'd otherwise discard.
+ let body = response.text().await.unwrap_or_default();
+ let snippet: String = body.chars().take(500).collect();
+ last_error = format!("Upload failed with status: {} body: {}", status, snippet);
error!("{} (attempt {}/{})", last_error, attempt, max_retries);
}
Err(e) => {