mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-28 06:51:16 +08:00
fix(cli): resolve -c by true MRU session
- order session listing by computed last_active in SessionDB so callers get MRU rows directly - keep _resolve_last_session as a single-row lookup and add regression coverage for >20 session sampling
This commit is contained in:
committed by
Teknium
parent
730347e38f
commit
164e33aa46
@@ -595,15 +595,14 @@ def _session_browse_picker(sessions: list) -> Optional[str]:
|
||||
|
||||
|
||||
def _resolve_last_session(source: str = "cli") -> Optional[str]:
|
||||
"""Look up the most recent session ID for a source."""
|
||||
"""Look up the most recently-used session ID for a source."""
|
||||
try:
|
||||
from hermes_state import SessionDB
|
||||
|
||||
db = SessionDB()
|
||||
sessions = db.search_sessions(source=source, limit=1)
|
||||
db.close()
|
||||
if sessions:
|
||||
return sessions[0]["id"]
|
||||
return sessions[0]["id"] if sessions else None
|
||||
except Exception:
|
||||
pass
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user