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 應用 deny 和 allow regex rules。
  • 命中 hardline 或 deny 時立即拒絕。
  • 命中 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 的 provider 和 model。如果要換用其他 reviewer,需要重寫 cordis.patch.yml 中的對應 row,並填寫必填的 provider 和 model。

hardline、maxTokens 和 timeoutMs 按設計只能通過 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
羽毛球分组比赛记分
小程序二维码

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

小夜