Repository navigation
fix: keep chat history scoped to each request - #625
Merged
sng-asyncfunc merged 1 commit intoNov 7, 2026
Merged
Conversation
research_chat stored each request's prior turns in rag.memory. Since AsyncFuncAI#619 the RAG object is cached and shared, so turns leaked into other requests and repeated on resend. Build the history from request.messages and remove the now-unused Memory class.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Since #619 reuses the
RAGobject across requests,rag.memorycarries chat turns from one request into the next.MemoryandCustomConversationhad no other users, so they are removed. The<turn>format and the user/assistant pairing rule are unchanged.Evidence
tests/backend/services/test_research_chat.pyruns the realRAGclass and stubs only the embedder, retriever, token count, model config, and streamer.Before:
The third test guards turn order, so it passes both before and after.
After:
The model calls are stubbed. This shows what goes into the prompt, not whether a model would have repeated a leaked conversation in its answer.
Merge Danger
Door: two-way
Blast Radius: chat
Wiki generation also calls
research_chat, but it sends a single message, so its history is empty. No change to_RAG_CACHEor the Deep Research flow.