supermemory/packages/agent-framework-python/tests
Suhani 21c31a3259 fix(agent-framework): repair memory injection into chat messages
`_inject_memories` did not work against Agent Framework `Message`
objects, in two separate ways.

1. `Message.text` is a read-only property derived from `Message.contents`,
   so assigning to it raises `AttributeError`. Every request that found an
   existing system message hit this path, and `_inject_memories` is called
   from `process()` without a guard, so the exception propagated and failed
   the whole chat call. Memories are now appended as an extra text content
   item, and the dict branch is checked first so plain-dict messages keep
   working.

2. When no system message was present, the prepended message carried the
   raw memories instead of the `wrap_memory_injection` output. That is the
   fence which marks retrieved memories as data and tells the model not to
   follow instructions inside them, so untrusted memory content reached the
   model unfenced. This path is common, since it covers any agent built
   without instructions. Both branches now inject the same wrapped text.

Adds coverage for `_inject_memories`, which previously had none.
2026-08-05 22:05:57 +05:30
..
__init__.py Add Supermemory integration for Microsoft Agent Framework (#775) 2026-03-10 01:49:45 +00:00
test_connection.py Add Supermemory integration for Microsoft Agent Framework (#775) 2026-03-10 01:49:45 +00:00
test_context_provider.py Add Supermemory integration for Microsoft Agent Framework (#775) 2026-03-10 01:49:45 +00:00
test_middleware.py fix(agent-framework): repair memory injection into chat messages 2026-08-05 22:05:57 +05:30
test_tools.py Add Supermemory integration for Microsoft Agent Framework (#775) 2026-03-10 01:49:45 +00:00
test_utils.py Add Supermemory integration for Microsoft Agent Framework (#775) 2026-03-10 01:49:45 +00:00