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(chat): await initial conversation persistence

Louis Beaumont356e351395fd
diff --git a/apps/screenpipe-app-tauri/components/chat/standalone/hooks/use-pi-send-transport.ts b/apps/screenpipe-app-tauri/components/chat/standalone/hooks/use-pi-send-transport.ts
index b702203a9..d8169e020 100644
--- a/apps/screenpipe-app-tauri/components/chat/standalone/hooks/use-pi-send-transport.ts
+++ b/apps/screenpipe-app-tauri/components/chat/standalone/hooks/use-pi-send-transport.ts
@@ -315,7 +315,10 @@ export function usePiSendTransport(options: PiSendTransportOptions) {
setMessages((prev) => [...prev, newUserMessage]);
// conversationId state hasn't committed yet this tick, so force the
// immediate save under the same id explicitly.
- void saveConversation(nextRowsAfterUserAppend, {
+ // Do not dispatch to the provider until the user turn is durable. Besides
+ // preventing message loss on an immediate quit, this avoids slow WebKit
+ // filesystem work being starved behind a long-running provider request.
+ await saveConversation(nextRowsAfterUserAppend, {
refreshHistory: false,
idOverride: turnSessionId,
});