Problem
When using OpenViking as the memory provider, the /new and /reset commands do not trigger a session commit, which means memories stored via viking_remember are not extracted and indexed until the session expires via idle timeout or the gateway shuts down.
Current Behavior
| Action |
Triggers OpenViking Commit? |
/new or /reset |
❌ No |
| Idle timeout (session expiry) |
✅ Yes |
| Gateway shutdown |
✅ Yes |
Root Cause
In gateway/run.py, the _handle_reset_command() function:
- Calls
_async_flush_memories() with a temporary agent that has skip_memory=True set
- Calls
_evict_cached_agent() which only removes the agent from cache
- Does not call
shutdown_memory_provider() on the cached agent
The relevant code (lines 3260-3279):
async def _handle_reset_command(self, event: MessageEvent) -> str:
# ...
_flush_task = asyncio.create_task(
self._async_flush_memories(old_entry.session_id)
)
self._evict_cached_agent(session_key) # Only removes from cache, no shutdown
In contrast, the session expiry watcher (lines 1307-1313) correctly calls:
await self._async_flush_memories(entry.session_id)
if hasattr(cached_agent, 'shutdown_memory_provider'):
cached_agent.shutdown_memory_provider() # This triggers OpenViking commit
Expected Behavior
/new and /reset should trigger the same memory provider shutdown as idle timeout does, so that OpenViking sessions are committed and memories are extracted/indexed immediately.
Suggested Fix
Add a call to shutdown_memory_provider() in _handle_reset_command() after flushing memories:
# After _evict_cached_agent, before resetting session
cached_agent = self._running_agents.get(session_key)
if cached_agent and cached_agent is not _AGENT_PENDING_SENTINEL:
if hasattr(cached_agent, 'shutdown_memory_provider'):
cached_agent.shutdown_memory_provider()
Impact
Users who manually reset sessions via /new or /reset expect their memories to be persisted immediately, not after waiting for idle timeout or gateway shutdown.
Environment
- Hermes Agent version: v0.8.x
- Memory provider: OpenViking
- Platform: Gateway (Feishu/Telegram/Discord/etc.)
Problem
When using OpenViking as the memory provider, the
/newand/resetcommands do not trigger a session commit, which means memories stored viaviking_rememberare not extracted and indexed until the session expires via idle timeout or the gateway shuts down.Current Behavior
/newor/resetRoot Cause
In
gateway/run.py, the_handle_reset_command()function:_async_flush_memories()with a temporary agent that hasskip_memory=Trueset_evict_cached_agent()which only removes the agent from cacheshutdown_memory_provider()on the cached agentThe relevant code (lines 3260-3279):
In contrast, the session expiry watcher (lines 1307-1313) correctly calls:
Expected Behavior
/newand/resetshould trigger the same memory provider shutdown as idle timeout does, so that OpenViking sessions are committed and memories are extracted/indexed immediately.Suggested Fix
Add a call to
shutdown_memory_provider()in_handle_reset_command()after flushing memories:Impact
Users who manually reset sessions via
/newor/resetexpect their memories to be persisted immediately, not after waiting for idle timeout or gateway shutdown.Environment