fix(desktop): scope messaging sidebar sessions to active profile - #56635
fix(desktop): scope messaging sidebar sessions to active profile#56635liuhao1024 wants to merge 1 commit into
Conversation
The messaging sidebar (Telegram, Discord, etc.) always fetched sessions with profile='all', ignoring the active profile switcher. When a user switched profiles in the desktop app, local recents updated correctly but the messaging platform sections (e.g. Telegram chat list) continued showing chats from every profile. Fix by passing profileScope to listAllProfileSessions in both refreshMessagingSessions and loadMoreMessagingForPlatform, matching the existing pattern used by refreshSessions for local recents. Fixes NousResearch#56631
Related: competing with open #42934 (filters messaging sessions by active profile) for the same sidebar profile-scope gap that #56631 reports. This PR scopes the fetch itself (passes |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for narrowing the fix to the shared messaging fetch paths. The active-profile premise is confirmed on current main: refreshMessagingSessions and loadMoreMessagingForPlatform both pass "all" at apps/desktop/src/app/session/hooks/use-session-list-actions.ts:102,126, while local recents already derive sessionProfile at :174-177.
Problems
- The new profile-dependent refresh needs a stale-result guard.
DesktopControllerpolls it atapps/desktop/src/app/desktop-controller.tsx:901-919; after a profile switch, an older request can resolve last and overwrite the new profile's rows because the hook writes unconditionally. The local-recents path already uses a request-id guard atuse-session-list-actions.ts:155-188. - The added
apps/desktop/src/hermes.test.tsassertion only covers URL serialization already implemented bylistAllProfileSessionsatapps/desktop/src/hermes.ts:231-249; it does not exercise either changed hook call site. apps/desktop/src/app/chat/sidebar/index.tsx:1334-1336still suppresses messaging groups in worktree-grouped mode.
Suggested changes
- Guard messaging refresh/page results against profile changes and add hook-level tests for concrete, all-profiles, and out-of-order responses.
- Clarify or cover the worktree-grouped rendering behavior.
Automated hermes-sweeper review.
| // Scope the fetch to the active profile so switching profiles updates the | ||
| // messaging sidebar (Telegram, Discord, …) — previously hardcoded to | ||
| // 'all', which meant the sidebar always showed every profile's chats | ||
| // regardless of the active profile switcher. |
There was a problem hiding this comment.
Please guard this profile-scoped request before publishing its result. refreshMessagingSessions is polled, so a request started for the previous profile can resolve after a switch and overwrite the active profile's rows; mirror the request-id protection already used by refreshSessions.
|
Resolved on main by #87566, which consolidated this PR's fix with your Co-authored-by credit preserved in the merged commits. Thank you! |
What does this PR do?
The messaging sidebar (Telegram, Discord, Slack, etc.) always fetched sessions with
profile='all', ignoring the active profile switcher. When a user switched profiles in the desktop app, local recents updated correctly, but the messaging platform sections continued showing chats from every profile — so the Telegram sidebar appeared "stuck" on a single profile's chats.This fix passes
profileScopetolistAllProfileSessionsin bothrefreshMessagingSessionsandloadMoreMessagingForPlatform, matching the existing pattern used byrefreshSessionsfor local recents.Related Issue
Fixes #56631
Type of Change
Changes Made
apps/desktop/src/app/session/hooks/use-session-list-actions.ts: ChangedrefreshMessagingSessionsandloadMoreMessagingForPlatformto scope the session fetch to the activeprofileScopeinstead of hardcoding'all'. AddedprofileScopeto bothuseCallbackdependency arrays so they re-fetch when the user switches profiles.apps/desktop/src/hermes.test.ts: Added test verifyinglistAllProfileSessionsforwards a specific profile name in the API request path.How to Test
local,remote,default), each with Telegram enabledlocal) in the app's profile switcherlocalprofileremote— the sidebar should update to show onlyremoteprofile's Telegram chatsnpx vitest run apps/desktop/src/hermes.test.ts --reporter=verboseChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs
N/A — the fix is a 3-line behavioral change in session fetch scope (plus comments and dependency arrays). The
listAllProfileSessionsAPI already supports per-profile filtering; the call sites just weren't using it.