fix(state): surface archived+hidden sessions in the archived-only listing

The archived-only view is the recovery surface for sessions that dropped
out of every default list. `list_sessions_rich(archived_only=True)` still
appended `s.hidden = 0`, so a row that was both archived and hidden (Bot
Mode marks its sessions hidden) appeared in no UI list at all and could
only be recovered with direct DB access. Skip the hidden filter when the
caller asks for archived rows only; the default list keeps excluding
hidden rows.

Fixes #90946
This commit is contained in:
liuhao1024
2026-09-16 12:40:29 -07:00
committed by Teknium
parent c22a7f0206
commit 105bb91418
2 changed files with 20 additions and 1 deletions

View File

@@ -1218,7 +1218,11 @@ class SessionSessionsMixin:
exclude_sources=exclude_sources, cwd_prefix=cwd_prefix, min_message_count=min_message_count,
archived_only=archived_only, include_archived=include_archived,
)
if not include_hidden:
# The archived-only view is the recovery surface for rows that dropped out of every
# default list: a session that is archived AND hidden (Bot Mode marks its sessions
# hidden) must still be reachable there, or nothing but direct DB access can bring
# it back (#90946).
if not include_hidden and not archived_only:
where_clauses.append("s.hidden = 0")
where_sql = _where_sql(where_clauses)
base_where_params = list(params) # pinned back-fill reuses the WHERE before LIMIT/OFFSET