feat(desktop): re-land sidebar filter/sort with activity-based ordering
Closed
AV
2mo ago+1531+1531+0123456789012345678901234567890123456789-24-24-01234567890123456789
Summary
Re-lands the dashboard sidebar filter + sort feature (#5956, reverted in #5996) with the fixes that motivated the revert:
- Reapply #5956 — pure revert-of-revert; the filter input, sort menu, and preference plumbing come back unchanged. Applies cleanly over #5997/#5999/#6000 (the #6000 stopPropagation guard survives).
- Crash fix — Electric cloud-fallback rows carry ISO-string timestamps at runtime (the shape parser doesn't handle
timestamptz, despite theSelectV2Workspacetype). They're normalized to realDates where they entermergeHostWorkspaces, and the sort coerces defensively (toTime, NaN-safe tie-breaks) so bad data can never crash the sidebar again. Fixes theworkspace.updatedAt.getTime is not a functioncrash. - Workspace-level sorting — non-manual modes now sort workspaces inside each project and inside sections, rank sections among loose workspaces by their newest member, and keep the local main workspace pinned first.
- "Last updated" means real activity — the revert reason:
v2_workspaces.updatedAtonly moves on metadata writes, so messaging an agent never reordered anything. The sidebar now polls each reachable host'sterminalAgents.list(10s interval, only while the sort mode is "Last updated") and ranks everything bymax(updatedAt, newest agent hook event). Sending a Claude message reorders within ~10s. - Design doc —
apps/desktop/docs/SIDEBAR_ACTIVITY_SORT.mdrecords the signal semantics, the polling trade-off, and the follow-up paths (event-bus push for instant reordering; cloud-persisted activity as the long-term model; Electric timestamp-parser root fix as its own PR).
Verification
- Full desktop suite: 2305 pass / 0 fail (new tests for string-date coercion, agent-activity ranking at workspace/section/project levels, merge normalization).
- Live via CDP against the dev app: sort menu + filter exercised end-to-end; rendered order matches the ranking computed from real host binding data and provably diverges from
updatedAt-only ordering; a syntheticUserPromptSubmiton a 3-day-idle workspace moved it to the top of its project in ~4s. - Typecheck and lint clean.
Notes
- Overlaps with #6001: the reapply restores the automations
bg-destructivecolor changes that #6001 also contains. Merge either first; the other becomes a trivial rebase/close. - Pinned rows intentionally keep pin order; unreachable hosts fall back to
updatedAtranking.
https://claude.ai/code/session_01SSUQYFamkYAjs5sDQC5RLS
Summary by cubic
Re-lands the dashboard sidebar filter and sort, and makes “Last updated” use real agent activity so recent conversations reorder projects and workspaces. Also fixes a crash from cloud string timestamps.
-
New Features
- Added project filter input and sort menu in the sidebar header; choice is saved in
sidebarProjectSortMode. - “Last updated” now ranks by max(
updatedAt, latest agent event), polling each reachable host’sterminalAgents.listevery 10s only while this mode is active. Applies at workspace, section, and project levels; the local main workspace stays first. - Non-manual modes sort workspaces within projects and within sections; sections rank among loose workspaces by their newest member.
- Drag-and-drop is disabled when sort ≠ manual or a filter is active to avoid corrupting hidden items; filter expands matched projects/sections and shows a simple “no match” state.
- Added project filter input and sort menu in the sidebar header; choice is saved in
-
Bug Fixes
- Prevented sidebar crash by coercing Electric cloud-fallback
createdAt/updatedAtstrings toDateinmergeHostWorkspaces; sorting uses NaN-safe coercion with name/id tie-breakers. - Standardized automation failure colors to
bg-destructive.
- Prevented sidebar crash by coercing Electric cloud-fallback
Summary by CodeRabbit
-
New Features
- Added sidebar project sorting by manual order, creation date, or recent activity.
- Added project and workspace filtering with matching results automatically expanded.
- Added persistent sorting preferences and improved controls in the sidebar header.
- Recent agent activity now contributes to “Last updated” ordering.
-
Bug Fixes
- Improved handling of cloud workspace timestamps.
- Prevented drag-and-drop reordering while filtering or using non-manual sorting.
- Standardized failed automation status styling.