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。
0.16 stdio 下 mode=plan 是 advisory (工具照常自动执行, 实测), 快照 diff 只是 事后发现; 引擎 session/create 的 toolAllowlist/toolDenylist 映射 PermissionService 硬 deny/allow, 是唯一的会话级前置只读手段。非空字符串数组 原样透传 (空条目剔除), 缺省/空数组/非数组时 create 参数与旧版逐字一致。 C5/C5a 回归用例; 全套 549 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.
基于 #52(session/new model 钉定)之上的增量提交,只评审最后一个 commit(20fa2b0)。
动机
0.16 stdio 下
mode=plan是 advisory——工具照常自动执行,调用方只能在事后(快照 diff)发现越界。会话级前置只读目前没有手段:引擎session/create的toolAllowlist/toolDenylist映射PermissionService的硬 deny/allow,不经过权限模式判断、hook 也不能覆盖,正是这个缺口需要的原语。变更
session/new新增可选toolAllowlist/toolDenylist(非空字符串数组,空条目剔除)原样并入session/create参数。缺省、空数组或非数组时 create 参数与旧版逐字一致(向后兼容:不传名单的调用方行为不变;传了名单而后端拒收未知字段时,create 的报错如实透出)。测试
pytest tests/ -q→ 549 passed + 34 subtests