From 82b244b42be8b751d58a205205f161ed47a6c653 Mon Sep 17 00:00:00 2001 From: siddseethepalli Date: Sat, 14 Feb 2026 17:45:15 +0000 Subject: [PATCH] Don't mark history loaded when skipping late history_response When a user sends a message before history_response arrives, populateFromHistory() returned early but still set isHistoryLoaded = true. This prevented ThreadManager.loadHistoryForActiveThreadIfNeeded() from ever retrying, permanently losing prior messages in the UI for that thread. Leave isHistoryLoaded = false on the early-return path so the next tab switch can re-request history. Co-Authored-By: Claude Opus 4.6 --- .../macos/vellum-assistant/Features/Chat/ChatViewModel.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/clients/macos/vellum-assistant/Features/Chat/ChatViewModel.swift b/clients/macos/vellum-assistant/Features/Chat/ChatViewModel.swift index 407ef00486f..1f02328bcfd 100644 --- a/clients/macos/vellum-assistant/Features/Chat/ChatViewModel.swift +++ b/clients/macos/vellum-assistant/Features/Chat/ChatViewModel.swift @@ -1017,7 +1017,10 @@ final class ChatViewModel: ObservableObject { func populateFromHistory(_ historyMessages: [HistoryResponseMessage.HistoryMessageItem]) { let hasUserSentMessages = messages.contains { $0.role == .user } if hasUserSentMessages { - isHistoryLoaded = true + // Don't set isHistoryLoaded here — the user sent a message before + // history arrived, so we skipped populating. Leaving the flag false + // allows ThreadManager.loadHistoryForActiveThreadIfNeeded() to + // retry on the next tab switch. return }