fix: sync btw messages to in-memory caches to preserve conversation context#187
Merged
GCWing merged 1 commit intoGCWing:mainfrom Mar 19, 2026
Merged
fix: sync btw messages to in-memory caches to preserve conversation context#187GCWing merged 1 commit intoGCWing:mainfrom
GCWing merged 1 commit intoGCWing:mainfrom
Conversation
When a /btw side question completes, persist_btw_turn was only saving DialogTurnData to disk but not syncing messages to MessageHistoryManager and CompressionManager in-memory caches. This caused subsequent messages in btw sessions to lose conversation context, making the session appear empty. Now we add the user and assistant messages to both memory caches after persisting, ensuring context is available for follow-up questions. Fixes GCWing#182
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.
Fix: BTW continue flow loses previous conversation context
Problem
When using the
/btwconversation flow and then asking a follow-up question, the assistant behaves as if the previous conversation does not exist. The follow-up appears to start from a fresh context instead of continuing the existing conversation.Root Cause
In
persist_btw_turnmethod (session_manager.rs), when a/btwconversation completes, although theDialogTurnDatawas saved to persistence layer, the user message and assistant response were not synced to the in-memory caches (MessageHistoryManagerandCompressionManager).When users send follow-up messages in the btw session,
get_context_messagescouldn't retrieve previous conversation context, making the conversation appear as a new empty session.Fix
After persisting the turn to disk, sync the user message and assistant response to both memory caches.
Testing
cargo check -p bitfun-corepassesFixes #182