mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
Merge cbe95f8695 into c7d62b3fe3
This commit is contained in:
commit
55076af124
1 changed files with 8 additions and 7 deletions
15
cli.py
15
cli.py
|
|
@ -4853,13 +4853,8 @@ class HermesCLI:
|
|||
# Save the current session's state before branching
|
||||
parent_session_id = self.session_id
|
||||
|
||||
# End the old session
|
||||
try:
|
||||
self._session_db.end_session(self.session_id, "branched")
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Create the new session with parent link
|
||||
# Create the new session with parent link BEFORE ending the old one
|
||||
# (so if creation fails, the original session remains active)
|
||||
try:
|
||||
self._session_db.create_session(
|
||||
session_id=new_session_id,
|
||||
|
|
@ -4875,6 +4870,12 @@ class HermesCLI:
|
|||
_cprint(f" Failed to create branch session: {e}")
|
||||
return
|
||||
|
||||
# Only end the old session after the new one is successfully created
|
||||
try:
|
||||
self._session_db.end_session(self.session_id, "branched")
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Copy conversation history to the new session
|
||||
for msg in self.conversation_history:
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue