feat(desktop): 通知新增应用级提示音通道 (#3177) - #3257
Conversation
后台跑长任务时,OS 通知音可能被勿扰/专注助手吞掉;Windows/Linux 又没有灵动岛的音效系统,完成/待回复/出错时用户无感。 - 会话事件通知新增 sound 通道:fireSessionNotification 裁决点 (失焦 gate、Orca worker 聚合、灵动岛去重之后)播放应用内置提示音, 并把该条系统 toast 置静音,避免 OS 音与应用音双响; - 提示音资产与事件映射复用灵动岛内置音效及语义: done→gem-collect / error→error-buzz / needs-reply→secret-chime; renderer 直接 new Audio 播放,失败静默降级不阻断通知; - 设置「通知」区块新增独立开关(默认开),localStorage 持久化; - 未传 sound 通道的调用方保持 Electron 默认行为,零改动兼容。 Signed-off-by: 宁凯 <ningkaikok@163.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3ba0c7ae53
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
| Filename | Overview |
|---|---|
| apps/desktop/src/renderer/lib/notificationSound.ts | 实现提示音映射、同类事件合并、冷却、焦点取消与 500ms 启动超时,失败时返回 false 以保留系统声音。 |
| apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx | 在既有会话通知裁决点播放提示音,并在等待后重新校验焦点和数据所有者,再分发各通知通道。 |
| apps/desktop/src/main/notificationService.ts | 校验新增 sound 字段,并仅在 renderer 确认应用音已覆盖时为 Electron toast 设置 silent。 |
| apps/desktop/src/renderer/hooks/useNotificationSettings.ts | 增加应用提示音偏好的默认值、持久化和恢复默认能力。 |
| apps/desktop/src/renderer/components/settings/NotificationSection.tsx | 在通知设置中增加独立的声音提醒开关和恢复默认入口。 |
Reviews (8): Last reviewed commit: "docs(desktop): clarify notification soun..." | Re-trigger Greptile
|
@ningkaikok 👋 这个 PR 还有 2 条 review conversation 没 resolve(apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
|
这个 PR 给通知加了应用级提示音和设置入口,用户听得见也看得到,维护者确认门按产品类拦住了。请维护者在本 PR 上 Approve 放行,或 Request Changes 说明要改什么。讨论 issue:#3259 |
|
命中 UI 路径(apps/desktop/src/renderer/assets/sounds/error-buzz.mp3 / apps/desktop/src/renderer/assets/sounds/gem-collect.mp3 / apps/desktop/src/renderer/assets/sounds/secret-chime.mp3 等)但 description 未附界面效果证据——建议补充改动后效果:截图/录屏,或改动后界面的 HTML 页面(```html 代码块、.html 附件或在线预览链接),便于确认界面符合 DESIGN.md 设计规范 |
review P2:playSessionEventSound 原实现吞掉 audio.play() 的 rejection, 但调用方仍无条件传 sound:true → 播放失败(autoplay 被拒/资源缺失)时 系统通知被置静音,用户反而完全听不到提醒。 - playSessionEventSound 改为返回 Promise<boolean>:play() resolve = 实际出声,reject = 未发声; - fireSessionNotification 先 await 播放结果,soundOn 才写进 channels, 失败时保持 Electron 默认(silent:false),OS 通知音照常。 Signed-off-by: 宁凯 <ningkaikok@163.com>
|
已修复(5a7859f18): |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5a7859f185
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@ningkaikok 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
Signed-off-by: Dash <dashhuang@gmail.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0786171118
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Dash <dashhuang@gmail.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c1f36d8821
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@ningkaikok 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
Signed-off-by: Dash <dashhuang@gmail.com>
|
@ningkaikok 👋 这个 PR 目前与 请在本地 merge 最新的 |
…n-chime Signed-off-by: 宁凯 <ningkaikok@163.com> # Conflicts: # apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b84cd73695
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@ningkaikok 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/src/renderer/lib/notificationSound.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
review P1:同一批状态更新里多个会话同时完成/报错/待回复时, 每个事件都独立播放一个 Audio,多个相同 mp3 叠加失真;且各次 play() 都成功导致对应系统通知全部静音,用户只听到重叠噪音。 - 新增同类 1.5s 冷却(与灵动岛同语义路径的每类冷却一致): 冷却窗口内的同类事件不再叠加播放,但返回 true 让其 toast 照常静音——用户毫秒级前刚听过同一个音,无需 OS 音再补; - 只统计成功播放:上次失败不进入冷却,同批后续事件仍会重试, 保证至少一条可听提醒(P2 语义不变); - 冷却按 kind 独立,不同终态音互不抑制。 Signed-off-by: 宁凯 <ningkaikok@163.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2cac4457fb
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@ningkaikok 👋 这个 PR 还有 3 条 review conversation 没 resolve(apps/desktop/src/renderer/lib/notificationSound.ts / apps/desktop/src/renderer/hooks/useNotificationSettings.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
Signed-off-by: 宁凯 <ningkaikok@163.com>
Signed-off-by: 宁凯 <ningkaikok@163.com>
|
这轮 CI 的真实失败只有 Windows 1/2 中一个与本 PR 改动无关的超时:
本 PR 没有修改 我尝试执行 Re-run failed jobs,但 fork 作者没有上游仓库 Actions 的管理权限。麻烦维护者帮忙重跑本轮失败 jobs;如同一个 manager.scope 用例重跑后仍稳定超时,再另开维护项处理 Windows 文件系统测试预算,不在本功能 PR 中夹带修改。 |
这次改了什么
摯要
为会话事件通知新增应用级提示音通道(#3177)。后台跑长任务时,OS 通知音可能被勿扰/专注助手吞掉;Windows/Linux 又没有灵动岛的音效系统——完成/待回复/出错时用户完全无感。
实现遵循 issue 下维护者分析的边界:声音决策挂在现有唯一裁决点(
fireSessionNotification的失焦 gate、Orca worker 聚合、灵动岛去重之后),不在权限回调或确认卡组件里散播播放调用;提示音资产与事件映射复用灵动岛内置音效及语义(#3082 的经验)。变更类型
feat新功能范围
sound通道:开启时 renderer 在本地播放内置提示音,并把对应系统 toast 置静音(silent: true),避免 OS 音与应用音双响;未传时保持 Electron 默认行为,老调用方零改动done→gem-collect、error→error-buzz、needs-reply→secret-chime),Vite asset import 引入,跨平台可用showDesktopSessionEventmain 直发)的应用级声音——该路径保持 OS 行为,如需覆盖可后续单独接UI 变化
docs/design-rules/DESIGN.md怎么验证的
自动验证
手工验证
macOS dev 构建(隔离沙箱)实机验证,通过 CDP 注入 Audio 探针观察真实播放行为:
gem-collect.mp3实际播放(play()resolve,探针记录played: true);NotAllowedError拒绝 →playSessionEventSound返回false且不抛错,channels.sound保持 false,OS 通知音保留;未执行的验证
play().catch静默失败,单测锁定不抛出)。风险
风险分类
影响与回滚
提交前检查
git commit -s,见 DCO)