Conversation
… 实测)
问题 (0.16.1-0.16.9 实测):
1. setModel 透传形态与 0.16 后端 schema 不匹配: 桥发 {sessionId, modelId}
字符串, 后端要 model 对象 → 必报 -32602 "expected object, received
undefined; Unrecognized key: modelId"。即 0.16 时代 setModel 从未真正
可用, ACP client 无法切换会话模型。
2. headless 场景模型解析跟随 personal provider registry / App「上次使用」,
client 无法按会话指定模型: App 里选了什么, spawn 出的引擎就默认用什么
(provider 目录不含 config.json 静态 provider, env 三件套在 personal
registry 存在时被无视)。
修复/新增:
- setModel: 改为 {sessionId, model} 原样透传 ModelSelection 对象
{providerId, modelId, options?: {reasoningLevel}}。旧 modelId 形态移除
(在 0.16 后端从未通过 schema, 保留只会让调用方误以为已生效)。
- session/new 新增可选 model:
* 字符串形态 ("GLM-5.3"): 按 create 快照 settings.model.available 的
catalog 解析, 补 reasoningLevel=reasoning.defaultLevel;
* 对象形态: 原样透传;
* create 成功后经 session/setModel 应用, 失败则 session/new 整体报错。
刻意不透传给 create 本身: 0.16.9 实测 create 的初始 model 形参接受对象
但丢 options, turn 阶段报 ModelProtocolError "Reasoning level is
required for <provider>/<model>"; setModel 路径无此问题。
实测 (ZCode App 3.14.0 / CLI 0.16.9, personal provider bigmodel-api):
- session/new {model: "GLM-5.3"} → session/prompt → stopReason=end_turn;
- setModel {model: {providerId, modelId, options:{reasoningLevel:max}}} →
ok → prompt → end_turn;
- setModel 缺 options (无 reasoning 的模型除外) → turn 失败, 与 catalog
defaultLevel 补齐后通过。
测试: M5 改写 (对象透传/缺参 -32602/旧形态拒绝) + C4 系列 7 例 (字符串
catalog 解析/无 reasoning 条目/对象透传/未知 modelId/setModel 失败连带
new 失败/不带 model 向后兼容/非法形态)。547 passed + 34 subtests。
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.
问题(0.16.1–0.16.9 实测, App 3.14.0/CLI 0.16.9)
1. setModel 透传形态与 0.16 后端 schema 不匹配
桥的
_on_session_set_model发{sessionId, modelId: "<string>"},而 0.16 后端 zod schema 要 model 对象,实测必报:即 0.16 时代 ACP 面的
session/setModel从未真正可用(即使参数名对上,注册表里没有该 provider 也会报Provider Registry 中不存在 Model)。2. client 无法按会话指定模型(headless 刚需)
headless spawn 的 app-server,模型解析跟随 personal provider registry / App「上次使用」默认;config.json 静态 provider 不进注册表,凭证 env 三件套在 personal registry 存在时被无视。结果:App 里选了什么模型,脚本/编辑器拉起的会话就默认用什么,client 无从覆盖。
修复/新增
{sessionId, model}原样透传 ModelSelection 对象{providerId, modelId, options?: {reasoningLevel}}。旧modelId字符串形态移除(在 0.16 后端从未通过 schema,保留只会让调用方误以为已生效)。model:"GLM-5.3"):按 create 快照settings.model.availablecatalog 解析,补reasoningLevel = reasoning.defaultLevel;ModelProtocolError: Reasoning level is required for <provider>/<model>;setModel 路径无此问题。实测(ZCode App 3.14.0 / CLI 0.16.9, personal provider bigmodel-api)
session/new {model: "GLM-5.3"}→session/promptstopReason=end_turn,流式文本正常session/new素建 +session/setModel {model: {providerId, modelId, options:{reasoningLevel:max}}}→ prompt{modelId}形态测试
modelId形态显式拒绝)python3 -m pytest tests/ -q→ 547 passed, 34 subtests passed兼容性说明
{modelId}→{model}是破坏性 ACP 参数变更,但旧形态对 0.16 后端本来就 100% 失败,无实际可用性损失;≤0.15 后端未验证(0.16 用户不受影响,老版本用户如需可反馈再兼容)。model的 session/new 行为逐字节不变(C4e 锁定)。