dsh-loop-breaker: Hard Stop Loss Plugin

Preface

In the agent loop execution of DeepSeek Harness (DSH), issues such as excessively high step counts in a single turn or getting stuck in repetitive calls sometimes occur. According to actual test logs from September 13, 2026, a single turn could run up to 337 steps, with the same command being called repeatedly 120 or even 85 times.

The repeat-tool-reminder plugin included with DSH only issues reminders without interrupting the process; meanwhile, dsh-agent-loop currently only exposes the maxParallelToolCalls parameter and lacks control over the maximum step limit. This often forces users to wait for hours or manually input /stop at the very last moment.

The dsh-loop-breaker plugin is designed to address this gap by providing a hard stop-loss mechanism that directly interrupts the current turn upon detecting repetitive calls.

Positioning

This is a hard stop-loss plugin designed to forcibly interrupt the current execution turn within the DSH environment when the same tool is repeatedly called with the same parameters.

  • Maintainer: ikta2010
  • License: MIT
  • Core Function: Prevents the Agent from falling into infinite loops or invalid repetitions.

Core Features

The plugin implements its logic through two upstream extension points:

  1. tools/post-execute (waterfall): Counts occurrences. When the threshold is reached, it returns {kind:'block', feedback, additionalContexts} to veto the current result and display an explanation.
  2. agent/pre-step (waterfall): Returns {kind:'reject'} to prevent the next step from proceeding, thereby ending the current turn.

The judgment key is “Tool Name + Normalized JSON of Parameters”. This means that normal differentiated command calls will not trigger false positives.

Configuration items support the following functions:
* consecutiveLimit: Controls how many consecutive repetitions trigger a hard stop.
* totalLimit: Controls how many cumulative repetitions within a single turn trigger a hard stop.
* include / exclude: Filters the list of tools to be counted.
* argumentsPreviewChars: Controls the number of characters for the parameter preview.

Installation and Activation

The installation script is located at the specified path; simply execute it:

bash /nas/dsh/工具/dsh-loop-breaker/install.sh

After installation, you must restart dsh web once to load the plugin. The webpage will disconnect briefly during the restart, but session data will not be lost:

dsh-restart

Typical Usage

Add the following YAML configuration to the DSH configuration file:

- id: loop-breaker
  name: 'dsh-loop-breaker'
  config:
    consecutiveLimit: 4      # How many consecutive repetitions trigger a hard stop
    totalLimit: 12           # How many cumulative repetitions trigger a hard stop in a single turn
    include: []              # Only count these tools (empty = all)
    exclude: []              # Exclude these tools
    argumentsPreviewChars: 400

Use Cases and Notes

This plugin runs with the permissions of the current DSH process. It is recommended to review the source code and license before installation.

  • Loading Mechanism: The plugin requires a Web service restart to take effect after installation.
  • Judgment Logic: Relies on the tool name and normalized JSON as judgment keys, effectively distinguishing between different commands to avoid false positives in normal business logic.
  • Ecosystem Background: The core concept of DSH is “Everything is a plugin.” Community directories (such as SkillHub) provide plugin indexes independent of DeepSeek or High-Flyer for developers to consult.

Conclusion

dsh-loop-breaker compensates for the shortcoming of repeat-tool-reminder—which only reminds but does not interrupt—providing necessary hard constraints for the DSH agent loop. Through reasonable settings for consecutiveLimit and totalLimit, it can effectively prevent long periods of meaningless repetitive execution.

羽毛球分组比赛记分
小程序二维码

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

Xiaoye