mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-31 19:16:29 +00:00
fix(session): check reset policy in self-healing recovery path (#54878)
When the session expiry watcher finalizes a session (daily/idle reset) and the next message triggers the #54878 self-healing path (get_or_create_session detects sessions.json / state.db mismatch), the recovered session was silently reopened without checking whether it should have been reset. This caused sessions to persist indefinitely across reset boundaries. Fix: after dropping the stale sessions.json entry in the self-healing path, call _should_reset() against the old entry's updated_at. If a reset is due, set db_end_session_id to skip DB recovery and create a fresh session — matching the normal reset flow.
This commit is contained in:
parent
3305dcedbb
commit
4b12b7a359
1 changed files with 8 additions and 0 deletions
|
|
@ -1954,6 +1954,14 @@ class SessionStore:
|
|||
session_key, entry.session_id,
|
||||
)
|
||||
self._entries.pop(session_key, None)
|
||||
# If an expiry watcher (daily/idle reset) already finalized
|
||||
# this session, honour the reset decision instead of silently
|
||||
# reopening it via recovery.
|
||||
if _reset_reason:
|
||||
was_auto_reset = True
|
||||
auto_reset_reason = _reset_reason
|
||||
reset_had_activity = entry.last_prompt_tokens > 0
|
||||
db_end_session_id = entry.session_id
|
||||
entry = None
|
||||
_needs_recover = True
|
||||
elif entry.session_id != _stale_session_id:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue