From 6afe5758f25f818366961e68cac0b7ac14b4e0e5 Mon Sep 17 00:00:00 2001 From: paulb26 <275835513+paulb26@users.noreply.github.com> Date: Mon, 11 May 2026 23:27:53 -0400 Subject: [PATCH] fix(supermemory): honor auto_capture during session-end flush --- plugins/memory/supermemory/__init__.py | 2 +- tests/plugins/memory/test_supermemory_provider.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/plugins/memory/supermemory/__init__.py b/plugins/memory/supermemory/__init__.py index f0cbfd60276d..355be296e3a8 100644 --- a/plugins/memory/supermemory/__init__.py +++ b/plugins/memory/supermemory/__init__.py @@ -593,7 +593,7 @@ def _run(): self._sync_thread.start() def on_session_end(self, messages: List[Dict[str, Any]]) -> None: - if not self._active or not self._write_enabled or not self._client or not self._session_id: + if not self._active or not self._auto_capture or not self._write_enabled or not self._client or not self._session_id: return cleaned = [] for message in messages or []: diff --git a/tests/plugins/memory/test_supermemory_provider.py b/tests/plugins/memory/test_supermemory_provider.py index 0aee459757f4..89d9d9459bd3 100644 --- a/tests/plugins/memory/test_supermemory_provider.py +++ b/tests/plugins/memory/test_supermemory_provider.py @@ -169,6 +169,21 @@ def test_on_session_end_ingests_clean_messages(provider): ] +def test_on_session_end_respects_auto_capture_false(monkeypatch, tmp_path): + monkeypatch.setenv("SUPERMEMORY_API_KEY", "test-key") + monkeypatch.setattr("plugins.memory.supermemory._SupermemoryClient", FakeClient) + _save_supermemory_config({"auto_capture": False}, str(tmp_path)) + p = SupermemoryMemoryProvider() + p.initialize("session-1", hermes_home=str(tmp_path), platform="cli") + + p.on_session_end([ + {"role": "user", "content": "please keep this out of automatic capture"}, + {"role": "assistant", "content": "this should not be ingested either"}, + ]) + + assert p._client.ingest_calls == [] + + def test_on_memory_write_tracks_thread(provider): provider.on_memory_write("add", "memory", "Jordan likes concise docs") assert provider._write_thread is not None