mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix(cli): catch KeyboardInterrupt during flush_memories on exit (#3025)
KeyboardInterrupt inherits from BaseException, not Exception, so the except Exception: clauses wrapping flush_memories() on exit paths silently skipped the flush when the user pressed Ctrl+C. This could lose conversation memory. Change both call sites to except (Exception, KeyboardInterrupt): so the memory flush is attempted even during interrupt. Salvaged from PR #2855 by RufusLin (dropped unrelated bundled changes).
This commit is contained in:
parent
94e3d9adbf
commit
e4033b2baf
1 changed files with 2 additions and 2 deletions
4
cli.py
4
cli.py
|
|
@ -2881,7 +2881,7 @@ class HermesCLI:
|
|||
if self.agent and self.conversation_history:
|
||||
try:
|
||||
self.agent.flush_memories(self.conversation_history)
|
||||
except Exception:
|
||||
except (Exception, KeyboardInterrupt):
|
||||
pass
|
||||
|
||||
old_session_id = self.session_id
|
||||
|
|
@ -7206,7 +7206,7 @@ class HermesCLI:
|
|||
if self.agent and self.conversation_history:
|
||||
try:
|
||||
self.agent.flush_memories(self.conversation_history)
|
||||
except Exception:
|
||||
except (Exception, KeyboardInterrupt):
|
||||
pass
|
||||
# Shut down voice recorder (release persistent audio stream)
|
||||
if hasattr(self, '_voice_recorder') and self._voice_recorder:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue