[Bug] 已是 danger-full-access 时重申同一模式被拒,导致非默认模型每次文件操作失败 #4412
Replies: 1 comment
|
Verified against rc.2 (HEAD b150a55) — this is the fourth independent report of the family (#3519 hytime → #4359 ZergZFZ → #4383 XY1998-debug, plus chenming0v0's WSL2 reproduction → #4412), and your root-cause is line-exact. Two corrections so the fix you propose lands family-complete: 1.
|
Uh oh!
There was an error while loading. Please reload this page.
问题描述
会话的沙箱模式已经是
danger-full-access(用户显式设置的 Full access),但模型调用 write/edit/bash 工具时只要携带了sandbox_permissions: "danger-full-access",调用就会在执行前被拒绝:关键点:
danger-full-access,沙箱不限制任何操作)复现步骤
danger-full-access(sandbox=danger-full-access, approval=never)sandbox_permissions: "danger-full-access"(schema 广告了该字段)默认模型通常遵守"仅在被拒后重试时携带该参数"的约定,因此不触发;非默认模型把该字段理解为"写文件的必需开关",每次都携带,每次都失败。
根因
dsh-sandbox/lib/index.js的approveEscalation:danger-full-access不在任何WIDER_MODES表中(它是阶梯顶端),因此"重申当前模式"必然命中!includes(mode)分支而被拒绝。辅助因素:
dsh-tool-fs/dsh-tool-bash的 schema 只要挂了沙箱后端就无条件广告sandbox_permissions/justification字段(描述还写着 "requires justification and user approval"),持续引导模型携带该参数。影响
修复建议
P0(主修复):
approveEscalation中将"请求模式 == 当前有效模式"视为 no-op,直接放行,不弹审批、不报错:安全论证:请求等于当前模式时权限零变化,不需要人类审批;fail-closed 语义不受影响——任何"请求模式 ≠ 当前模式"的路径(更宽要审批、更窄被拒)完全不变。
P1(引导,可选):
dsh-sandbox-policy的renderPolicyContext,danger-full-access 分支追加明确指令,例如 "Do not setsandbox_permissionson tool calls in this mode; it is already the widest."。注意不要按会话收窄 schema 广告(escalationModes)——schema 是 registry-global 的,按会话动态收窄不可行。环境
All reactions