Dis2017/dsh-run-guard

Plugin插件 Native原生 ⭐ 5 MIT Approval & Security审批与安全

Project Overview项目介绍

dsh-run-guard is a native plugin built exclusively for DeepSeek Harness (DSH) that addresses runtime anomalies in long LLM tasks. It targets two specific issues that commonly occur when running DeepSeek V4 Flash with maximum reasoning effort: infinite reasoning loops that waste resources and the model stopping early without completing the assigned task. To install the official release from GitHub, users can run the command dsh plugin --profile web add "github:Dis2017/dsh-run-guard#v0.1.18" via DSH CLI, which automatically detects the DSH bundle manifest and mounts the plugin. After installation, users can verify the mount status and adjust all configuration options in the DSH GUI settings.

The plugin comes with four core capabilities to regulate the agent’s runtime. The guard capability intercepts infinite loops within 1 to 2 seconds and triggers automatic retries, up to a configurable limit per turn. It also adds retries for transient upstream errors that are not included in DSH’s default retry list. The continue capability automatically injects a prompt to resume the task when the model stops early, and the pause capability lets the model proactively pause the run for manual intervention. All capabilities are designed to work together seamlessly, with guard and continue features complementary to each other, creating a closed-loop regulation that avoids conflicting actions.

The plugin is released under the permissive MIT open-source license. It includes 54 unit and integration tests that cover all core functionality, from loop detection accuracy to error recovery and edge cases. Development mode supports mounting via absolute file path, so code changes take effect immediately without re-installation. The repository also includes clear troubleshooting steps for common issues like dependency conflicts and slow loading of old sessions. Users developing custom changes can follow the documented iteration process to tag and release new versions, and the dependency convention ensures no dependency conflicts with the core DSH installation.

这是一款专为 DeepSeek Harness 开发的原生安全插件,用于调控 Agent 运行时异常,解决 DeepSeek V4 Flash 在高推理强度长任务中出现的两类典型问题:推理死循环空转不停、输出推理后提前停摆不干活。用户可通过 DSH 命令行工具快速安装,安装后可在 DSH 图形界面设置中验证启用状态与调整配置。

插件核心能力分为四部分:死循环拦截可在1-2秒内中断重复推理并自动重试,上游请求失败可自动重试非默认集合内的瞬时错误,提前停摆可自动注入提示续跑任务,还支持模型主动调用暂停工具人工中断运行。插件采用刹车油门一体化设计,状态感知闭环自洽,互不干扰。

该插件采用 MIT 许可证开源,提供54个单元与集成测试覆盖所有核心功能,开发模式支持绝对路径挂载,修改代码可即时生效。若遇到常见报错,仓库文档提供了明确的故障排查步骤,用户可按指引修复依赖与历史会话问题。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • Only 5 stars - very few users, little community feedback星标只有 5,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add "github:Dis2017/dsh-run-guard#v0.1.18"

把 Dis2017/dsh-run-guard 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

🛡️ dsh-run-guard

DeepSeek Harness 插件 · Agent 运行节奏守护 — 一体两面,让 LLM 在长任务中既不会「推理死循环停不下来」,也不会「想完就停不干活」。

GitHub stars dsh-plugin License


✨ 功能特性

能力 方向 说明
guard(刹车) 拦截推理死循环 监听 llm/stream 流,滑动窗口重复率检测 + 硬性上限双保险,死循环在 1~2 秒内被中断(而非空转数分钟);中断后自动重试(默认每 turn 2 次,可配),仍失败才停止并给出中文原因提示
recovery(恢复) 上游请求失败自动重试 PI_AI_ERROR 等瞬时上游失败(不在 llm-retry 默认集合的)也自动重试(白名单可扩展),与 guard 共用每 turn 上限
continue(油门) 防止提前停摆 turn 正常结束后自动续跑:有未完成 todo 时注入状态续跑;无 todo 但模型「想完就停」(最后只有推理、无正文无工具调用)时注入简洁提示续跑
pause_work 暂停 人工控制 模型可随时调用 pause_work 工具主动暂停,两路都不会再自动继续

核心设计:刹车与油门共用一套状态感知,互不干扰——guard 中断的 turn 以 error 结束,continue 天然不会误推;continue 推进的新 turn 若再次死循环,guard 立刻拦截。闭环自洽。


🎯 为什么需要它

DeepSeek V4 Flash 配合 reasoningEffort: max 在长任务中会出现两种典型异常:

  1. 想完就停:模型输出完整思考后直接正常结束 turn,没有正文、没有工具调用,留下未完成的任务——表现为「不干活」。
  2. 推理死循环:模型推理进入重复空转(实测单步可输出 10.9 万块、132 万字符垃圾推理),持续数分钟不停——表现为「停不下来」。

DeepSeek Harness 的 agent loop 本身对这两种异常都没有调控机制。本插件在两端补齐:guard 保证它不会无限干活,continue 保证它不会不干活。


🧠 工作原理

模型推理流 ──► llm/stream (waterfall) ──► [guard] 滑动窗口重复率 + 硬闸
                                            │ 触发:注入 REASONING_GUARD 错误中断
                                            ▼
                                   agent/request-error 恢复扩展点
                                            │ 错误码 ∈ {REASONING_GUARD} ∪ autoRetryErrors 且
                                            │ 该 turn 重试 < maxGuardRetries → 自动重跑 step
                                            └─ 超限或非可重试错误 → turn 以 error 结束(用户可见)
                                            ▲
                                            │ 天然抑制:continue 只在 completed 触发
                                            │
turn/end (completed) ──► [continue] 有 todo → 注入状态续跑(计数上限)
                              └─────── 无 todo + 想完就停 → 注入简洁提示续跑(无上限)
                              └─────── pause_work 已标记 → 不续跑

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev dsh-client-ui-brand 下一个 Next dsh-fetch-timeouts →