From c557cf58aa2e1e5879119dd589bca220d98d993b Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Thu, 12 Nov 2026 13:42:03 +0100 Subject: [PATCH] fix: background memory review saves memories from temporary chats (#34263) With the background memory review on, Open WebUI looks back over the chat every few messages (10 by default) to save or update memories, and it did this in temporary chats too. Facts from a temporary chat could end up as memories that stayed after the chat was closed and showed up in later chats. The automatic review now skips temporary chats, so they leave no memories behind unless the user asks for one. Normal chats are reviewed as before, and memories already saved from a temporary chat are not removed. Fixes #34262 --- backend/open_webui/utils/middleware.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index ec0d0c3b9a..c130e94fb2 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -3896,7 +3896,7 @@ async def background_tasks_handler(ctx): except Exception as e: pass - if messages: + if messages and not is_temporary_chat_id(metadata.get('chat_id')): await review_memory_after_turn( request=request, user=user,