yajiangandchenchen/dsh-sandbox-permissions-not-strictly-wider-justification-empty-fix0

dsh-sandbox-permissions-not-strictly-wider-justification-empty-fix

修复 DSH 沙箱在 danger-full-access 模式下空理由或重复提权报错的补丁插件

AI 分析

核心用途是解决 pwsh/bash/fs 等工具在已获得完全访问权限时,模型因发送空理由或重复申请相同权限而被拒绝的 Bug。适合频繁使用终端和文件写入工具的重度 Agent 用户。

包名
dsh-sandbox-permissions-not-strictly-wider-justification-empty-fix
版本
1.0.0
许可证
MIT
最近更新
2026年8月27日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:yajiangandchenchen/dsh-sandbox-permissions-not-strictly-wider-justification-empty-fix

dsh-sandbox-permissions-not-strictly-wider-justification-empty-fix

English | 中文

A DSH plugin that fixes two related bugs in the sandbox_permissions and justification fields across four tools: pwsh, bash, fs (write/edit), and dsh-sandbox.

The Bug

When a session is already at danger-full-access mode, two errors can occur:

  1. Empty justification: The model sends justification: "" (empty string), which triggers validateEscalationArgs to throw invalid justification: expected a non-empty sentence.
  2. No-op escalation: The model sends sandbox_permissions: "danger-full-access" (same as current mode), which triggers approveEscalation to throw sandbox escalation to "X" is not strictly wider.

This is the 4th independent report (GitHub #3519 → #4359 → #4383 → #4412) and affects all sessions using non-default models.

The Fix

Two-layer defense:

  1. Schema descriptions: Updated to clearly explain that same-mode retries are accepted as no-ops, reducing the model's tendency to send empty fields.
  2. Runtime normalization: Added normalization logic at each tool's execute/resolvePolicy entry point to clear escalation parameters when the requested mode is not strictly wider than the effective mode.

How It Works

  • Install (dsh plugin add): The prepare script runs patch.js apply, which backs up original files and applies all modifications.
  • Uninstall (dsh plugin remove): The preuninstall script runs patch.js restore, which restores all original files from backups.

Installation

dsh plugin --profile  add github:your-username/sandbox-escalation-fix

Uninstallation

dsh plugin --profile  remove sandbox-escalation-fix

What Gets Modified

FileChange
dsh-sandbox/lib/index.jsapproveEscalation: throw → return effectiveMode
dsh-tool-pwsh/lib/index.jsimport +WIDER_MODES, execute normalization, schema descriptions
dsh-tool-bash/lib/index.jsimport +WIDER_MODES, execute normalization, schema descriptions
dsh-tool-fs/lib/index.jsimport +WIDER_MODES, resolvePolicy normalization, schema descriptions

Compatibility

  • Compatible with the latest dsh-std plugin meta protocol
  • Does not conflict with other plugins (modifies only tool implementation files)
  • Works with both desktop and web installations (modifies DSH_HOME, which is hard-linked to the desktop app)

License

MIT