Fix/graph recall rebind 281#295
Open
sshekhar563 wants to merge 3 commits into
Open
Conversation
Resolves qbtrix#281 MemoryManager.from_dict rebuilds the graph but never updated the RecallEngine reference, causing graph-augmented recall to silently degrade by querying an empty graph on restored souls.
Validates that MemoryManager.from_dict properly rewires the recall engine's graph reference after deserialization.
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.
Description
This PR resolves Issue #281 where graph-augmented recall silently degraded after a Soul was restored from its state.
The Bug
During initialization (
MemoryManager.__init__), theRecallEnginewas instantiated with a reference to an emptyKnowledgeGraph.When
MemoryManager.from_dict()restored a state, it completely rebuilt the graph and reboundedmanager._graph, but themanager._recall_enginecontinued holding onto the old, empty graph. Because of this stale reference, graph-augmented recall returned empty results for restored souls, even while new observations mutated the new graph correctly.The Fix
from_dict()immediately after theKnowledgeGraphis restored:manager._recall_engine._graph = manager._graph..model_validateso they do not suffer from this rebinding hazard).Testing Added
test_from_dict_rewires_recall_engine_graphtotests/test_memory/test_memory.py.restored._recall_engine._graph is restored._graphafter callingfrom_dict.Fixes #281