Skip to content

fix(mem0): read agent-attributed memories#38429

Open
GodsBoy wants to merge 1 commit into
NousResearch:mainfrom
GodsBoy:fix/mem0-agent-attributed-recall
Open

fix(mem0): read agent-attributed memories#38429
GodsBoy wants to merge 1 commit into
NousResearch:mainfrom
GodsBoy:fix/mem0-agent-attributed-recall

Conversation

@GodsBoy

@GodsBoy GodsBoy commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes the Mem0 provider read filter so profile, search, and prefetch include memories saved with agent attribution.

The provider already writes with user_id and agent_id. Reads used only user_id, which can miss records on Mem0 Platform once they are stored under an agent scope. This keeps the user-only read path for older records and adds the active agent-scoped shape to the filter.

Related Issue

Fixes #38424

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • plugins/memory/mem0/__init__.py
    • Changed _read_filters() to return an OR filter covering both user-only and active agent-attributed memories.
  • tests/plugins/memory/test_mem0_v2.py
    • Updated search, profile, and prefetch filter assertions.
    • Added coverage that the configured agent_id is used instead of a hard-coded value.

How to Test

  1. Run python3 -m pytest tests/plugins/memory/test_mem0_v2.py -q.
  2. Run ruff check plugins/memory/mem0/__init__.py tests/plugins/memory/test_mem0_v2.py.
  3. Run python scripts/run_tests_parallel.py --slice 1/6.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Ubuntu 24.04 / Linux 6.8

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

For New Skills

N/A

@alt-glitch alt-glitch added type/bug Something isn't working tool/memory Memory tool and memory providers comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have labels Jun 3, 2026
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