Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

feat(desktop): 优先级排序改四档,对齐 Codex 的 waiting > unread > running

Dash9a7bc68456ba
diff --git a/apps/desktop/help-knowledge/sidebar.md b/apps/desktop/help-knowledge/sidebar.md
index 14474ab85d..ccac96cbd2 100644
--- a/apps/desktop/help-knowledge/sidebar.md
+++ b/apps/desktop/help-knowledge/sidebar.md
@@ -16,7 +16,7 @@ The left sidebar lists your sessions. It's the main way to navigate and organize
**Sorting:**
- **By time** (default) — one activity timeline for the whole list, most recent first. There is no oldest-first option.
-- **Priority** — sessions with an unread badge (finished unread, waiting for your reply, or errored) float to the top, then running sessions, then the rest by time. A project row inherits the highest priority among its sessions. Unread state is in-memory: after a restart most sessions fall back to time order.
+- **Priority** — four tiers, same as Codex: sessions waiting on you (pending reply / approval / error) first, then finished-unread sessions, then running sessions, then the rest by time. A project row inherits the highest priority among its sessions. Unread state is in-memory: after a restart most sessions fall back to time order.
- **Manual** — drag project rows to set a persistent custom order. Manual order covers **project rows only**; stray chats and the Chat group always follow by recency. Dragging a project in any other sort mode automatically switches to Manual.
- Sorting **alphabetically** and **oldest first** have been removed.
diff --git a/apps/desktop/src/main/maker-ipc/helpKnowledge.generated.ts b/apps/desktop/src/main/maker-ipc/helpKnowledge.generated.ts
index 09e8d3c9e0..87dcdf82b6 100644
--- a/apps/desktop/src/main/maker-ipc/helpKnowledge.generated.ts
+++ b/apps/desktop/src/main/maker-ipc/helpKnowledge.generated.ts
@@ -138,7 +138,7 @@ export const HELP_KNOWLEDGE: HelpKnowledgeDoc[] = [
id: "sidebar",
title: "Finding and organizing sessions",
summary: "Browse, group, filter, sort, search, and pin sessions or projects in the left sidebar.",
- content: "The left sidebar lists your sessions. It's the main way to navigate and organize. The **Organize sidebar** menu holds grouping, sorting, filters, and display options — open it from the sliders icon on the **All sessions** header, or right-click any blank area of the sidebar.\n\n**Grouping (independent checkboxes, freely combinable):**\n\n- **Group by project** (default on) — sessions with a project fold into project rows; project rows and stray chats compete for position on the same timeline (a chat active two minutes ago sorts above a project last touched yesterday). Turn it off for a flat list.\n- **Group by device** (default on) — only appears when a remote device is connected; splits the list into device sections (this device first), each with a collapsible header showing the device name and online state. When the last remote device disconnects, the option disappears and the effect is lifted.\n- **Group chats together** (default on) — collects projectless sessions into one collapsible **Chat** group instead of interleaving them. With device grouping on, each device section gets its own Chat group with independent collapse state.\n- Grouping **by date** has been removed.\n\n**Sorting:**\n\n- **By time** (default) — one activity timeline for the whole list, most recent first. There is no oldest-first option.\n- **Priority** — sessions with an unread badge (finished unread, waiting for your reply, or errored) float to the top, then running sessions, then the rest by time. A project row inherits the highest priority among its sessions. Unread state is in-memory: after a restart most sessions fall back to time order.\n- **Manual** — drag project rows to set a persistent custom order. Manual order covers **project rows only**; stray chats and the Chat group always follow by recency. Dragging a project in any other sort mode automatically switches to Manual.\n- Sorting **alphabetically** and **oldest first** have been removed.\n\n**Filters (one row that opens a submenu):**\n\n- **Status** — active / archived / all.\n- **Project** — multi-select working directories, or \"all\".\n- **Agent** — Claude Code / Codex / all.\n- **Recent activity** — last 1 day / 3 days / 7 days / 30 days / all.\n- A **Reset filters** action at the bottom clears all four at once. Filters do **not** apply to the Pinned section.\n\n**Display:**\n\n- The main list has **Text** (compact single row) and **List** (two-line row with a preview) styles. Fresh installs default to List; installs upgraded from an older version keep Text so the sidebar looks the way it did before the upgrade. This is separate from the Pinned section's style.\n- **Session info** — choose what shows at the right edge of each row: **Time** (default), **PR status** (a status icon plus a monospace `#number`; only the icon is colored — green open / gray draft / red closed / accent merged; unknown state shows a gray icon; sessions without a PR show nothing), **Tokens** (compact total like `1.4M`), and **Cost** (`$`/`¥` by currency). Multi-select; items render in the order you selected them.\n\n**Pinning:**\n\n- Right-click a session and pick **Pin** to keep it at the top. There's no cap on the number of pinned sessions; a newly pinned session goes to the **front** of the pin order (most recent pin first).\n- Right-click a pinned session and pick **Unpin** to remove the pin.\n- Open a project's overflow menu and pick **Pin project** to move the whole project into **Pinned**. Project pins are independent from session pins, remain available after a restart or project rename, and can be expanded or collapsed inside **Pinned**.\n- Pinned projects and sessions share one draggable order. Newly pinned items move to the front, while the other pinned items keep their relative order. Use **Unpin project** to return a project to its position under the current project sorting mode.\n- The **Pinned** section keeps its own display style: **Text**, **List**, and **Card** — Card mode is exclusive to Pinned.\n\n**Collapse / expand all groups:**\n\n- The fold button next to the Organize button collapses or expands every group at once. With both device and project grouping on, it cycles through levels: collapse project groups → collapse device groups → expand all. The tooltip always names the next step.\n\n**Searching:**\n\n- The search box matches against the **session title only** — not message content and not the working directory path. If you can't remember a session's title, browse via project / agent filters instead.\n\n**Right-click actions:**\n\n- On a regular session: **Pin / Unpin**, **Rename**, **Move to project** (submenu), **Copy session link** (a `cindy://session/<id>` deep link), **Open in new window**, **Archive**, **Delete**.\n- On an archived session: **Rename**, **Unarchive**, **Copy session link**, **Delete**.\n\n**Removing a project from the sidebar:**\n\n- Open a local project's overflow menu and choose **Remove Project from Sidebar**. Cindy asks for confirmation, removes the project from the sidebar, and keeps its existing sessions available as projectless chats in the main list. Individually pinned sessions remain in **Pinned**. Those sessions are not archived or stopped, and files on your computer are not deleted.\n- To restore the project, choose **Add Project** and select the same directory again. Cindy restores the existing sessions under their original project grouping instead of creating an empty session.\n\n**Session statuses:**\n\n- Sessions are **active**, **archived**, or **deleted** — there are no other states. Archiving hides a session from the default view without removing it; delete is unrecoverable from the UI.\n\n**Notes:**\n\n- Click the sidebar collapse arrow to shrink it to an icon-only strip — that's purely visual, you don't lose any features.\n- **Pin state, order, hidden projects, project filters, and identity-based collapse/selection state are isolated per Cindy account.** Pin and hidden-project changes sync across open windows for the same account. Display-only preferences (list style, grouping toggles, sorting, session info) remain local to each window, so they don't sync between, say, a dev window and the installed app.",
+ content: "The left sidebar lists your sessions. It's the main way to navigate and organize. The **Organize sidebar** menu holds grouping, sorting, filters, and display options — open it from the sliders icon on the **All sessions** header, or right-click any blank area of the sidebar.\n\n**Grouping (independent checkboxes, freely combinable):**\n\n- **Group by project** (default on) — sessions with a project fold into project rows; project rows and stray chats compete for position on the same timeline (a chat active two minutes ago sorts above a project last touched yesterday). Turn it off for a flat list.\n- **Group by device** (default on) — only appears when a remote device is connected; splits the list into device sections (this device first), each with a collapsible header showing the device name and online state. When the last remote device disconnects, the option disappears and the effect is lifted.\n- **Group chats together** (default on) — collects projectless sessions into one collapsible **Chat** group instead of interleaving them. With device grouping on, each device section gets its own Chat group with independent collapse state.\n- Grouping **by date** has been removed.\n\n**Sorting:**\n\n- **By time** (default) — one activity timeline for the whole list, most recent first. There is no oldest-first option.\n- **Priority** — four tiers, same as Codex: sessions waiting on you (pending reply / approval / error) first, then finished-unread sessions, then running sessions, then the rest by time. A project row inherits the highest priority among its sessions. Unread state is in-memory: after a restart most sessions fall back to time order.\n- **Manual** — drag project rows to set a persistent custom order. Manual order covers **project rows only**; stray chats and the Chat group always follow by recency. Dragging a project in any other sort mode automatically switches to Manual.\n- Sorting **alphabetically** and **oldest first** have been removed.\n\n**Filters (one row that opens a submenu):**\n\n- **Status** — active / archived / all.\n- **Project** — multi-select working directories, or \"all\".\n- **Agent** — Claude Code / Codex / all.\n- **Recent activity** — last 1 day / 3 days / 7 days / 30 days / all.\n- A **Reset filters** action at the bottom clears all four at once. Filters do **not** apply to the Pinned section.\n\n**Display:**\n\n- The main list has **Text** (compact single row) and **List** (two-line row with a preview) styles. Fresh installs default to List; installs upgraded from an older version keep Text so the sidebar looks the way it did before the upgrade. This is separate from the Pinned section's style.\n- **Session info** — choose what shows at the right edge of each row: **Time** (default), **PR status** (a status icon plus a monospace `#number`; only the icon is colored — green open / gray draft / red closed / accent merged; unknown state shows a gray icon; sessions without a PR show nothing), **Tokens** (compact total like `1.4M`), and **Cost** (`$`/`¥` by currency). Multi-select; items render in the order you selected them.\n\n**Pinning:**\n\n- Right-click a session and pick **Pin** to keep it at the top. There's no cap on the number of pinned sessions; a newly pinned session goes to the **front** of the pin order (most recent pin first).\n- Right-click a pinned session and pick **Unpin** to remove the pin.\n- Open a project's overflow menu and pick **Pin project** to move the whole project into **Pinned**. Project pins are independent from session pins, remain available after a restart or project rename, and can be expanded or collapsed inside **Pinned**.\n- Pinned projects and sessions share one draggable order. Newly pinned items move to the front, while the other pinned items keep their relative order. Use **Unpin project** to return a project to its position under the current project sorting mode.\n- The **Pinned** section keeps its own display style: **Text**, **List**, and **Card** — Card mode is exclusive to Pinned.\n\n**Collapse / expand all groups:**\n\n- The fold button next to the Organize button collapses or expands every group at once. With both device and project grouping on, it cycles through levels: collapse project groups → collapse device groups → expand all. The tooltip always names the next step.\n\n**Searching:**\n\n- The search box matches against the **session title only** — not message content and not the working directory path. If you can't remember a session's title, browse via project / agent filters instead.\n\n**Right-click actions:**\n\n- On a regular session: **Pin / Unpin**, **Rename**, **Move to project** (submenu), **Copy session link** (a `cindy://session/<id>` deep link), **Open in new window**, **Archive**, **Delete**.\n- On an archived session: **Rename**, **Unarchive**, **Copy session link**, **Delete**.\n\n**Removing a project from the sidebar:**\n\n- Open a local project's overflow menu and choose **Remove Project from Sidebar**. Cindy asks for confirmation, removes the project from the sidebar, and keeps its existing sessions available as projectless chats in the main list. Individually pinned sessions remain in **Pinned**. Those sessions are not archived or stopped, and files on your computer are not deleted.\n- To restore the project, choose **Add Project** and select the same directory again. Cindy restores the existing sessions under their original project grouping instead of creating an empty session.\n\n**Session statuses:**\n\n- Sessions are **active**, **archived**, or **deleted** — there are no other states. Archiving hides a session from the default view without removing it; delete is unrecoverable from the UI.\n\n**Notes:**\n\n- Click the sidebar collapse arrow to shrink it to an icon-only strip — that's purely visual, you don't lose any features.\n- **Pin state, order, hidden projects, project filters, and identity-based collapse/selection state are isolated per Cindy account.** Pin and hidden-project changes sync across open windows for the same account. Display-only preferences (list style, grouping toggles, sorting, session info) remain local to each window, so they don't sync between, say, a dev window and the installed app.",
},
{
id: "skills",
diff --git a/apps/desktop/src/renderer/__tests__/mainListModel.test.ts b/apps/desktop/src/renderer/__tests__/mainListModel.test.ts
index 0ffcf64a03..4895c290d8 100644
--- a/apps/desktop/src/renderer/__tests__/mainListModel.test.ts
+++ b/apps/desktop/src/renderer/__tests__/mainListModel.test.ts
@@ -138,27 +138,42 @@ describe('buildMainListEntries — 排序口径', () => {
expect(labels(entries)).toEqual(['p:alpha', 's:old']);
});
- it("floats attention > running > rest under 'priority', recency within tiers", () => {
- const attention = session({ updatedAt: '2026-08-01T00:00:00Z', title: 'needs-input' });
+ it("floats waiting > unread > running > rest under 'priority', recency within tiers", () => {
+ // 四档对齐 Codex(waiting:0 / unread:1 / active:2 / idle:3,2026-08-13 裁决)。
+ const waiting = session({ updatedAt: '2026-07-20T00:00:00Z', title: 'needs-input' });
+ const unread = session({ updatedAt: '2026-08-01T00:00:00Z', title: 'done-unread' });
const running = session({ updatedAt: '2026-08-05T00:00:00Z', title: 'running' });
const idleNewest = session({ updatedAt: '2026-08-12T00:00:00Z', title: 'idle' });
const ctx = {
runningSessionIds: new Set([running.id]),
- attentionSessionIds: new Set([attention.id]),
+ attentionSessionIds: new Set([waiting.id, unread.id]),
+ waitingSessionIds: new Set([waiting.id]),
};
- expect(sessionPriorityRank(attention, ctx)).toBe(0);
- expect(sessionPriorityRank(running, ctx)).toBe(1);
- expect(sessionPriorityRank(idleNewest, ctx)).toBe(2);
+ expect(sessionPriorityRank(waiting, ctx)).toBe(0);
+ expect(sessionPriorityRank(unread, ctx)).toBe(1);
+ expect(sessionPriorityRank(running, ctx)).toBe(2);
+ expect(sessionPriorityRank(idleNewest, ctx)).toBe(3);
const entries = buildMainListEntries({
projects: [],
- dialogues: [idleNewest, running, attention],
+ dialogues: [idleNewest, running, unread, waiting],
groupBy: 'project',
groupDialogue: false,
sortBy: 'priority',
manualProjectOrder: [],
priorityContext: ctx,
});
- expect(labels(entries)).toEqual(['s:needs-input', 's:running', 's:idle']);
+ expect(labels(entries)).toEqual(['s:needs-input', 's:done-unread', 's:running', 's:idle']);
+ });
+
+ it('waitingSessionIds 缺省时全部 attention 落 unread 档(老调用方零迁移)', () => {
+ const attention = session({ updatedAt: '2026-08-01T00:00:00Z', title: 'attn' });
+ const running = session({ updatedAt: '2026-08-05T00:00:00Z', title: 'running' });
+ const ctx = {
+ runningSessionIds: new Set([running.id]),
+ attentionSessionIds: new Set([attention.id]),
+ };
+ expect(sessionPriorityRank(attention, ctx)).toBe(1);
+ expect(sessionPriorityRank(running, ctx)).toBe(2);
});
it('a project inherits its best session priority (group floats with its members)', () => {
diff --git a/apps/desktop/src/renderer/features/cc-agent/lib/mainListModel.ts b/apps/desktop/src/renderer/features/cc-agent/lib/mainListModel.ts
index 1ee4274f8e..9934779ede 100644
--- a/apps/desktop/src/renderer/features/cc-agent/lib/mainListModel.ts
+++ b/apps/desktop/src/renderer/features/cc-agent/lib/mainListModel.ts
@@ -12,8 +12,10 @@
* 排序语义:
* - recency:条目活动时间(组取组内最新)倒序——最近的在上。
* - time:同一时间轴正序——最早的在上(沿用现状「最早优先」)。
- * - priority:等待处理(attention)> 运行中 > 其余;同档内按 recency。
- * 权重口径与 sidebarRightStatus.ts 的右侧状态槽一致("需要你处理"最高)。
+ * - priority:等你处理(waiting)> 完成未读(unread)> 运行中 > 其余;同档内按
+ * recency。四档口径对齐 Codex 侧栏的优先级排序(waiting:0 / unread:1 /
+ * active:2 / idle:3,2026-08-13 用户裁决"参考 Codex"):此前三档把「等你
+ * 回答」和「跑完没看」混在同一档,完成未读一多就把真正要回应的淹掉。
* - manual:项目行按 manualProjectOrder;散排对话与对话组不进手动顺序,
* 排在项目之后按 recency(设计文档 §9.3 的收窄裁决:手动排序只管项目行,
* 避免数百条散排对话冲乱顺序表)。
@@ -36,6 +38,13 @@ export interface MainListPriorityContext {
runningSessionIds: ReadonlySet<string>;
/** 需关注(等待确认 / 完成未读等 attention 通知)的 sessionIds。 */
attentionSessionIds: ReadonlySet<string>;
+ /**
+ * attention 里「等你处理」的子集:等待回复 / 授权 / 计划审阅(awaiting)与
+ * 出错未处理(error)。attentionSessionIds 减去它 = 完成未读(done)。
+ * 可缺省(空集):此时全部 attention 落进 unread 档——排序仍然成立,只是
+ * 少了 waiting 细分(老调用方 / 测试夹具零迁移成本)。
+ */
+ waitingSessionIds?: ReadonlySet<string>;
}
const EMPTY_PRIORITY_CONTEXT: MainListPriorityContext = {
@@ -43,11 +52,18 @@ const EMPTY_PRIORITY_CONTEXT: MainListPriorityContext = {
attentionSessionIds: new Set<string>(),
};
-/** 单会话优先级权重:需关注 0 > 运行中 1 > 其余 2。 */
+/**
+ * 单会话优先级权重(对齐 Codex 的 waiting:0 / unread:1 / active:2 / idle:3):
+ * 等你处理 0 > 完成未读 1 > 运行中 2 > 其余 3。waiting 压过 unread:「要你回应
+ * 才能继续」比「跑完了等你看」急;unread 压过 running:running 不需要你动手,
+ * 而 unread 是已经可以处理的结果。
+ */
export function sessionPriorityRank(session: Session, ctx: MainListPriorityContext): number {
- if (ctx.attentionSessionIds.has(session.id)) return 0;
- if (ctx.runningSessionIds.has(session.id)) return 1;
- return 2;
+ if (ctx.attentionSessionIds.has(session.id)) {
+ return ctx.waitingSessionIds?.has(session.id) ? 0 : 1;
+ }
+ if (ctx.runningSessionIds.has(session.id)) return 2;
+ return 3;
}
function entryActivityMs(entry: MainListEntry): number {
@@ -64,7 +80,7 @@ function entryActivityMs(entry: MainListEntry): number {
function entryPriorityRank(entry: MainListEntry, ctx: MainListPriorityContext): number {
if (entry.kind === 'session') return sessionPriorityRank(entry.session, ctx);
const sessions = entry.kind === 'project' ? entry.project.sessions : entry.sessions;
- let min = 2;
+ let min = 3;
for (const s of sessions) {
const rank = sessionPriorityRank(s, ctx);
if (rank < min) min = rank;
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx
index 1f525d89e3..9840f46192 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx
@@ -59,6 +59,8 @@ import {
type MainListEntry,
} from '../../lib/mainListModel';
import { buildSessionSourceLabelMap } from '../../lib/sessionSourceLabel';
+import { useSessionAttentionKinds } from '@/lib/sessionAttentionStore';
+import { useSessionAttentionUrgencySet } from '../../contexts/SessionAttentionUrgencyContext';
import type { DialogueDeviceTarget } from '../../lib/dialogueCreateTarget';
import { SidebarFilterPopover } from '../SidebarFilterPopover';
import { SectionCollapse } from '../SectionCollapse';
@@ -259,6 +261,20 @@ export function ProjectsSection({
// 文字搜索是独立面板、不在本段内联过滤,故无需为它禁用。
const disableSessionCollapse = false;
+ // 优先级排序的 waiting 子集(等你处理:awaiting / error / 定时任务失败未读)。
+ // 整表订阅仅限本聚合组件(store 头注的性能边界):本组件本就随 notifications
+ // 整集变化重渲染,kinds 表与它同源同节拍,不额外放大。urgentSet 语义对齐
+ // SessionItem 行内状态(isUrgentFromContext 视同 error)。
+ const attentionKinds = useSessionAttentionKinds();
+ const urgentSet = useSessionAttentionUrgencySet();
+ const waitingSessionIds = useMemo(() => {
+ const waiting = new Set<string>(urgentSet);
+ for (const [sessionId, kind] of attentionKinds) {
+ if (kind === 'awaiting' || kind === 'error') waiting.add(sessionId);
+ }
+ return waiting;
+ }, [attentionKinds, urgentSet]);
+
// 混排模型(D 期):项目行 / 散排对话 / 对话组统一为顶层条目并按同一口径排序。
// 这有意推翻旧「Dialogue 固定段在 Projects 之后」的裁决(mainListModel.ts 文件头)。
const mixedEntries = useMemo(
@@ -273,6 +289,7 @@ export function ProjectsSection({
priorityContext: {
runningSessionIds,
attentionSessionIds: notifications,
+ waitingSessionIds,
},
}),
[
@@ -284,6 +301,7 @@ export function ProjectsSection({
filter.manualProjectOrder,
runningSessionIds,
notifications,
+ waitingSessionIds,
],
);
diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json
index 52925d0970..b7f8bcafee 100644
--- a/apps/desktop/src/renderer/i18n/locales/en/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json
@@ -7020,7 +7020,7 @@
"priority": "Priority"
},
"filterSortByTip": {
- "priority": "Unread or waiting on you first, then running, then by time"
+ "priority": "Waiting on you first, then unread, then running, then by time"
},
"filterStatusHeading": "Status",
"filterAgentHeading": "Agent",
diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.json
index 9d2f4c583f..86ebed6105 100644
--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json
@@ -7008,7 +7008,7 @@
"priority": "優先度"
},
"filterSortByTip": {
- "priority": "未読・要対応を最上位に、次に実行中、残りは時間順"
+ "priority": "要対応を最上位に、次に未読、実行中、残りは時間順"
},
"filterStatusHeading": "ステータス",
"filterAgentHeading": "エージェント",
diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.json
index 49d1cf180e..5459ae94db 100644
--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json
@@ -7008,7 +7008,7 @@
"priority": "우선순위"
},
"filterSortByTip": {
- "priority": "읽지 않았거나 확인이 필요한 항목 먼저, 다음 실행 중, 나머지는 시간순"
+ "priority": "확인이 필요한 항목 먼저, 다음 읽지 않음, 실행 중, 나머지는 시간순"
},
"filterStatusHeading": "상태",
"filterAgentHeading": "에이전트",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
index 43f63ecc2d..92423ee724 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
@@ -7004,7 +7004,7 @@
"priority": "优先级"
},
"filterSortByTip": {
- "priority": "有未读或等你处理的排在最前,然后是运行中的,其余按时间"
+ "priority": "等你处理的排在最前,然后是未读、运行中,其余按时间"
},
"filterStatusHeading": "状态",
"filterAgentHeading": "Agent",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
index 3c7f93735a..a12a19480a 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
@@ -7007,7 +7007,7 @@
"priority": "優先級"
},
"filterSortByTip": {
- "priority": "有未讀或等你處理的排在最前,然後是執行中的,其餘按時間"
+ "priority": "等你處理的排在最前,然後是未讀、執行中,其餘按時間"
},
"filterStatusHeading": "狀態",
"filterAgentHeading": "Agent",
diff --git a/docs/product-rules/sidebar-redesign-plan.md b/docs/product-rules/sidebar-redesign-plan.md
index 76e00088c1..2664822b8f 100644
--- a/docs/product-rules/sidebar-redesign-plan.md
+++ b/docs/product-rules/sidebar-redesign-plan.md
@@ -104,7 +104,7 @@
| 选项 | 默认 | 行为 |
|---|---|---|
| 按时间排序 | **是** | 顶层条目按组内最新活动时间倒序(最近的在前);组内同。排序时钟 = `userSendAt ?? updatedAt`(以用户最近一次按下发送为主键,agent 回复只 bump `updatedAt` 不重排) |
-| 优先级 | | 需你处理(未读 / 等待确认)> 运行中 > 其余按最近活动;同档内仍按最近活动 |
+| 优先级 | | 四档,对齐 Codex(2026-08-13 用户裁决「参考 Codex」):等你处理(等待回复 / 授权 / 出错)> 完成未读 > 运行中 > 其余;同档内按最近活动 |
| 手动排序 | | 顶层条目可拖拽,顺序持久;新条目进顶部 |
「按名称排序」(现状 alphabetic)删除。**「最早优先」(旧 `time`)2026-08-12 用户
@@ -120,17 +120,23 @@
不配说明——菜单不该变成说明书。说明挂在选项表的 `tipKey` 上(与 `labelKey` /
`Icon` 同源),`side="right"`(菜单贴侧栏右缘,提示往上下会压住相邻选项)。
-实现口径的两点澄清(与本表措辞对齐):
-- **第一档的真实语义是「有未读角标」,不只是「等待确认」**。`attentionSessionIds`
- 喂进来的是侧栏未读集合,含三种 kind:`awaiting`(等你回复 / 授权 / 审阅计划)、
- `error`(出错未处理)、`done`(跑完还没点开)。所以**跑完没看的任务也会被顶到
- 最前**——这是有意的(它同样"需要你处理一下"),但与"等待确认"的字面理解不同,
- 故文案写「有未读或等你处理的」而非「等待确认」。三种 kind 在排序上**不再分级**
- (都是 rank 0),`sidebarRightStatus.ts` 的 `error > awaiting > done` 只决定右侧
- 状态槽的**颜色**,不参与排序——原表述说「权重复用该优先级函数」不准确,已更正。
+实现口径的澄清(与本表措辞对齐):
+- **四档口径(2026-08-13 定稿,对齐 Codex)**。Codex 侧栏优先级排序的权重表是
+ `waiting:0 / unread:1 / active:2 / idle:3`(反编译其桌面端确认;它连置顶区都
+ 提供同款排序,菜单项也带同样的 tooltip 说明——「Needs input and unread chats
+ first」)。本仓映射:waiting = attention kind 为 `awaiting`(等你回复 / 授权 /
+ 审阅计划)或 `error`(出错未处理)∪ 定时任务失败未读(urgency 集);unread =
+ 其余 attention(`done`,跑完还没点开);active = running。此前实现是三档
+ (attention 整体一档),完成未读一多就把真正等回应的淹掉——四档修正了这一点。
+ Codex 没有单独的 error 档(error 归 waiting),本仓同款,不另加档。
+ `sidebarRightStatus.ts` 的 `error > awaiting > done` 只决定右侧状态槽的
+ **颜色**,不参与排序。
+- **`waitingSessionIds` 在模型上可缺省**:缺省时全部 attention 落 unread 档,
+ 排序仍成立(老调用方 / 测试夹具零迁移);组装层(ProjectsSection)从
+ `useSessionAttentionKinds` + urgency 集派生 waiting 子集喂入。
- **未读是内存态,重启即失**(`sessionAttentionStore` 不落盘)。重启后只有两类点
- 会由 `usePendingAlertAttention` 从 DB 重建:未收尾的中断、未处置的错误尾行。
- 「跑完没看」的绿点不重建。因此**重启后优先级排序的结果会明显不同于重启前**,
+ 会由 `usePendingAlertAttention` 从 DB 重建:未收尾的中断、未处置的错误尾行——
+ 它们恰好都是 waiting 档,重建后仍排最前。「跑完没看」的 unread 档不重建,
多数任务落回按时间排。这是既有架构的性质,不是本次排序引入的缺陷。
### 3.3 筛选 —— 一级只占一行,展开二级菜单