Repository navigation
Feedback(0.1.5-rc.2): INVALID_ARGS 报错缺上下文——模型分不清缺的是哪一层参数,PTC 场景陷入连环错误重试(附补丁) #6433
KannaKuron
started this conversation in
General
Replies: 1 comment
|
核对成立(master c291e79, 相关文件自 rc.2 零改动): 报错文本逐字吻合 - schema.ts:466 生成 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
现象
dsh 0.1.5-rc.2、PTC 模式(run_code)、GLM-5.3(第三方 Anthropic Messages 兼容端点)。长会话中模型发生参数漂移:run_code 调用的顶层 JSON 只带
code,description被写进了程序文本内部(成了内层tools.bash({ ... })的参数)。dsh 的校验正确拒绝了这些调用——schema 本身没有问题(模型可见 schema 与校验 schema 一致,
code/description均 required,pi-ai 严格解析也全过,排除了流截断)。问题在于错误消息本身:每次返回之后,模型检查自己写的调用,发现内层工具明明有
description,于是得出"我有写"的结论,转而去修改毫不相干的措辞重试。该会话 11 步烧掉 8 步,最终报废,模型归纳出的"规律"(内外 description 措辞相同时触发)完全是错觉。失败调用的线上原始样本(从会话记录解出,合法 JSON、非截断,顶层只有
code):{"code":"const r = await tools.bash({\n command: \"mkdir -p fly-brain-playground && ...\",\n description: \"准备果蝇项目工作目录\"\n});\nconsole.log(r.stdout, r.stderr);"}根因
ToolArgsError的消息只列出缺失属性,不说明:单层工具场景下这不痛不痒;但 PTC 场景存在两层同名参数(run_code 顶层的
description与程序内层工具的description),模型无法定位缺失发生在哪一层,只能在错误反馈回路里盲试。建议修复(已在本地验证)
给
ToolArgsError消息追加可选诊断上下文——拒绝调用的工具名 + 实际收到的顶层键:改动面
packages/core/tools/src/schema.ts:ToolArgsError构造器加可选context(tool/receivedKeys),不传则消息与现状完全一致(subagent 等其他调用点零影响);defineTool的execute抛出时带上{ tool: options.name, receivedKeys }(顶层键排序后拼接);tests/tools.spec.ts两处断言同步更新。收到这种消息后,模型能立即看出"run_code 顶层只到了 code",一步修正,而不是循环。
环境
descriptionAll reactions