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): don't mark the previous answer as live during the pre-token gap (#4703 follow-up) (#4786)

Louis Beaumontd8ddf0201214
diff --git a/apps/screenpipe-app-tauri/components/chat/standalone/chat-message-list.tsx b/apps/screenpipe-app-tauri/components/chat/standalone/chat-message-list.tsx
index 47c528343..78751108a 100644
--- a/apps/screenpipe-app-tauri/components/chat/standalone/chat-message-list.tsx
+++ b/apps/screenpipe-app-tauri/components/chat/standalone/chat-message-list.tsx
@@ -102,9 +102,22 @@ export function ChatMessageList({
const renderItems = buildCollapsedSteerRenderItems(visibleMessages, {
canCollapseSteerWork: !isLoading && !isStreaming && !activeSourceFooterMessageId,
});
+ // Fall back to the newest visible assistant message — but only when
+ // it is also the newest assistant message overall. Right after a
+ // send, the fresh assistant row is still the invisible
+ // "Processing..." placeholder (filtered above), so the newest
+ // *visible* assistant is the previous turn's completed answer;
+ // marking that one live would hide its action bar and tick a bogus
+ // "Working for …" header on it until the first token arrives.
+ const lastVisibleAssistantId = [...visibleMessages]
+ .reverse()
+ .find((candidate) => candidate.role === "assistant")?.id;
+ const lastAssistantId = [...messages]
+ .reverse()
+ .find((candidate) => candidate.role === "assistant")?.id;
const activeAssistantMessageId =
activeSourceFooterMessageId ??
- [...visibleMessages].reverse().find((candidate) => candidate.role === "assistant")?.id;
+ (lastVisibleAssistantId === lastAssistantId ? lastVisibleAssistantId : undefined);
return renderItems.map((item) => {
if (item.type === "collapsed-steer-work") {