dsh-auto-review:DeepSeek Harness 的自动审批判断插件

前言

在 DSH 插件化使用方式里,一个具体问题是如何处理审批:当会话的 approval policy 已经设为 'auto' 时,超出 workspace-write 的 sandbox escalation 是否仍要等待人工 prompt。

dsh-auto-review 提供的是一个 approval answerer:先用 deterministic filter 处理明确允许或拒绝的命令,再对灰区请求做 clean-context LLM safety review,让这类 approval 判断可以在没有人工 prompt 的情况下完成。

这是什么

accpowered/dsh-auto-review 是 DeepSeek Harness 的 LLM auto-review approval answerer 插件,许可证为 MIT。

它面向 approval policy'auto' 的会话,解决的是超出 workspace-write 的 sandbox escalation 自动审批问题。插件以 answerer 的方式接入 approval/request,在满足条件时给出自动判断,在不满足条件时继续委托原有链路。

核心能力

确定性过滤

插件会先执行 deterministic filter:

  • hardline 规则是 always-deny。
  • 对 normalized command 应用 denyallow regex rules。
  • 命中 hardlinedeny 时立即拒绝。
  • 命中 allow 时立即允许。
  • 既未命中 deny,也未命中 allow 时,才进入 LLM 审查。

确定性拒绝是最终结果,不会被 appeal 推翻。

clean-context LLM 安全审查

灰区请求进入 clean-context LLM safety review。

发送给 reviewer 的内容只携带:

  • tool name
  • justification
  • XML-wrapped command

不会携带完整会话上下文。

appeal mode

默认 appeal mode 允许使用真实 user prompts 重新判断 LLM 给出的 DENY

这个机制只能放宽 denial,不能收紧 allowance。它用于减少误拒,不是用来扩大沙箱权限的机制。

注册与委托

answerer 在 approval/request 上以 { prepend: true } 注册,因此会先于后续 human/machine answerer 运行。

当以下任一情况出现时,它会委托 next()

  • 当前 effective policy 不是 'auto'
  • 请求没有 action

连续拒绝保护

插件支持 consecutive-denial circuit breaker,配置项为 denialBreakerThreshold

用户层覆盖

插件提供 auto-review settings namespace 的用户层 live overrides,允许在用户层调整部分可覆盖配置。

安装与启用

先确认 harness core 已 patch。该插件不能运行在 stock upstream deepseek-harness 上;在未 patch 的 vanilla upstream 上,插件会保持 inert,并委托 normal human answerers。

从 GitHub 安装:

dsh plugin --profile web add github:accpowered/dsh-auto-review

从本地 checkout 安装:

dsh plugin --profile web add ./dsh-auto-review

安装时 pnpm 可能会询问 allowBuilds。这是安装时的构建权限,建议只允许信任的来源,并优先考虑固定 commit。

安装完成后,重启 dsh web,或重启对应 profile。

配置

插件使用 reviewer 的 providermodel。如果要换用其他 reviewer,需要重写 cordis.patch.yml 中的对应 row,并填写必填的 providermodel

hardlinemaxTokenstimeoutMs 按设计只能通过 composition 层设置。用户层可覆盖的配置通过 auto-review settings namespace 生效。

卸载

dsh plugin --profile web remove dsh-auto-review

适用场景与注意

适合运行 DSH profile、希望减少人工审批中断,并且愿意维护 patched harness core 的开发者或管理员。

使用之前需要注意:

  • 插件依赖 patched harness core;未 patch 时不会自动决策。
  • 插件会在 dsh 进程中加载执行,因此会以当前 dsh 进程拥有的权限运行。
  • 安装前建议检查源码、依赖和许可证。
  • deterministic denials 是 final 的,operator policy 不会被 appeal。
  • appeal 只能放宽 denial,不能收紧 allowance。
  • reviewer 是 defense-in-depth,不是 sandbox-widening 机制。

链接

  • 插件目录:https://www.skillhub.cn/plugins/accpowered/dsh-auto-review
  • GitHub:https://github.com/accpowered/dsh-auto-review
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

小夜