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: auto-retry first Pi prompt instead of silently dropping it
Louis Beaumont8b32f679a742
diff --git a/apps/screenpipe-app-tauri/components/standalone-chat.tsx b/apps/screenpipe-app-tauri/components/standalone-chat.tsxindex 2587f4bb2..ea5b09e06 100644--- a/apps/screenpipe-app-tauri/components/standalone-chat.tsx+++ b/apps/screenpipe-app-tauri/components/standalone-chat.tsx@@ -926,6 +926,7 @@ export function StandaloneChat({ className }: { className?: string } = {}) {const piMessageIdRef = useRef<string | null>(null);const piContentBlocksRef = useRef<ContentBlock[]>([]);const piStartInFlightRef = useRef(false);+ const piFirstCallRetried = useRef(false);const piStoppedIntentionallyRef = useRef(false);const piCrashCountRef = useRef(0);const piLastCrashRef = useRef(0);@@ -2010,11 +2011,18 @@ export function StandaloneChat({ className }: { className?: string } = {}) {}} else if (data.type === "response" && data.success === false) {const errorStr = data.error || "Unknown error";- // Suppress Pi agent first-call bug (pi-mono#2461) — the warmup- // prompt absorbs this crash, but the error event still fires.- // Pi auto-retries and the next call works.+ // Pi agent first-call bug (pi-mono#2461) — first RPC prompt crashes.+ // Auto-retry the same prompt once. The second call works.if (errorStr.includes("startsWith") || errorStr.includes("text.startsWith")) {- console.warn("[Pi] suppressing known first-call bug:", errorStr);+ console.warn("[Pi] first-call bug hit, auto-retrying prompt:", errorStr);+ if (piMessageIdRef.current && !piFirstCallRetried.current) {+ piFirstCallRetried.current = true;+ // Re-send the last prompt+ const lastUserMsg = messages.findLast(m => m.role === "user");+ if (lastUserMsg?.content) {+ commands.piPrompt(PI_CHAT_SESSION, lastUserMsg.content, null).catch(() => {});+ }+ }return;}if (piMessageIdRef.current) {