MCP 只传 description 时,前置钩依靠隐藏 utility 链生成且失败不可操作
- Dominant language
- TypeScript
- Stars
- 2.7k
- Forks
- 395
- Avg merge
- 21h 48m
- Merged PRs (30d)
- 776
Description
**提交人**: huahua
**客户端版本**: 0.1.58
---
## 现象
Agent 调用 `schedule_set_pre_run_hook` 时如果**只传 `description`**(不传 `script`),宿主会用隐藏的 utility model 默认链去生成前置检查脚本。这条链和当前会话模型无关。
当默认链全部失败时,MCP 返回 `UTILITY_MODEL_ALL_CANDIDATES_FAILED`。错误没有告诉调用方改传 `script` 可以绕开生成。
这不是用户把对话模型换成了「小模型」。
相关:#113 已关。那次修了 UI 「AI 生成」的可诊断提示,没有把 MCP `description` 路径改可操作。
## 复现步骤
1. 在 Cindy 里让 Agent 调 `schedule_set_pre_run_hook`。
2. 只传 `description`(自然语言描述检查条件),不传 `script`。
3. 不配置 `voice-input-models.json` 里的 utility model。
4. 观察 MCP 返回。
5. 把会话执行模型换成其它模型后再试一次。
## 期望行为
三点任一即可,按优先级:
1. **失败要可操作**:MCP 错误应该明确说「改传 `script` 可绕过生成」,而不只报 `all_candidates_failed`。
2. **不要误导为会话模型问题**:文案和调试信息应说明这是独立的 utility 默认链,不是当前对话模型。
3. **可选**:修好默认 utility 链的 403 / 超时 / 空响应,使 `description` 路径在常见账号下可用。
已有 `script` 时不应该再走生成链。这一点已经正确。
## 实际行为
1. 只传 `description` 时,宿主走固定 utility 候选链(源码 `utilityModelProfiles.ts` 默认为 `codex-gpt-5.4-mini` → `litellm-gpt-5.4-mini` → `kimi-k2.6` → `deepseek-v4-flash`)。
2. 本机未钉 utility model 时,四档可全灭(超时 / 403 / 403 / 空响应)。
3. MCP 返回 `UTILITY_MODEL_ALL_CANDIDATES_FAILED`,没有提示改传 `script`。
4. 换会话模型不影响这条链。
5. 一旦传自写 `script`,钩安装成功。
## 复现频率
稳定。只传 `description` 且 utility 默认链不可用时每次出现。同一天多个自动化任务都碰过。
## 已尝试
- 换会话模型:无效。
- 自己传 `script`:成功,不再走生成链。
- 查过本机 utility model 配置:为空,落回默认链。
## 脱敏诊断摘要
- MCP 工具:`schedule_set_pre_run_hook`
- 触发条件:只传 `description`
- 错误码:`UTILITY_MODEL_ALL_CANDIDATES_FAILED`
- 默认候选失败类型:超时、403、空响应
- 相关源码:`apps/desktop/src/shared/utilityModelProfiles.ts`、`apps/desktop/src/main/scheduler-host/hook-script-generator.ts`、`packages/lizi-mcps/src/scheduler/errors.ts`
- 不含令牌、账号、本机路径或业务内容
---
**版本区域**: CN
**OS**: win32 x64 (10.0.26200)
**界面语言**: zh-CN
Contributor guide
Research direction
Start at the schedule_set_pre_run_hook path and inspect apps/desktop/src/main/scheduler-host/hook-script-generator.ts, apps/desktop/src/shared/utilityModelProfiles.ts, and packages/lizi-mcps/src/scheduler/errors.ts; reproduce the description-only case with no utility model configured. Done means the MCP failure explains the independent utility chain and tells callers that providing script bypasses generation, while existing script input remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100