Skip to content

fix(desktop-services): 修复 DSH 0.2.2-rc.3 上完成、失败和授权不再提醒(关联 #327) - #328

Merged
freedomkk-qfeng merged 1 commit into
ECNU:mainfrom
JunieXD:fix/desktop-attention-dsh-rc3
Nov 16, 2026
Merged

freedomkk-qfeng merged 1 commit into
ECNU:mainfrom
JunieXD:fix/desktop-attention-dsh-rc3

Conversation

@JunieXD

@JunieXD JunieXD commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

在 macOS 上测试 #327 时发现:main 升级到 DSH 0.2.2-rc.3(#309)以后,任务完成、任务失败和需要授权都不再提醒,只有提问还会提醒。系统通知、托盘里的待处理项和 #327 的任务栏/Dock 计数都受影响,不分平台。

原因

rc.3 的 @deepseek-ai/dsh-agent 删掉了 AgentRegistry.roots()。dsh-plugins/desktop-services/lib/attention.js 用它判断会话是不是用户自己的会话,在 rc.3 上每个会话事件都在这里抛错,完成、失败、授权都记不进来。提问走 user-questions/request 钩子,不经过这里,所以还能提醒。CI 没有发现,是因为测试里假的 agents 服务自己带了 roots()。

改动

  • attention.js:用户会话改为“有存活的 agent,且不是 DSH 以子智能体身份启动的会话”,和 rc.3 上游一样看 session.header.origin。rc.3 的 subagent 和 subagent_fork 都写 origin: "subagent";普通 fork、侧边讨论、ACP 会话和恢复后的会话仍算用户会话,范围和原来一致。
  • attention-host.test.mjs:假的 agents 服务只能提供当前 Runtime 的 AgentRegistry 上真有的方法,DSH 再删接口时这里会直接失败。补充断言:子智能体和没有存活 agent 的会话不产生待处理项,fork 出的会话产生。
  • 刷新源码回执。

验证:macOS 27.0.1 arm64

  • attention-host.test.mjs 在 rc.3 和 rc.1 的 Runtime 上都是 4 项通过。反向验证:换回旧写法,两个 Runtime 上 4 项全部失败;去掉来源判断或存活判断,各有 1 项失败;假服务加回 roots,在 rc.3 上失败。

  • 用 main(1d1174a)本机构建 0.4.13-dev.20261116.1,改成独立的 QA 应用,由合成模型在后台会话里触发。本 PR 一列是把本 PR 的 attention.js 换进同一个包、重新签名后的结果:

    场景 main 本 PR
    完成 没有通知,计数不变 “任务已完成”,计数加 1
    模型出错 没有通知,计数不变 “任务需要处理”,计数加 1
    授权 没有通知,计数不变 “需要授权确认”,计数加 1
    提问 “需要补充信息”,计数加 1 同左

    本 PR 依次触发四项后,Dock 显示 4,Host 同步给桌面端的待处理项依次是 completed、failed、approval、question。

  • Windows 未实测;改动在 Host 插件里,不分平台。

未处理

  • rc.3 可以只恢复孙级子智能体、不恢复中间那一层。这时它的工作归不到主会话,主会话可能先提醒一次“完成”。这是沿存活父链查找归属的既有限制,要改用 rc.3 subagents.rootOf() 的运行时归属,另做。

DSH 0.2.2-rc.3 removed AgentRegistry.roots(), so every session event threw
before it reached DesktopAttention. Completions, failures and approvals never
became desktop notifications, tray entries or taskbar/Dock counts; only
questions, which arrive through the user-questions hook, still did.

Treat a session as a conversation when it has a live agent that DSH did not
start as a subagent, the header.origin check upstream uses. The test fakes now
offer only methods the Runtime's AgentRegistry has, so an API that DSH removes
fails the integration check instead of being masked by the fake.
@freedomkk-qfeng
freedomkk-qfeng merged commit ae654ad into ECNU:main Nov 16, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants