Skip to content

[Bug]: macOS 端系统通知完全不生效(1.0.10 / macOS 27.2,开关已开启) #3924

Open

Description

@tecgic

Related: #3824(功能建议「系统级通知与分类型提示音」,基于 1.0.9 提交)。本 issue 报告的是 1.0.10 上「开关已开启、但实现静默失效」的具体 bug,两者相关但性质不同。

摘要

在 macOS 27.2 (26B123) + OpenBitFun 1.0.10 上,「任务完成通知」和「权限请求通知」两个开关均已开启,但任务完成 / 需要用户决策时没有任何系统横幅,也没有任何声音。关闭官方玩偶挂件后,应用处于完全没有提醒的状态。

复现步骤

  1. 打开设置 → 应用 → 通用,确认 Completion notifications / Permission request notifications 均为开启。
  2. 关闭 agent companion(玩偶挂件),排除挂件作为唯一提醒通道。
  3. 在任意本地工作区发起一轮任务,让它正常跑完;再触发一次需要用户选择的操作(如 AskUserQuestion)。
  4. 观察:无系统通知横幅、无通知声音、无日志报错。

实际结果

  • 无横幅、无声音、无错误提示;用户完全无法感知任务已结束或正在等待自己拍板。

期望结果

  • 任务完成时发出系统通知(且可配置提示音)。
  • 需要用户决策/授权时发出系统通知(独立开关、独立提示音,这类是阻塞事件,优先级最高)。

环境与配置证据

macOS              27.2 (26B123)
OpenBitFun         1.0.10 (CFBundleIdentifier com.openbitfun.desktop)
签名               Developer ID Application: SHICHAO JIANG (X5G953468Z), Notarization Ticket=stapled
架构               arm64 (Mach-O thin)

~/Library/Application Support/openbitfun/config/app.json:

"version": "1.0.10",
"app.notifications": {
  "enabled": true,
  "dialog_completion_notify": true,
  "permission_request_notify": true,
  "duration": 5000,
  "position": "topRight"
},
"app.hooks": { "enabled": true, "project_hooks_enabled": false },
"app.ai_experience.enable_agent_companion": false

设置界面的能力声明(二进制内字符串):

"Send an OS notification when session work completes."
"Send an OS notification when an agent waits for permission."
"path": "app.notifications.dialog_completion_notify"
"path": "app.notifications.permission_request_notify"

根因线索(高概率)

二进制 Contents/MacOS/openbitfun-desktop 中的通知实现符号:

NSUserNotification
NSUserNotificationCenter
NSUserNotificationCenterDelegate
NSUserNotificationDefaultSoundName
notify_rust::macos::nsusernotifications
mac_notification_sys::bridge

环境中未发现 UNUserNotificationCenter / UserNotifications.framework 相关符号。注意:这只是对发布二进制的字符串检索,不能排除使用动态调用等实现,请团队以源码为准。

NSUserNotification / NSUserNotificationCenter 自 macOS 11 起已被 Apple 标记为 deprecated,推荐改用 UNUserNotificationCenter。在本机现象上,调用似乎没有产生任何可见结果,也没有报错日志;是否与已废弃 API、notify_rust/mac_notification_sys 的注册或授权流程有关,需要团队确认。

补充旁证:

  • codesign -d --entitlements 输出中仅有 com.apple.security.device.audio-input,未见通知相关 entitlement(macOS 通常不强制要求,仅作排查点)。
  • 本机上按常规路径检索 NotificationCenter 偏好数据,未找到 com.openbitfun.desktop 的记录;由于新版 macOS 的数据位置可能与预期不同,此项仅作弱旁证,不能据此断定 app 未注册。
  • 用户最近几次会话的 app.log / ai.log / webview.log 中未见发送通知相关的记录(既无成功也无失败),因此怀疑是静默失败;如内部有更详细的通知日志路径,请告知以便补充。
  • 本机声音通道正常:/usr/bin/afplay 与系统音效文件可用,输出音量 38 且未静音;用同一脚本直接播放音效用户能清楚听到。因此问题不在系统音量或音频设备。系统通知通道本身另用 osascript -e 'display notification ...' 做过对照(命令退出码 0),但该命令走的是 osascript 自身的通知路径,与 app 的注册/授权流程不同,故此项不能证明 app 的授权状态正常。

建议排查方向:

  1. 请确认 macOS 通知后端当前使用的是 NSUserNotification/notify_rust 还是 UNUserNotificationCenter;若仍为前者,建议迁移到 UNUserNotificationCenter 并处理 authorization 授权状态(首次调用请求授权、被拒后引导用户到系统设置)。
  2. 在通知发送路径加日志(请求发出 / 授权状态 / 发送结果 / 失败原因),避免静默失败。
  3. 校准两个开关的语义:是否仅「app 不在前台」才发?若在后台才发,应在 UI 上明确说明,或提供「始终通知」选项。
  4. [Feature]: 桌面端接入系统级通知与分类型提示音(任务完成 / 异常中断 / 等待用户决策) #3824 里请求的分类型提示音与自定义音效仍未见可用配置(二进制中只观察到 NSUserNotificationDefaultSoundName),建议一并确认。

用户侧可验证的对照实验

# 1) 检查系统通知通道是否可用(本机命令退出码 0;注意这不代表 app 自身的授权状态)
osascript -e 'display notification "test" with title "通知诊断"'

# 2) 检查声音通道(本机输出音量 38、未静音)
osascript -e 'get volume settings'
afplay /System/Library/Sounds/Ping.aiff

# 3) 确认 app 的通知配置确实写进了磁盘(只读,不含密钥;app.json 还包含模型配置,请勿整份公开)
python3 -c 'import json,os;d=json.load(open(os.path.expanduser("~/Library/Application Support/openbitfun/config/app.json")));print(d["app"]["notifications"])'

影响

Activity

  1. wsp1911 commented on Nov 20, 2026

    @wsp1911
    Collaborator

    是否外接了显示器?接了显示器时需要打开这个开关:

    image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions