fix(desktop): filter messaging sessions by active profile - #42934
fix(desktop): filter messaging sessions by active profile#42934BlackishGreen33 wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR updates the desktop app’s messaging sidebar behavior to respect the currently selected profile scope (instead of always treating messaging sessions as “all profiles”), and introduces a small shared helper + tests for filtering sessions by profile.
Changes:
- Fetch messaging sessions and per-platform “load more” results using the current
profileScope(orallin All Profiles mode). - Filter messaging sessions shown in the sidebar by profile scope via a new
filterSessionsByProfileScopehelper. - Add Vitest coverage for the profile-scope filtering helper.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| apps/desktop/src/app/desktop-controller.tsx | Fetch + paginate messaging sessions using the active profile scope and reset platform totals on refresh. |
| apps/desktop/src/app/chat/sidebar/profile-scope.ts | Adds a reusable helper to filter sessions by profile scope. |
| apps/desktop/src/app/chat/sidebar/profile-scope.test.ts | Adds unit tests for the new filtering helper. |
| apps/desktop/src/app/chat/sidebar/index.tsx | Applies profile-scope filtering before grouping messaging sessions in the sidebar. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…profile-filter # Conflicts: # apps/desktop/src/app/chat/sidebar/index.tsx # apps/desktop/src/app/desktop-controller.tsx
teknium1
left a comment
There was a problem hiding this comment.
Thanks for tracing both the initial messaging query and the per-platform paging path. The premise is still present on current main: apps/desktop/src/app/session/hooks/use-session-list-actions.ts:102 and :126 hard-code profile="all", unlike normal recents at :174-177.
Problems
apps/desktop/src/app/chat/sidebar/profile-scope.ts:8usesshowAllProfilesas the all-profiles predicate. Current main defines that asmultiProfile && profileScope === ALL_PROFILES(apps/desktop/src/app/chat/sidebar/index.tsx:257-261), while$profileScopeitself isALL_PROFILESwhenever the persisted setting is enabled (apps/desktop/src/store/profile.ts:294-296). With one profile and persisted all-profiles mode, the new helper filters rows against"__all__"and hides every messaging session.
Suggested changes
- Preserve all rows based on
profileScope === ALL_PROFILES(or a shared canonical scope predicate), and add coverage for that one-profile persisted-mode case.
Automated hermes-sweeper review.
|
Follow-up: the persisted single-profile / All profiles edge case is handled in c35a935. Profile filtering now uses the canonical ALL_PROFILES sentinel instead of the UI-only showAllProfiles flag, and profile-scope.test.ts covers the regression. Revalidated today: focused Desktop Vitest (3 tests) and Desktop typecheck pass. |
|
Additional race fix pushed in c3efe9b. A stale profile-scope callback now exits before advancing the messaging request sequence or clearing platform totals, so it cannot invalidate the current profile request. Added a deferred-promise hook regression covering an A-to-B switch with the stale A callback returning after B. Focused Desktop Vitest (4 tests), typecheck, ESLint, diff check, and npm audit all pass. |
|
Resolved on main by #87566, which consolidated this fix with your Co-authored-by credit preserved in the merged commits. You were the first to submit this fix — thank you! |
What does this PR do?
Fixes the Desktop sidebar messaging sections so they respect the active profile filter.
Before this change, normal Sessions followed the profile switcher, but Feishu/messaging sections could still show sessions from other profiles. This made the selected profile view noisy and confusing.
Now messaging sessions use the same profile scope as the rest of the sidebar:
Related Issue
Fixes #42915
Type of Change
Changes Made
How to Test
cd apps/desktop npm run type-check npm run test:ui -- --run src/app/chat/sidebar/profile-scope.test.tsAlso run:
Checklist