From e964cfc403bf66fe5b9b4f3153019401d736f9a2 Mon Sep 17 00:00:00 2001 From: dirtyfancy Date: Sat, 11 Apr 2026 22:26:24 +0800 Subject: [PATCH] fix(gateway): trigger memory provider shutdown on /new and /reset The /new and /reset commands were not calling shutdown_memory_provider() on the cached agent before eviction. This caused OpenViking (and any memory provider that relies on session-end shutdown) to skip commit, leaving memories un-indexed until idle timeout or gateway shutdown. Add the missing shutdown_memory_provider() call in _handle_reset_command(), matching the behavior already present in the session expiry watcher. Fixes #7759 --- gateway/run.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gateway/run.py b/gateway/run.py index c8c25256b8f..568ffd61ba4 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -3971,6 +3971,11 @@ class GatewayRunner: _cached = self._agent_cache.get(session_key) _old_agent = _cached[0] if isinstance(_cached, tuple) else _cached if _cached else None if _old_agent is not None: + try: + if hasattr(_old_agent, "shutdown_memory_provider"): + _old_agent.shutdown_memory_provider() + except Exception: + pass try: if hasattr(_old_agent, "close"): _old_agent.close()