Repository navigation
Replies: 1 comment
|
试试我写的插件,亲测有用,rc5和rc6都支持 |
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.
概述
在
@deepseek-ai/dsh0.1.0-rc.6(Windows,pwsh工具;bash/write/edit存在相同结构问题)上,当会话的生效文件策略已经是danger-full-access且审批提示被禁用时,改动类 / shell 工具仍然在其 schema 中广告可选参数sandbox_permissions+justification。模型经常把它们填成sandbox_permissions: "danger-full-access",随后这次调用在任何操作真正执行之前就被拒绝,报错为:这是日常对话中频繁出现的噪声式失败,不是沙箱逃逸。它浪费回合和 token,并且与运行时上下文里“do not request sandbox escalation (do not set
sandbox_permissions)”的提示自相矛盾——因为工具 schema 本身仍然把这个字段提供给模型。环境信息
@deepseek-ai/dsh:0.1.0-rc.6pwsh工具)pwsh、bash、write、edit(任何“挂载了限制性后端就广告升级字段”的工具)danger-full-accessnever(审批提示已禁用)复现步骤
danger-full-access、审批策略为never的会话(运行时上下文会同时显示这两项)。pwsh执行Get-Location——但带上 schema 仍然广告的可选字段:sandbox_permissions: "danger-full-access"justification: "<任意非空句子>"在我自己的会话中,只要模型附带了这对升级字段,每次
pwsh调用都会复现;而省略这两个字段的本意相同的调用本可以正常运行。现场证据(排查过程中连续三次
pwsh调用)justification为空 +sandbox_permissions: "danger-full-access":Error: invalid justification: expected a non-empty sentencejustification+sandbox_permissions: "danger-full-access":Error: sandbox escalation to "danger-full-access" is not strictly wider than this call's current "danger-full-access" mode这完整复现了报错链路:参数先经过
validateEscalationArgs的配对校验,再进入approveEscalation的严格变宽检查;而danger-full-access在WIDER_MODES表里没有任何“更宽”目标,因此必然被拒绝。根因
升级目标字段是否广告,依据的是是否挂载了限制性后端,而不是会话当前的生效模式:
tool-pwsh:const escalationModes = defaultMode === void 0 ? [] : ESCALATION_TARGETS;,其中defaultMode = ctx.shell.sandboxMode。只要挂载了限制性执行器,无论会话当前生效模式是什么,都会广告ESCALATION_TARGETS = ["workspace-write", "danger-full-access"]。tool-fs(write/edit):通过FsSandboxController采用相同模式,this.escalationModes = defaultMode === void 0 ? [] : ESCALATION_TARGETS;。dsh-sandbox的approveEscalation执行:也就是说,当
effectiveMode === "danger-full-access"时,任何sandbox_permissions取值都是非变宽请求,都会在执行前被拒绝。schema 广告的是一个在当前会话状态下结构上无法使用的“杠杆”,所以遵循 schema(而非自然语言提示)的模型会反复踩中。这个问题尤其常见,因为这些工具的描述本身会告诉模型:在被拒绝后要“escalate immediately in the same turn ... retry the exact same command once with
sandbox_permissions”。于是只要出现任何形似拒绝的标记,模型就会在重试时规规矩矩地再次附带这对字段,结果不是因为重试跑通,而是再次报这个错。影响
danger-full-access会话中频繁出现“执行前”工具失败。sandbox_permissions”)之间形成令人困惑的矛盾。建议方向(不削弱安全边界)
我理解 schema 是注册表全局的,而生效模式是按调用 / 按会话的真实状态,因此 enum 无法简单地按会话裁剪。供维护者考虑的几个方向:
requestedMode === effectiveMode时,把它当作空操作升级处理(沿用当前生效模式),而不是抛错——即幂等重试——同时对更窄或非变宽的请求仍然拒绝。这样既保留了对真实升级的严格变宽保证,又不再惩罚冗余情况。effectiveMode已经位于最高档(danger-full-access)时静默剥离 / 忽略这对字段,因为此时没有任何更宽的权限可授予,任何审批也不可能让它变宽。effectiveMode === danger-full-access+ 冗余sandbox_permissions: "danger-full-access"+ 审批never的测试,覆盖pwsh/bash/write/edit。approveEscalation本身的严格变宽不变式应当保留——需要改的只是对同模式请求的广告 / 执行前处理。All reactions