Repository navigation
fix(notifications): 后台子代理和目标模式未结束时不提前提示完成 - #158
Merged
freedomkk-qfeng merged 4 commits intoOct 16, 2026
Merged
Conversation
…ore reporting completion A root turn that ends while a background subagent still works is woken again when the subagent settles, and an armed goal below its round limit continues with another round. Neither is finished yet. A goal the driver blocks after a completed round is reported as needing attention.
freedomkk-qfeng
left a comment
Member
There was a problem hiding this comment.
从桌宠拆出通知修复这个方向正确,后台子代理归属和普通通知回归已复核通过。目标模式还有一个需要补齐的边界:当前只在 turn/end 读取目标状态,官方驱动稍后发生的阻塞没有通知入口。
独立使用锁定的 DSH 0.2.0-rc.2 的真实 Session、GoalService、projection 和 goal-round-driver 做了合成场景验证,复现两种结果:
- 目标未完成但已用尽
maxGoalRounds:turn/end时仍为 active,当前发送 completed;随后 driver 将目标改为blocked/round-limit,提醒仍是“任务已完成”。轮数耗尽应提示需要处理。 - 普通轮次结束、准备自动续跑时,让 followup 入队抛错:当前先抑制完成提示;随后 driver 将目标改为
blocked/queue-failed,没有新的turn/end,因此完全没有提醒。后台任务停住后用户会不知道需要介入。
定位在 attention.js 的 turn/end 目标判断,以及 observeDesktopAttention() 尚未观察目标状态变化。建议接官方已有的 goal/changed 等事件,对本次确实观察到的活跃目标补终态提醒并去重:持续运行不报完成,受阻提示需要处理,真正完成才报完成;同时避免启动时重放历史目标提醒。无需修改 DSH 内核,也不建议用固定延时猜驱动是否结束。
请补这两个 driver 时序的回归,再核对普通完成、提问和授权不重复提醒。本次已有 13 项通知测试与 1 项真实 session header 测试通过;上面复现使用合成入队故障,没有依赖模型或真实用户数据。
#149 的展示层部分已通过独立复审,正在合入。随后同步 main 时,请同时保留它的 running / changed() 更新和本 PR 的通知规则、两组测试,再刷新回执。
…hange The driver blocks a goal only after the turn that ends it: at the round limit, or when the next round cannot be queued. Neither produces another turn end. Hold every completed turn of an armed goal and settle it from goal/changed: block needs attention, complete is done, pause and clear are the user's own stop, and the next round's start clears the hold.
Contributor
Author
|
已补目标驱动的两种时序,并同步了 main(73d5cee),#149 的
PR 正文已更新。 |
This was referenced Oct 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
在 #149 的评审中确认的 main 已有问题,从 #149 拆出单独修复。
问题
@deepseek-ai/dsh-base配置给subagent工具设了backgroundMode: continuable,子代理默认在后台运行,EduWork 没有另加配置。主会话派出子代理后可以先结束这一轮,子代理结束后 Runtime 再唤醒主会话跑一轮。现在主会话第一轮结束就弹“任务已完成”,收尾那一轮又弹一次,而第一次弹出时子代理还在工作。改动
dsh-plugins/desktop-services/lib/attention.js:origin: 'subagent'和parentSession把正在工作的子代理归到派出它的主会话,与 DSH 自己的runningDescendants一致;fork 出的会话只有parentSession,不归。主会话一轮完成时如果还有子代理在工作,这一轮不产生“完成”,等被唤醒的那一轮结束再产生。ctx.goals:目标进行中且已启用时,这一轮先不产生提醒,交给目标驱动决定。下一轮开始就不提醒;之后收到 DSH 的goal/changed:受阻(用完轮数、下一轮无法排队等)记为“需要处理”,完成记为“完成”,用户暂停或清除不提醒。只处理本进程里实际看到的这类轮次,启动时不会重放历史目标。一轮结束时目标已经受阻的,直接记为“需要处理”。dsh-plugins/desktop-services/lib/index.js:把当前会话的目标传给 attention;observeDesktopAttention()监听goal/changed。docs/DESKTOP_NOTIFICATIONS.md及英文版改了对应的两行;刷新源码回执。running和changed()更新以及两边的测试。验证:macOS 27.0.1 arm64
单元测试:
task-notifications.test.mjs:目标模式(继续下一轮、受阻、完成、暂停、编辑、未经本进程看到的目标、一轮结束时已受阻)和后台子代理各一项。attention-host.test.mjs(接 0.4.3 的 Runtime):用真实dsh-session会话头测子代理归属;用真实 Session、projection、GoalService 和 goal-round-driver 测两种驱动时序:用完轮数后驱动把目标标为round-limit,以及下一轮排队失败被标为queue-failed,两种都只提醒一次“需要处理”;没有目标的会话完成照常只提醒一次。attention-host.test.mjs原有的第一项在 DSH 0.2 Runtime 下失败,main 上同样失败,CI 不跑它。本机按发布流程构建 0.4.4-dev.20261015.2,装进 QA 应用。重启应用后让访达在前台,由合成模型依次触发提问、授权、完成、模型出错、后台子代理,记录主进程发出的系统通知和托盘菜单。对照用 feat(desktop): 桌面宠物第一阶段(#117) #149 的包跑同一套流程,它的通知逻辑和 main 相同:
目标模式(0.4.4-dev.20261015.3):合成模型调用
create_goal建一个最多 1 轮的目标,驱动自动跑完第 1 轮后把目标标为受阻。只弹一次“任务需要处理”,没有“完成”;上一版的包在同一流程里弹的是“任务已完成”。同一个包上重跑上表的提问、授权、完成、出错和后台子代理,每项只提醒一次,结果和上表一致。下一轮排队失败只在上面的真实 Runtime 测试里覆盖,应用里无法稳定触发。