fix(memory): Initialize GoalExecutor singleton with username and validate Qdrant deletes #1

Closed
mmintel wants to merge 1 commits from fix-autonomous-memory-purge into main
Owner

This PR addresses the "memory poisoning paradox" during blank_start.

  1. Bug 1: The Initialization Leak (Stale PathMemory)

    • QNavGraph instantiates GoalExecutor.get_instance(device) during startup. Because bot_username wasn't passed, GoalExecutor instantiated the PathMemory component utilizing the default bot_username="" string.
    • This bound PathMemory to the generic collection goap_paths_v1.
    • blank_start wiped the specific collection goap_paths_v1_marisaundmarc, but since the singleton was using goap_paths_v1, it retained the stale memories.
    • Fix: Pre-initialize GoalExecutor.get_instance(device, username) in bot_flow.py before QNavGraph gets built.
  2. Bug 2: The "Poisoned Memory" Paradox in Qdrant Logs

    • Qdrant's SDK .delete() returns success (200 OK) unconditionally — it doesn't care if the document exists. The delete_point method was blindly logging a successful purge whenever the Unlearn mechanic triggered, regardless of whether the vector had actually been deleted by the agent or by blank_start earlier.
    • Fix: Added a client.retrieve(ids=[point_id]) validation check in qdrant_memory.py's delete_point. If the point was wiped by a global blank_start and doesn't exist anymore, it skips the log.
This PR addresses the "memory poisoning paradox" during `blank_start`. 1. **Bug 1: The Initialization Leak (Stale PathMemory)** - `QNavGraph` instantiates `GoalExecutor.get_instance(device)` during startup. Because `bot_username` wasn't passed, `GoalExecutor` instantiated the `PathMemory` component utilizing the default `bot_username=""` string. - This bound `PathMemory` to the generic collection `goap_paths_v1`. - `blank_start` wiped the specific collection `goap_paths_v1_marisaundmarc`, but since the singleton was using `goap_paths_v1`, it retained the stale memories. - **Fix:** Pre-initialize `GoalExecutor.get_instance(device, username)` in `bot_flow.py` *before* `QNavGraph` gets built. 2. **Bug 2: The "Poisoned Memory" Paradox in Qdrant Logs** - Qdrant's SDK `.delete()` returns success (200 OK) unconditionally — it doesn't care if the document exists. The `delete_point` method was blindly logging a successful purge whenever the Unlearn mechanic triggered, regardless of whether the vector had actually been deleted by the agent or by `blank_start` earlier. - **Fix:** Added a `client.retrieve(ids=[point_id])` validation check in `qdrant_memory.py`'s `delete_point`. If the point was wiped by a global `blank_start` and doesn't exist anymore, it skips the log.
mmintel added 1 commit 2026-04-25 20:14:24 +00:00
mmintel closed this pull request 2026-04-25 20:26:20 +00:00
mmintel deleted branch fix-autonomous-memory-purge 2026-04-25 20:26:20 +00:00

Pull request closed

Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mmintel/instagram-bot#1