fix(session-state): clear hidden flag when a session is pinned

A bot-mode session is created with hidden=true. Pinning it only wrote
pinned=1 and left hidden=1, so the row was filtered out of both the
default listing (`s.hidden = 0`) and the pinned back-fill (which reuses
the same WHERE), making a pinned session vanish from the sidebar
entirely. set_session_pinned now clears hidden across the session's
compression lineage whenever pinned is set to true.

Fixes #106171
This commit is contained in:
chelsealong
2026-09-09 00:25:39 +00:00
committed by Teknium
parent 87cc4de430
commit c59aa2d041
2 changed files with 20 additions and 2 deletions

View File

@@ -876,8 +876,13 @@ class SessionSessionsMixin:
return True
def set_session_pinned(self, session_id: str, pinned: bool) -> bool:
"""Pin/unpin a session and its compression lineage (pins are exempt from the auto_archive sweep)."""
return self._set_lineage_column("pinned", session_id, int(pinned))
"""Pin/unpin a session and its compression lineage (pins are exempt from the auto_archive sweep).
Pinning also clears ``hidden``: a pin means "keep this visible", and a hidden+pinned row is
otherwise absent from both the default listing and the pinned back-fill (see #106171)."""
result = self._set_lineage_column("pinned", session_id, int(pinned))
if pinned:
self._set_lineage_column("hidden", session_id, 0)
return result
def set_session_hidden(self, session_id: str, hidden: bool) -> bool:
"""Hide/unhide a session and its compression lineage from the default listing; still resumable."""