CodeWhale icon indicating copy to clipboard operation
CodeWhale copied to clipboard

在Cmux里对话结束时,不会弹出通知

Open punkcanyang opened this issue 6 months ago • 4 comments

Problem

在Cmux使用时

如果是Codex或是Claude Code时,当对话需要输入或是前一个对话已经结束,可以设定弹出通知

但Deepseek TUI却无法弹出通知,不知道是否有相关设定或是没有写入相关功能

punkcanyang avatar May 09 '26 07:05 punkcanyang

根因分析

问题出在 crates/tui/src/tui/notifications.rs 的 resolve_method()。

Cmux 虽已被加入 OSC 9 白名单,但检测完全依赖环境变量。Cmux 当前不设置 TERM_PROGRAM(实测为空),也不设置 TERM=xterm-ghostty(实际为 xterm-256color),导致两条路径都未命中,回退到 Method::Bel。

实测确认

  • lsappinfo list:Cmux 在前台,bundleID com.cmuxterm.app
  • TERM_PROGRAM:空字符串
  • TERM:xterm-256color

可能的修复方向

  1. 与 Cmux 作者沟通,让 Cmux 设置 TERM_PROGRAM=Cmux(最干净)
  2. 在 resolve_method() 添加父进程探测,绕过环境变量依赖
  3. 增加 [notifications].method = "osc9" 配置项,允许用户显式指定

punkcanyang avatar May 09 '26 16:05 punkcanyang

Update for v0.8.27.

The infrastructure for end-of-turn desktop notifications has been in the TUI since earlier — see [notifications].method in ~/.deepseek/config.toml. Default behavior on macOS / Linux is Auto, which picks OSC 9 on iTerm2 / Ghostty / WezTerm and falls back to BEL elsewhere. tmux DCS passthrough is wired in too ($TMUX is detected and OSC 9 is double-escaped through it).

Could you confirm a few things so we can narrow down why Cmux specifically isn't getting them?

  1. What does echo "TERM_PROGRAM=$TERM_PROGRAM TMUX=$TMUX" print when you're running deepseek-tui inside Cmux?
  2. What's your [notifications] block in ~/.deepseek/config.toml?
  3. Does the same outer terminal (without Cmux) get notifications? — that would tell us whether the issue is Cmux's DCS passthrough vs. the outer terminal's OSC 9 handling.

Cmux is a tmux derivative; if its DCS-passthrough syntax differs from tmux's, we'd need to detect it specifically (similar to how we already special-case iTerm2 / Ghostty / WezTerm). Once we have the info above, the fix is likely a one-liner in crates/tui/src/tui/notifications.rs.

Separately, v0.8.27 ships a model-callable notify tool (#1322) that uses the same pipeline, so if the underlying notification path works for you, the model can also fire mid-session "I'm done, come back" pings — both the auto turn-end notification and the model-triggered one share the same OSC 9 / BEL machinery.

请提供以下信息以便定位 Cmux 下通知不发出的原因:

  1. 在 Cmux 里运行 deepseek-tui 时,echo "TERM_PROGRAM=$TERM_PROGRAM TMUX=$TMUX" 输出什么?
  2. ~/.deepseek/config.toml 中的 [notifications] 配置是什么?
  3. 不通过 Cmux 直接在外层终端运行 deepseek-tui 时通知能否触发?

Hmbown avatar May 10 '26 15:05 Hmbown

Resolved in v0.8.28 via PR #1340. Cmux desktop notifications now work through LC_TERMINAL probe fallback.

Hmbown avatar May 11 '26 00:05 Hmbown

好的,我更新一下我这边代码

punkcanyang avatar May 11 '26 01:05 punkcanyang