DeepSeek-Reasonix
DeepSeek-Reasonix copied to clipboard
desktop: 能力面板设置变更在 turn 运行中显示原始错误(含调试参数),缺少友好提示(覆盖缺口)
问题
turn 运行中修改能力面板(MCP & Skills drawer)的 MCP 服务器/权限设置时,会被 active-work 保护正确拒绝,但界面直接显示后端原始错误:
active work is still running; running=true; pending_prompt=false; background_jobs=0; finish or cancel the current turn, answer pending prompts, and stop background jobs before changing MCP server
把调试参数(running=/pending_prompt=/background_jobs=)直接暴露给用户,不友好。
时间线(引入历史)
| 日期 | 提交 | 事件 |
|---|---|---|
| 2026-06-01 | 6f70d1278 |
CapabilitiesPanel 引入,其 mutate 从一开始就 setErr(原始错误) |
| 2026-07-05 | e4272b885 |
后端引入 rebuildBusyError——"active work is still running; running=..." 这个带调试参数的错误格式从此时开始 |
| 2026-07-06 | 068f35dc7 |
Localize desktop error notices:引入友好映射 settingSwitchNoticeText,但只覆盖 effort / model / token mode 三种设置 |
结论:不是最近引入的 regression,而是 2026-07-05/06 那批重构留下的覆盖缺口——友好文案只映射了 3 种设置,能力面板(MCP/权限)被遗漏,存在约一个月。
分析
- 保护机制本身合理:
desktop/app.go的rebuildControllerActiveWorkErrorFor在RuntimeStatus()报告running || finishing || pendingPrompt || backgroundJobs > 0时拒绝 rebuild(避免中途破坏正在进行的 turn 状态)。 - 映射缺口:
settingSwitchNoticeText(useController.ts)只在错误文本匹配before changing ${setting}且 setting ∈ {effort, model, token mode} 时做友好映射;能力面板的变更走的是不同 setting 名("MCP server"等),不经过该函数。 - 展示直甩:CapabilitiesPanel 的 4 处 mutation 站点用
setErr(String((e as Error)?.message ?? e))直接展示原始文本。
解决方案
新增通用友好提示函数 activeWorkBusyNoticeText(不依赖具体 setting 名,覆盖能力面板各类变更):
- 解析错误中的
running/pending_prompt/background_jobs标志 → 映射到三语言(zh/en/zh-TW)友好文案,按阻塞原因精确提示:- 回答运行中:「当前回答仍在运行,暂时不能修改此设置。请先停止回答,或等待它完成。」
- 有待确认问题:「有待处理的确认问题,暂时不能修改此设置。请先完成处理。」
- 后台任务运行中:「仍有 {n} 个后台任务在运行,暂时不能修改此设置。请先停止它们。」
- 非 busy 错误返回 null,调用方回退原始消息(不误伤真实报错)
- CapabilitiesPanel 4 处 mutate 接入;三语言各加 4 个
caps.switchBusy*键
验证:tsc --noEmit + 139/139 单元测试(含 5 个新增用例)+ 完整 build(含 bundle budget)全通过。如需要可提 PR。
👍🔥💡 日志级别建议线上默认 info 吗