makecindy / makecindy/cindy

Bug: macOS Dock 角标无法消除,被控设备远程任务与本机自动化任务被计入本机关注总数(0.1.81)

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

Description

### 问题描述 / What happened

升级到 0.1.81 后,macOS Dock 上 Cindy 图标出现红色数字角标(我这台是 **39**),与本机实际需要处理的任务数不符,且**无法消除**:点进任务、把 Cindy 窗口点到前台、把会话读到已读,数字都不变。

侧栏里几乎看不到对应数量的未读点。

实际行为:Dock 角标 = 39 且恒定不变。
期望行为:Dock 角标只反映**本机**需要用户处理的任务数;被控设备的远程任务、本机自动化(定时任务)不应污染本机角标。

### 环境 / Environment

- Cindy 版本或 commit:0.1.81(com.xd.cindycn,热更 0.1.79 → 0.1.81 后重启出现)
- 平台与版本:macOS (Apple Silicon)
- 安装方式:官方包 + beta 热更

### 复现步骤 / Steps to reproduce

1. 本机通过 device-link 连接过一台被控设备(家用 Mac),镜像缓存里同步了对方的会话列表。
2. 本机也跑着若干定时任务(自动化)会话。
3. 升级到 0.1.81 并重启 Cindy。
4. Dock 图标立即出现数字角标(39),此后无论点击任务 / 聚焦窗口 / 读会话都不变化。

### 根因分析 / Root cause

`#4361`(fix(desktop): 统一关注总数并补齐 Windows 数字角标)把 Dock 角标从「未读会话集合大小」改成由 renderer 投影的关注总数:

- `apps/desktop/src/renderer/features/cc-agent/lib/appAttentionCount.ts` 的 `countAppAttention` 输入包含
`useRemoteProjectSessions()`(device-link 被控设备镜像)、`getRemoteSessionActivity`(远程活动)
以及 `localSchedules` / `remoteSchedules`(定时任务未读)。
→ **被控设备的远程任务和自动化任务都被计入本机 Dock 角标**。远程会话在本机没有可点击的任务行、
也没有可清除的入口,所以数字只增不减、点不掉。
- 同一 PR 在 `bootstrap-electron.ts` 删掉了「任一 Cindy 窗口回到前台即清空角标」的行为
(原 `syncAppFocusState(clearAttentionWhenFocused)`),于是用户失去了唯一的收敛手段。

本机实测数据(用于确认 39 的来源):

- `owners//device-link-mirror-cache/session-list.json`:1 台被控设备「家用」,**79 个会话,其中 75 个是 `[Schedule]` 自动化会话**。
- 本机侧:启动(10:08)至今只有 6 个会话有新消息、1 次定时任务触发,本机未读定时任务为 0。
- 即:39 不可能来自本机任务,只能来自「被控设备远程任务 + 自动化任务」。

### 期望修复方向

系统角标只统计本机需要用户处理的**非自动化**任务:排除远程(device-link)会话与自动化(scheduler/learn)会话,其未读仍由各自的界面(设备分组 / 自动化页)表达。

### 相关 / Related

- 上游已有同方向修复 PR:#4430 `fix(desktop): 排除远程和自动化角标`(截至提交本 issue 时仍为 OPEN、未合并)。

Contributor guide

Open the contributing guide

Research direction

Start with apps/desktop/src/renderer/features/cc-agent/lib/appAttentionCount.ts and inspect how useRemoteProjectSessions(), getRemoteSessionActivity, localSchedules, and remoteSchedules contribute to the count. Compare the proposed direction with open PR #4430; done means the macOS Dock badge counts only local, non-automation tasks and can converge when those tasks are handled.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.