fix(desktop): force-include pinned sessions in session list via include_ids - #43167
fix(desktop): force-include pinned sessions in session list via include_ids#43167hrnbld wants to merge 1 commit into
Conversation
…de_ids Pinned sessions that aged off the 50-session recency page silently vanished from the Desktop sidebar because the initial page load never included them and mergeSessionPage can only preserve rows already in the in-memory list — it cannot conjure sessions that were never fetched. Add an include_ids parameter to list_sessions_rich (hermes_state.py) that resolves each id to its live compression tip and prepends it to the result, then thread it through /api/sessions, /api/profiles/sessions, and the Desktop frontend (listAllProfileSessions, refreshSessions). The frontend now passes $pinnedSessionIds on every refresh so pinned conversations are always present regardless of how long ago they were last active. Closes the 'pinned sessions disappear until refresh — and even refresh does not bring them back when they are past the recency window' bug.
teknium1
left a comment
There was a problem hiding this comment.
Thanks for tracing the bounded-page versus renderer-cache failure mode. The premise still holds on current main: refreshSessions fetches a bounded profile list at apps/desktop/src/app/session/hooks/use-session-list-actions.ts:176, while mergeSessionPage can only retain rows already in previous (apps/desktop/src/store/session.ts:188-195).
Problems
- In this PR,
get_profiles_sessionspassesinclude_idsto each profile list athermes_cli/web_server.py:1935, but then globally sortsmergedbylast_activeand slices it to the requested limit at lines 1961-1963. A pinned conversation old enough to be off the recency page is therefore sorted out again, so the Desktop aggregate endpoint still does not hydrate it. - The diff does not add a cold-start/reconnect regression test. Existing coverage at
apps/desktop/src/store/session.test.ts:124only proves preservation of an already-loaded pinned row.
Suggested changes
- Keep explicitly hydrated rows outside the normal recency window, dedupe by lineage, and append/merge them after pagination.
- Port the caller change to
apps/desktop/src/app/session/hooks/use-session-list-actions.ts; commit25c7900fbmoved the relevant controller code there.
Automated hermes-sweeper review.
| include_archived=include_archived, | ||
| archived_only=archived_only, | ||
| order_by_last_active=order == "recent", | ||
| include_ids=include_list, |
There was a problem hiding this comment.
list_sessions_rich() prepends these rows per profile, but this endpoint then globally sorts merged by last_active and truncates it at lines 1961-1963. An old pinned session is therefore ejected from the aggregate response again; carry hydrated rows outside the recency window and dedupe them before returning.
|
Superseded by #74234, which makes pins server-owned so they survive paging and sync between apps. Your work is carried in it and you're credited as a co-author — thank you. |
Problem
Pinned sessions that aged off the 50-session recency page silently vanished from the Desktop sidebar. The root cause is twofold:
Initial fetch:
refreshSessionsonly loads the 50 most recent sessions from/api/profiles/sessions. Pinned sessions outside that window are never fetched.Merge limitation:
mergeSessionPage()can only preserve sessions already in the in-memorypreviouslist — it cannot resurrect sessions that were never loaded. The pinned-IDs-as-keepIds mechanism inherited this limitation.Fix
Backend (
hermes_state.py):include_idsparameter tolist_sessions_richthat resolves each ID to its live compression tip (viaget_compression_tip+_get_session_rich_row) and prepends it to the result, deduped by both live ID and_lineage_root_id.API (
web_server.py):include_idsquery param through both/api/sessionsand/api/profiles/sessionsendpoints.Frontend (
hermes.ts,desktop-controller.tsx):listAllProfileSessionsnow accepts optionalincludeIds: string[]and appends&include_ids=...to the request URL.refreshSessionsandloadMoreSessionsForProfilepass$pinnedSessionIdsso pinned conversations are always included regardless of how long ago they were last active.Testing