You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Python: [Bug]: Mem0ContextProvider forwards unset user_id/agent_id as None to OSS client #9976
Mem0ContextProvider.after_run forwards user_id and agent_id to the OSS AsyncMemory client as unconditional direct kwargs, even though _validate_filters permits configuring only one of them. When only user_id is configured (agent_id is None), add() receives agent_id=None and the run crashes after the model has already produced a reply.
Expected Behavior
The OSS branch should be conditional, matching _build_filters: only include user_id/agent_id when non-empty.
Steps to Reproduce
Configure Mem0ContextProvider with only user_id.
Run an interaction that triggers after_run.
Observe the crash after the reply is generated.
Minimal Reproduction
# user_id-only config is valid per _validate_filters,# but OSS add() receives agent_id=None -> TypeError
🤖 Automated triage reproduction notes(agent-authored — trust but verify)
Agent analysis
python/packages/mem0/agent_framework_mem0/_context_provider.py::Mem0ContextProvider.after_run at lines 268-270 forwards both identity kwargs when an OSS AsyncMemory client has only user_id or only agent_id configured. Minimal repro: construct the provider with a mocked OSS client and one identity, invoke after_run with a nonempty message, and assert the unset identity key is absent from add() kwargs.
Activity
github-actions commentedon Nov 2, 2026
🤖 Automated triage reproduction notes (agent-authored — trust but verify)
Agent analysis
python/packages/mem0/agent_framework_mem0/_context_provider.py::Mem0ContextProvider.after_runat lines 268-270 forwards both identity kwargs when an OSSAsyncMemoryclient has onlyuser_idor onlyagent_idconfigured. Minimal repro: construct the provider with a mocked OSS client and one identity, invokeafter_runwith a nonempty message, and assert the unset identity key is absent fromadd()kwargs.python/packages/mem0/tests/test_mem0_context_provider.py1.0b261030