fix(gateway): trigger memory provider shutdown on /new and /reset - #7762
fix(gateway): trigger memory provider shutdown on /new and /reset#7762fancydirty wants to merge 1 commit into
Conversation
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 NousResearch#7759
There was a problem hiding this comment.
Pull request overview
This PR fixes a session-lifecycle gap in the gateway: /new and /reset now trigger the cached agent’s shutdown_memory_provider() before eviction, matching the existing session-expiry behavior so memory providers (e.g., OpenViking) can commit/index on session end.
Changes:
- Invoke
shutdown_memory_provider()on the cached agent during_handle_reset_command()before closing and evicting it. - Keep the reset flow non-blocking by leaving the transcript-based flush as a background task while still triggering provider shutdown immediately.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hi maintainers — this is a small, targeted fix for a session-lifecycle gap. It adds the missing
Would love a review when you have a moment. Thanks! |
|
agree, these issues should be fixed. |
There was a problem hiding this comment.
Review: Gateway /new Memory Commit Fix
Verdict: LGTM — ready to merge
Surgical 5-line fix.
In the gateway, /new /reset destroys the old agent entirely and creates a fresh one for the next session, so destroy should be save.
Checklist Pass
-
shutdown_memory_provider()called beforeclose()in_handle_reset_command() - Wrapped in its own
try/except Exceptionblock — isolated from theclose()error path -
hasattrguard — non-OV agents are completely unaffected - Confirmed MERGEABLE by GitHub, 189 gateway tests pass
This is the fastest path to fixing commit timing for gateway /new and /reset. Recommend merging before the larger PRs (#9167, #8362) to reduce diff scope.
|
Merged via PR #9796. Your commit was cherry-picked onto current main with your authorship preserved in git log. Thanks for catching this gap, @fancydirty! |
Fixes #7759
Problem
The
/newand/resetcommands were not callingshutdown_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.Root Cause
In
_handle_reset_command(), the code flushed memories and closed tool resources, but it never shut down the memory provider. The session expiry watcher already does this correctly.Fix
Add the missing
shutdown_memory_provider()call in_handle_reset_command(), matching the behavior already present in the session expiry watcher (lines ~1600–1625).Verification
tests/gateway/test_session_reset_notify.py— 13 passed ✅tests/gateway/test_gateway_inactivity_timeout.py— 8 passed ✅tests/gateway/test_voice_command.py— 168 passed ✅