diff --git a/plugins/memory/honcho/__init__.py b/plugins/memory/honcho/__init__.py index 68f5c693f2f24..dde0108c9f51d 100644 --- a/plugins/memory/honcho/__init__.py +++ b/plugins/memory/honcho/__init__.py @@ -1449,7 +1449,10 @@ class HonchoMemoryProvider(MemoryProvider): if clean_assistant_content: for chunk in self._chunk_message(clean_assistant_content, msg_limit): session.add_message("assistant", chunk) - self._manager._flush_session(session) + # Route through save() so writeFrequency is honored — + # _flush_session() directly bypassed "session"/N batching + # and flushed every turn regardless of config. + self._manager.save(session) except Exception as e: logger.debug("Honcho sync_turn failed: %s", e) diff --git a/tests/honcho_plugin/test_save_messages.py b/tests/honcho_plugin/test_save_messages.py index 6495ff7020c49..d86d8b1d85f2d 100644 --- a/tests/honcho_plugin/test_save_messages.py +++ b/tests/honcho_plugin/test_save_messages.py @@ -26,7 +26,16 @@ class TestSyncTurn: p = _provider(save_messages=False) p.sync_turn('user says', 'assistant says') p._manager.get_or_create.assert_not_called() - p._manager._flush_session.assert_not_called() + p._manager.save.assert_not_called() + + def test_enabled_routes_through_save(self): + p = _provider(save_messages=True) + p.sync_turn('user says', 'assistant says') + if p._sync_thread is not None: + p._sync_thread.join(timeout=5) + p._manager.get_or_create.assert_called_once() + # save() (not _flush_session) so writeFrequency batching is honored + p._manager.save.assert_called_once() def test_enabled_writes(self): p = _provider(save_messages=True) diff --git a/tests/test_honcho_startup_fail_open.py b/tests/test_honcho_startup_fail_open.py index 09daabb393979..4b8e1da2d3e8e 100644 --- a/tests/test_honcho_startup_fail_open.py +++ b/tests/test_honcho_startup_fail_open.py @@ -483,7 +483,7 @@ def test_honcho_sync_turn_same_instance_config_flip_gates_writes(): manager_calls.append(session_key) return SimpleNamespace(add_message=lambda role, content: None) - def _flush_session(self, session): + def save(self, session): write_done.set() provider._config = cfg