[Bug] 飞书 Bot 发消息创建任务必现失败:「Bot 无法从目标 Host 解析 Submission 模型」(3.12.3,附根因定位)
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 22
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
提交前确认 · Pre-submission checklist
- 已搜索现有 issue,确认非重复(最接近的 #586 是 tenant_access_token 过期问题,与本问题无关)
- 已阅读 CONTRIBUTING.md
问题类别 · Category
其他 / 不确定(Bot 通道 · 飞书 · 任务创建时的模型选择)
涉及的 Agent 框架 · Agent framework
ZCode Agent(自研)
严重程度 · Severity
阻塞使用(该 Bot 通道完全无法收消息/建任务)
复现频率 · Reproducibility
必现(连续 3 条消息、跨 6 分钟全部失败)
问题描述 · Description
ZCode Desktop 3.11.2 → 3.12.3 自动更新(9-16 深夜下载、9-18 01:48 重启生效)后,飞书 Bot 第一次使用即必现失败:给 Bot 发送任意文本消息,Bot 立即(≈0.5s)回复错误,消息不会被投递进任何会话:
处理机器人回调失败:Bot 无法从目标 Host 解析 Submission 模型
该 Bot 绑定的是本地工作区(~/.zcode/workspace/default),与远端工作区无关。同一宿主进程内,桌面 UI 和已有会话(显式选定模型 account:zai-individual-coding-plan/GLM-5.3$max)一切正常,说明不是账号/网络问题。
复现步骤 · Steps to reproduce
- macOS + ZCode Desktop 3.12.3,飞书 Bot 启用并绑定本地工作区;
- 在飞书给 Bot 发
/new(成功,Bot 进入 draft 模式;旧会话 resume 亦成功,12s 完成、1412 条消息); - 发送任意文本消息;
- ≈0.5s 后 Bot 回复「处理机器人回调失败:Bot 无法从目标 Host 解析 Submission 模型」,日志同步出现
provider callback failed,飞书事件通道随后收到Feishu callback failed: status=503(我方回调处理抛错所致)。
期望表现 · Expected behavior
Bot 正常创建新任务并投递消息、开始回复。
实际表现 · Actual behavior
每条消息立即失败,通道完全不可用。02:03:01 / 02:03:17 / 02:03:52 / 02:04:09 / 02:08:19 / 02:09:11 共 6 次回调全部同一错误。
ZCode 版本 · ZCode version
v3.12.3(从 v3.11.2 自动更新)
设备 / 系统 · Device / OS / Browser
Mac(Apple Silicon,darwin 25.6.0 arm64)/ ZCode Desktop 3.12.3 / 模型通道:Z.ai 个人 Coding Plan(GLM-5.3)
根因定位(供开发参考,均来自 3.12.3 app.asar/out/host/index.js 反解,函数原名保留在 bundle 中)
Bots 的 handleMessage 在 draft 分支(/new 之后、无 activeTaskId)建新任务前必须解析模型:
buildInitializedDraftOptions只返回{provider, mode},不含 modelSelection(bot-state 里也没有存过 draftOptions);- 于是走
readModelSelectionView→resolveModelSelectionServiceForContext:本地工作区直接返回宿主进程内的modelSelectionService(不存在"目标 Host"连接失败的可能); ModelSelectionFacade.getView()无参调用时configuredDefault = undefined,preferredSelection完全依赖resolveInitialModelSelection的 registry-fallback:遍历visibility !== "hidden"的 provider × model,且要求该 model 的config.optionSpecs.reasoningLevel.values非空(completeNewModelSelection取values.at(-1));一个都选不出时返回{source:"none"},此时返回的视图对象里根本没有 preferredSelection 字段;- 回到
handleMessage:wt = yt?.preferredSelection为 undefined →throw new Error("Bot 无法从目标 Host 解析 Submission 模型")。
疑点在上述第 3 步的 fallback 为何落空:启动日志显示宿主 [provider-runtime] Provider Registry 已就绪 providerCount=7,且同期没有任何 read model selection view ... failed 告警(getView 未抛错、正常返回了空视图)。怀疑 3.12.3 中 account-plan 类 provider 的 models / optionSpecs 数据或可见性发生了变化,导致该 fallback 在"已登录 Z.ai Coding Plan"的机器上永远扫不出合格模型 → 所有 Bot 的新建任务路径被堵死。3.11.2 时代(9-12/13 最后一次正常使用)该路径是好的。
另外两点建议:
- 该错误文案有误导性:本地工作区并无"目标 Host"解析动作,实际是"宿主内模型注册表选不出默认模型";
- fallback 落空时若能给可操作的提示(例如引导
/model显式选择)或直接沿用 account-plan 当前默认模型,比整条消息失败好得多。
截图 / 录屏 / 日志 · Screenshots / Recordings / Logs
~/.zcode/v2/logs/2026-09-18.log 关键片段(已脱敏):
01:49:20 [provider-runtime][trace:Provider Registry 已就绪] {"providerCount":7}
02:02:22 [bots] provider callback provider=feishu bot=bot-*** user=ou_*** displayName= text=/new
02:02:22 [zcode-agent-service] 开始请求 ZCode Protocol session/resume {"sessionId":"sess_***","workspacePath":"/Users/***/.zcode/workspace/default"}
02:02:34 [zcode-agent-service][trace:***] ZCode Protocol session/resume 完成 {"durationMs":12247,"messageCount":1412,"modelCurrent":"account:zai-individual-coding-plan/GLM-5.3$max"}
02:03:00 [bots] provider callback provider=feishu bot=bot-*** user=ou_*** displayName= text=<用户消息文本>
02:03:01 [bots] provider callback failed provider=feishu bot=bot-*** user=ou_***: Bot 无法从目标 Host 解析 Submission 模型
02:03:01 [error] ["[ws]","invoke event failed ... error: Error: Feishu callback failed: status=503"]
(02:03:17 / 02:03:52 / 02:04:09 / 02:08:19 / 02:09:11 同错误重复出现,含飞书重投的 "provider callback duplicated")
同一时段账号侧 RPC 正常(coding-plan-subscription.getManualClaimPlanPreviews OK、usage-stats.* OK)。完整日志可按需提供。
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the Feishu Bot flow on ZCode Desktop 3.12.3, starting with the provider callback logs and app.asar/out/host/index.js. Trace handleMessage through buildInitializedDraftOptions, readModelSelectionView, and the model-selection fallback, then verify the provider registry and optionSpecs data. Done means new Bot messages create tasks and receive replies instead of returning the model-resolution error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100