Skip to content

fix(mem0): include agent-attributed memories in read filter (closes #38424)#38444

Closed
alaamohanad169-ship-it wants to merge 1 commit into
NousResearch:mainfrom
alaamohanad169-ship-it:auto-fix-38424
Closed

fix(mem0): include agent-attributed memories in read filter (closes #38424)#38444
alaamohanad169-ship-it wants to merge 1 commit into
NousResearch:mainfrom
alaamohanad169-ship-it:auto-fix-38424

Conversation

@alaamohanad169-ship-it

Copy link
Copy Markdown
Contributor

Summary

The Mem0 provider writes memories with both user_id and agent_id (see _write_filters), but _read_filters only queried by user_id. The Mem0 Platform API matches filters strictly, so agent-attributed memories were invisible to mem0_profile, mem0_search, and prefetch.

Fix

Changed _read_filters() to use an OR filter that matches both:

  • older user-only memories (no agent_id)
  • newer memories saved with both user_id and agent_id

Before

def _read_filters(self):
    return {"user_id": self._user_id}

After

def _read_filters(self):
    return {
        "OR": [
            {"user_id": self._user_id},
            {"user_id": self._user_id, "agent_id": self._agent_id},
        ]
    }

Verification

  • ✅ All 16 mem0 tests pass
  • ✅ All 168 memory plugin tests pass with no regressions

Closes #38424

Notes

  • This is a doc-type auto-fix PR generated by the auto-fixer engine.
  • The fix is minimal and focused — only _read_filters() and the corresponding test assertions changed.
  • The OR filter format matches the Mem0 Platform API's documented filter syntax.

The Mem0 provider writes memories with both user_id and agent_id
(see _write_filters), but _read_filters only queried by user_id.
The Mem0 Platform API matches filters strictly, so agent-attributed
memories were invisible to mem0_profile, mem0_search, and prefetch.

Fix by using an OR filter that matches both:
- older user-only memories (no agent_id)
- newer memories saved with both user_id and agent_id

Closes NousResearch#38424
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/plugins Plugin system and bundled plugins tool/memory Memory tool and memory providers labels Jun 3, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #38429 — same fix (Mem0 _read_filters() OR filter for agent-attributed memories), both closing #38424. Consolidating on one PR.

@alaamohanad169-ship-it alaamohanad169-ship-it marked this pull request as ready for review June 5, 2026 06:41
@alaamohanad169-ship-it alaamohanad169-ship-it deleted the auto-fix-38424 branch June 6, 2026 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have tool/memory Memory tool and memory providers type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mem0 provider read filter misses agent-attributed memories

2 participants