The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(honcho): register the recall sync thread with its owner so shutdown joins it
Erosikae9396ed8f492
diff --git a/plugins/memory/honcho/recall_sync.py b/plugins/memory/honcho/recall_sync.pyindex 6c93f51b8d3..297b3f15057 100644--- a/plugins/memory/honcho/recall_sync.py+++ b/plugins/memory/honcho/recall_sync.py@@ -92,7 +92,7 @@ def prefetch_sync(provider, query: str) -> str:except Exception as exc:logger.debug("Honcho synchronous recall failed: %s", exc)- worker = spawn_context_thread(retrieve, name="honcho-recall-sync")+ worker = spawn_context_thread(retrieve, name="honcho-recall-sync", owner=provider)provider._recall_sync_thread = workerworker.start()worker.join(timeout=max(0.0, deadline - time.monotonic()))diff --git a/tests/honcho_plugin/test_shutdown.py b/tests/honcho_plugin/test_shutdown.pyindex 30b45f0f32e..d6ae2a61afd 100644--- a/tests/honcho_plugin/test_shutdown.py+++ b/tests/honcho_plugin/test_shutdown.py@@ -134,6 +134,29 @@ class TestProviderShutdown:self._shutdown_blocks_until(provider, release)assert not provider._prefetch_thread.is_alive()+ def test_recall_sync_worker_is_registered_under_the_provider(self, async_manager):+ from plugins.memory.honcho.recall_sync import prefetch_sync++ provider = self._provider(async_manager, cfg=HonchoClientConfig(api_key="test-key", enabled=True, timeout=0.05))+ entered, release = threading.Event(), threading.Event()++ def blocked(session_key, query, **kwargs):+ entered.set()+ release.wait(timeout=2)+ return {}++ async_manager.get_prefetch_context = blocked+ provider.on_turn_start(1, "what did we decide about the schema?")+ try:+ assert prefetch_sync(provider, "what did we decide about the schema?") == ""+ assert entered.wait(timeout=1)+ assert join_plugin_threads((provider,), timeout=0.01) == ["honcho-recall-sync"]+ release.set()+ assert join_plugin_threads((provider,), timeout=2) == []+ finally:+ release.set()+ provider._recall_sync_thread.join(timeout=2)+def test_shutdown_does_not_close_the_shared_client(self, async_manager):provider = self._provider(async_manager)provider.shutdown()