[bug]工具沙箱升级引导在 danger-full-access + 审批 never 会话中造成无限失败循环 #1069
Replies: 6 comments 1 reply
|
同样的问题 |
|
同样的问题,sol直接接不了 |
|
一样 |
|
本地按以下方式修了一轮,能跑了 ———————————————— 现象配置 OpenAI 类模型(如 模型反复重试、反复报错,几乎每次 复现条件
根因沙箱提权只允许「向更宽的一档跳」:
而某些模型不遵守「看到拒绝标记才提权」的约定,会预防性填字段。于是「同档请求被拒 → 模型看到报错 → 换值重试 → 再被拒」形成死循环。本质是 fail-closed 设计对不守约定模型的鲁棒性缺口—— 修复思路
验证(本地)按上述思路在本地实现后:
|
|
我写了一个插件,解决了沙盒升级的问题,没有动dsh的核心代码,可以来用用看 |
|
同样卡在这条报错上的人 +1。这个其实是工具描述在"教"模型去做一件永远不可能成功的事,楼上的根因分析已经很到位。补充几个不用改源码、也不用插件的绕法:
刚拉了 master 最新(rc.7), 给维护者的建议(与楼上思路一致):schema 按会话当前有效模式动态收窄:danger-full-access 时直接不展示 English summary: the tool schemas still advertise sandbox escalation in danger-full-access sessions where no wider mode exists; quick no-code workarounds are to instruct the model not to send sandbox_permissions, or strip those two params at a custom gateway. Master (rc.7) is still unfixed. |
Uh oh!
There was an error while loading. Please reload this page.
问题
在采用 danger-full-access 预设(沙箱模式 danger-full-access + 审批策略 never)的会话中,代理(agent)无法完成任何工作区之外的文件修改——所有携带 sandbox_permissions/justification 的工具调用都会被拒绝,模型陷入死循环,不断换不同的升级值重试,完全无法推进。已通过自定义 openai-responses 网关上的 GPT-5.4 复现;该行为与模型无关。
"升级毫无意义"这一信息确实被注入了(sandbox-policy 运行时上下文:"DSH 文件沙箱不限制文件修改";user-approval:"不要请求沙箱升级(不要设置 sandbox_permissions)"),但工具链的其它部分在极力压过它:
工具描述把"升级"宣传成"唯一正确的恢复路径"。 dsh-tool-pwsh / dsh-tool-bash 花大篇幅描述"当命令被拒绝时……立即升级……用 sandbox_permissions + justification 重试";而"审批禁用 → 不要设置 sandbox_permissions"这条例外只是结尾处的一个从句。
拒绝信息具有误导性。 sandbox escalation to "workspace-write" is not strictly wider than this call's current "danger-full-access" mode 读起来像是在说"请选一个更宽的值"——但根本不存在更宽的值。它从未说明"本会话禁止升级"。
没有动态适配。 即使 sandbox_permissions 永远不可能成功,它仍然被完整地展示在工具说明中。
复现步骤
会话配置为 permission.defaultPreset: danger-full-access(沙箱 danger-full-access,审批 never)。
让代理编辑一个工作区之外的文件(例如 node_modules/... 下的包)。
模型调用 edit/write/pwsh 并携带 sandbox_permissions →
Error: sandbox escalation to "workspace-write" is not strictly wider than this call's current "danger-full-access" mode
(当 justification 为空时)Error: invalid justification: expected a non-empty sentence
换 danger-full-access、其它模式、其它 justification 重试 → 得到完全相同的拒绝。无限循环。
预期行为
当审批策略为 never(或沙箱模式已是最高级)时,升级不可能成功,因此也不应该被提供:
工具应省略 sandbox_permissions 参数以及所有升级引导,或者
拒绝信息应直说:"本会话禁用升级;请在不带 sandbox_permissions 的情况下重试该调用。"
建议修复
工具描述/schema 动态渲染:当会话的有效审批策略为 never(或模式已是最高级)时,从 dsh-tool-pwsh、dsh-tool-bash 以及 edit/write 工具中剔除 sandbox_permissions 和升级相关段落。不可能成功的能力就不应该被宣传。
拒绝信息:为"升级已禁用"的情况增加分支("本会话禁止沙箱升级;请不带 sandbox_permissions 重试"),而不是"不低于当前模式"。
把 never 策略放进稳定的系统提示(system prompt)而不是只放在运行时上下文快照中(目前通过 approval:policy 以 order 115 注入)。
参考资料(dsh v0.1.0-rc.6,web profile,Windows,Node 24)
dsh-sandbox-policy/lib/index.js 第 83–94 行(renderPolicyContext,面向模型展示的模式文本)
dsh-user-approval/lib/index.js 第 38 行(NEVER_SENTENCE)、第 92–102 行(systemPrompt 注入)
dsh-tool-pwsh/lib/index.js 第 144 行、dsh-tool-bash/lib/index.js 第 129 行(升级引导文本)
All reactions