makecindy / makecindy/cindy

fix(sidebar): 折叠项目面板未跟随任务优先级排序

Open
#4,189 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2.7k
Forks
401
Avg merge
21h 48m
Merged PRs (30d)
776

Description

## 问题

任务排序选择「优先级」、项目顺序选择自动模式时,展开侧栏会依据 waiting / unread / running 优先级重排项目,而折叠 rail 的项目面板继续沿用活动时间顺序。

## 复现步骤

1. 准备一个较旧项目,内含等待用户处理的任务;另一个较新项目仅含闲置任务。
2. 选择按项目分组,任务排序设为优先级,项目顺序设为自动(旧文案「按最近活动」,PR #4183 后称「跟随任务排序」)。
3. 比较展开侧栏和折叠 rail 悬停项目面板的顺序。

实际:展开侧栏把等待处理的项目提前,折叠面板仍按最近活动顺序。
期望:两个入口消费同一优先级上下文和比较规则;手动项目顺序保持独立,不被任务优先级覆盖。

## 源码证据与范围

在 #4183 的基线 `1b379ba5d` 已存在:

- `apps/desktop/src/renderer/features/cc-agent/lib/sidebarProjectSorting.ts`:`sortProjectsForSidebar` 非 custom 分支直接返回原项目顺序,未接入优先级上下文。
- `apps/desktop/src/renderer/features/cc-agent/lib/mainListModel.ts`:`compareEntriesBySortBy` 的 priority 分支调用 `entryPriorityRank` / `entryPriorityRecencyMs`。
- `CCAgentSidebarUpper.tsx` 的 rail 调用只传排序模式和手动项目顺序,没有传入优先级上下文。

此问题由 #4183 的审查发现,但其优先级执行路径在本 PR 前后没有变化。#4183 处理创建时间排序及其折叠/展开一致性,本 Issue 单独跟踪既有优先级路径。

发现线程:https://github.com/makecindy/cindy/pull/4183#discussion_r3967241856

## 验收

- 折叠/展开在 waiting、unread、running、普通任务及同档时间排序时一致。
- 状态变化后两个入口同步更新。
- 项目手动顺序不受影响。
- 复用现有优先级比较器和上下文,避免另建一套策略。

验证状态:已核对基线和当前源码;未做实机复现。

Contributor guide

Open the contributing guide

Research direction

Start with apps/desktop/src/renderer/features/cc-agent/lib/sidebarProjectSorting.ts and compare its non-custom path with compareEntriesBySortBy in mainListModel.ts. Then inspect the rail call in CCAgentSidebarUpper.tsx and trace the existing priority context. Done means collapsed and expanded project orders stay consistent across priority states and updates, while manual ordering remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
desktop, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.