fix(memory): log CLI shutdown hook failures

Makes the CLI memory-provider shutdown path observable: log when CLI
cleanup calls memory shutdown (with session id + message count), warn
instead of swallowing CLI memory-shutdown exceptions, warn on
on_session_end failures during agent shutdown, and raise the
MemoryManager provider-hook failure log from debug to warning with a
traceback.

Salvaged from PR #49287 (authored by Gille / @helix4u).
This commit is contained in:
Gille 2026-06-19 16:13:19 -07:00 committed by Teknium
parent c1a0b6a5f1
commit 013f9c8750
3 changed files with 15 additions and 5 deletions

View file

@ -721,9 +721,10 @@ class MemoryManager:
try:
provider.on_session_end(messages)
except Exception as e:
logger.debug(
logger.warning(
"Memory provider '%s' on_session_end failed: %s",
provider.name, e,
exc_info=True,
)
def on_session_switch(