# 番茄通知监听诊断工具 类型:`diagnostic-tool` 风险:`low` ## 番茄通知监听 doctor 诊断流程样例 ### 输入 - 工具入口:`python scripts/pomodoro_launchagent_doctor.py --service-label com.bytedance.pomodoro-watcher --plist ~/Library/LaunchAgents/com.bytedance.pomodoro-watcher.plist --live-seconds 20` - 输入来源:LaunchAgent plist、`launchctl print`、`pgrep -af`、TickTick `log stream` 近端日志、内置通知样例回放。 ### 流程 1. 检查 plist 是否存在、语法是否可解析、`ProgramArguments` 是否指向当前 watcher 脚本。 2. 检查 LaunchAgent 是否 loaded/running,并记录 PID 与最近一次退出码。 3. 检查是否存在多个 watcher 或多个 TickTick `log stream` 子进程。 4. 回放三类样例:普通 `Delivering ... without presenting`、`category:"pomoRelax"`、`category:"pomoEmpty"`。 5. 若开启 live 模式,监听 20 秒真实 TickTick 通知日志,输出每条日志的分类、触发判断和拒绝原因。 ### 成功信号 ```text status: ok service: running pid=5503 watcher_processes: 1 log_stream_processes: 1 sample_replay: without_presenting: ignored pomoRelax: ignored pomoEmpty: triggered ``` ### 失败信号 ```text status: fail issue: weak_presenting_match detail: ordinary TickTick notification contains `without presenting`, but matcher still treats it as end-of-pomodoro. next: require category:"pomoEmpty" before emitting completion event. ``` ### 建议修复 把通知结束判断从关键词 `Presenting` 改成强约束匹配,例如 `category:"pomoEmpty"`;改完后重跑 doctor,确认普通任务提醒和休息提醒都不会触发。