Skip to content

dsh-loop-breaker

Verified

dsh-loop-breaker · v0.1.0 · MIT

Same-args circuit breaker for DeepSeek Harness: blocks identical tool calls repeated in a sliding window via ctx.tools.guard (agent loop prevention)

Install

dsh plugin add dsh-loop-breaker

Confirm the layer applied with dsh --profile default --dump-config — see the install guide.

Source

Tags

Readme

dsh-loop-breaker · 同参熔断闸

宿主工具管线防线:副作用工具同参连续调用第 2 次起硬拦,拒绝理由作为 tool result 回模型——打断工具循环的「重发→成功回执」正反馈。

由来:2026-09-11 kimi 21 连发案治本件(某长循环 agent 窗·同参 memory_write 21 连发 21 条全入库·根因=模型上下文模式自续+宿主无熔断)。

机制

  • 官方否决面:ctx.tools.guard(dsh-tools · 同步判定 · 返回字符串即拒)
  • 口径:副作用工具白名单(memory_write / cordis_* / send_message / subagent 系等 15 件)· 同 agent + 同工具 + 规范化同参 · 10 分钟滑动窗 · 第 2 次起拦
  • 读型/幂等工具(read/grep/glob/bash/memory 读系等)零拦截面
  • 闸自身任何异常→放行(永不成为新故障源)
  • 可选 config:{ threshold?: number=2, windowMs?: number=600000, extraTools?: string[] }

安装

标准路径(Profile Bundle):

dsh plugin --profile web add dsh-loop-breaker

本机部署说明:本包为本地 vendor 私有件,实际挂载走 ~/.dsh/profiles/web/cordis.patch.yml 的 insert 行(- id: legion-loop-breaker)+ package.json 的 file: 依赖行;包内 cordis.patch.yml 供标准安装流程使用。新增插件码面需重启生效。

验收

同参双发任一副作用工具,第二发应得到:

⛔ 同参熔断闸:工具「…」在 10 分钟窗内以完全相同参数第 2 次调用,已拒绝执行。…