supermemory/packages/pipecat-sdk-python/tests
abhay-codes07 7cf076365d
fix(pipecat): stop re-storing injected memory blocks as new memories
LLMContext.get_messages() returns the context's live message list — the
enhancement code depends on that, mutating it in place to inject the
<user_memories> block. But the frame handler snapshotted that same
reference *before* enhancement, so by the time it sliced out
storable_messages the list already contained this turn's injected
user-message, and _store_messages wrote the recalled memories back to
Supermemory as a brand-new memory. Next turn recalls the stored block
and re-stores it again, compounding every turn. (Previously masked by
the dedup crash fixed in #1268 — with search results empty and profile
facts present, the loop is live.)

Two defenses:
- copy the message list before enhancement mutates it, so the current
  turn's injection never enters the storage slice
- filter any message carrying the memory tag out of storable_messages,
  which also covers the previous turn's injected block still sitting in
  the context (it is only replaced during the next enhancement, after
  the snapshot is taken)

Regression tests drive process_frame with a live-list fake context and
a mocked client: the injected block lands in the context but never in
the storage payload, across both the same-turn and next-turn shapes.
2026-07-13 04:12:09 +05:30
..
__init__.py pipecat-sdk (#663) 2026-01-10 15:19:31 -08:00
test_empty_profile.py fix(pipecat-sdk): handle null profile object safely (#1041) 2026-06-05 17:26:28 +05:30
test_no_memory_restorage.py fix(pipecat): stop re-storing injected memory blocks as new memories 2026-07-13 04:12:09 +05:30