fix(session_search): order recent mode by last activity instead of start time
- order session_search recent-mode results by last activity instead of session start time - add an opt-in `order_by_last_active` path to `SessionDB.list_sessions_rich` - add regression coverage for both the database ordering and recent-mode call path
This commit is contained in:
@@ -266,7 +266,11 @@ _HIDDEN_SESSION_SOURCES = ("tool",)
|
||||
def _list_recent_sessions(db, limit: int, current_session_id: str = None) -> str:
|
||||
"""Return metadata for the most recent sessions (no LLM calls)."""
|
||||
try:
|
||||
sessions = db.list_sessions_rich(limit=limit + 5, exclude_sources=list(_HIDDEN_SESSION_SOURCES)) # fetch extra to skip current
|
||||
sessions = db.list_sessions_rich(
|
||||
limit=limit + 5,
|
||||
exclude_sources=list(_HIDDEN_SESSION_SOURCES),
|
||||
order_by_last_active=True,
|
||||
) # fetch extra to skip current
|
||||
|
||||
# Resolve current session lineage to exclude it
|
||||
current_root = None
|
||||
|
||||
Reference in New Issue
Block a user