[Bug] Desktop 3.11.2 点击任务完成系统通知后定位到第一个任务,而非完成的任务
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 22
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
提交前确认 · Pre-submission checklist
- 我已搜索过现有 issue,确认这不是重复 / I searched existing issues and confirmed this isn't a duplicate.
- 我已阅读 CONTRIBUTING.md / I've read CONTRIBUTING.md.
问题类别 · Category
UI / 界面体验 · UI / UX
涉及的 Agent 框架 · Agent framework
ZCode Agent(自研)
严重程度 · Severity
影响体验 · Major (功能可用但体验受损 / works but degraded)
复现频率 · Reproducibility
必现 · Always
问题描述 · Description
并行运行多个任务时,某个任务完成会弹出系统通知。点击该通知打开 ZCode 后,界面定位到第一个任务,而不是弹通知的那个已完成的任务。并行任务多时每次都要手动再找一遍目标任务,通知的快速定位作用失效。
复现步骤 · Steps to reproduce
- 在工作区并行运行多个任务
- 切到其他应用,让 ZCode 保持后台(注:ZCode 前台时不弹系统通知,此 bug 仅在后台收通知时触发)
- 等待某个任务完成,弹出系统通知
- 点击该系统通知
期望表现 · Expected behavior
打开 ZCode 并定位到发出通知的那个已完成的任务。
实际表现 · Actual behavior
打开 ZCode 后定位到第一个任务,不是完成的任务。
ZCode 版本 · ZCode version
3.11.2.6792
设备 / 系统 / 浏览器 · Device / OS / Browser
Windows 11 (10.0.26200) x64 · Desktop
截图 / 录屏 / 日志 · Screenshots / Recordings / Logs
无截图;以下为基于本机安装包 resources/app.asar(3.11.2.6792, out/main/index.js + renderer bundle)的静态分析,供定位参考:
- 主进程
dispatchTaskNotification:通知点击后revealWindow(sender)并向 sender 窗口发送 IPCzcode:task-notification-click,payload 仅含 taskId - 渲染层 Root 的
onTaskNotificationClick:遍历workspaces,用taskListCache.find(taskId)或activeTaskId === taskId匹配;命中后按workspacePath(+ 可选workspaceIdentity)打开工作区并调用setActiveTaskId - 可疑点:
- taskId 在所有工作区的
taskListCache均未命中且不等于任何activeTaskId时,仅记录 warntask not found in any workspace后静默返回——窗口被聚焦但无跳转,界面停在默认选中(第一个任务) - 命中
activeTaskId === taskId但taskListCache未命中该任务时,workspaceIdentity取值为 undefined,仅按workspacePath打开;同一项目路径下多个并行任务/多标签时无法唯一定位 - 工作区打开与
setActiveTaskId之间可能存在竞态:任务列表异步加载完成后的默认选中(第一个任务)可能覆盖此前设置的目标任务
- taskId 在所有工作区的
- 修改建议:click IPC payload 携带完整定位坐标(taskId + workspacePath + workspaceIdentity)做精确路由;cache 未命中时不要静默失败;待任务列表加载完成后再应用目标任务
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the packaged entry points named in the report: out/main/index.js and the renderer bundle, focusing on dispatchTaskNotification and onTaskNotificationClick. Trace the task-notification-click payload through workspace opening and task selection; the fix is complete when clicking a completion notification opens the notifying workspace and selects that completed task, including parallel tasks sharing a path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100