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): prevent sync prompt from corrupting chat titles (#3520)

Ansh Grover425295c22d95
diff --git a/apps/screenpipe-app-tauri/components/chat-sidebar.tsx b/apps/screenpipe-app-tauri/components/chat-sidebar.tsx
index fd591ec1d..d25609eb1 100644
--- a/apps/screenpipe-app-tauri/components/chat-sidebar.tsx
+++ b/apps/screenpipe-app-tauri/components/chat-sidebar.tsx
@@ -1214,11 +1214,16 @@ function Section({
</span>
)}
</button>
- {!collapsed && (
- <div className={bodyClassName} onScroll={onBodyScroll}>
+ <div
+ className={cn(
+ "grid transition-[grid-template-rows] duration-200 ease-in-out",
+ collapsed ? "grid-rows-[0fr]" : "grid-rows-[1fr]"
+ )}
+ >
+ <div className={cn("overflow-hidden", bodyClassName)} onScroll={collapsed ? undefined : onBodyScroll}>
<div className="flex flex-col">{children}</div>
</div>
- )}
+ </div>
</div>
);
}
@@ -1324,7 +1329,7 @@ export function SidebarChatRow({
: "text-muted-foreground"
)}
>
- {session.title || "untitled"}
+ {(session.title?.startsWith("<") ? undefined : session.title) || "untitled"}
</span>
<span className="ml-1 h-4 w-10 shrink-0 relative flex items-center justify-end">
<span
diff --git a/apps/screenpipe-app-tauri/lib/stores/pi-event-router.ts b/apps/screenpipe-app-tauri/lib/stores/pi-event-router.ts
index 24aff2706..6692b5d13 100644
--- a/apps/screenpipe-app-tauri/lib/stores/pi-event-router.ts
+++ b/apps/screenpipe-app-tauri/lib/stores/pi-event-router.ts
@@ -649,7 +649,11 @@ async function persistBackgroundSession(sid: string): Promise<void> {
}
const existing = await loadConversationFile(sid);
- const firstUserMsg = messages.find((m: any) => m.role === "user") as any;
+ // Skip injected <conversation_history> sync prompts — Pi echoes them back
+ // as user events and their first 50 chars would corrupt the title.
+ const firstUserMsg = messages.find(
+ (m: any) => m.role === "user" && !m.content?.startsWith("<conversation_history>")
+ ) as any;
const derivedTitle: string =
firstUserMsg?.content?.slice(0, 50) || "New Chat";
// Prefer a previously-persisted title (user may have renamed it),