dsh-reconnect: Secure Retry and Gateway Recovery for DSH Model Requests

Introduction

When running agents or long-running tasks in DeepSeek Harness (DSH), model requests often fail due to brief network jitter, gateway anomalies, or upstream rate limiting. If you rely solely on the Provider’s built-in normal retry strategy, the turn is often interrupted directly once the strategy is exhausted. Below is an introduction to the community plugin dsh-reconnect (maintained by mrbeandev), which takes over recoverable errors on DSH’s agent/request-error waterfall, resubmits the same model request with exponential backoff, and supports a Web-based configuration panel.

What Is This

dsh-reconnect is a model-inference plugin for DSH, with the npm package name dsh-reconnect, currently at version 2.0.0 (MIT license). Its purpose is: after the built-in Provider retries are exhausted, or when the always strategy hands recovery over to downstream layers, to safely retry recoverable model requests, avoiding temporary faults from interrupting agent turns or long-running tasks.

The plugin listens to DSH’s agent/request-error event; it decides whether to retry based on machine-readable error codes and does not infer model failures from arbitrary tool outputs (tool execution failures in tool/result are outside this plugin’s retry boundary).

Retry Strategy

The strategy from the README is as follows (used in conjunction with the Provider strategy):

Condition Behavior
EMPTY_RESPONSE, RATE_LIMIT, SERVER, STREAM_CLOSED, TIMEOUT, TRANSPORT Retry indefinitely
Model missing or not configured Retry indefinitely until the configuration is restored
QUOTA No retry by default; can be enabled via retryQuota
Unknown errors (e.g., PI_AI_ERROR) Retry indefinitely by default; can be capped after disabling retryUnknown
Tool, parameter, authentication, credential, context overflow, abort-type errors No retry

Backoff, Cancellation, and Session Events

  • Exponential backoff: 1s → 2s → 4s → …, with a default upper limit of 60 seconds (maxDelayMs controls the local backoff cap, without restricting the Provider’s Retry-After or the total retry duration).
  • If the Provider returns a positive Retry-After, it is used as the minimum wait time with no upper bound.
  • Emits standard llm/retry and llm/retry-started session events; the Harness conversation UI can display retry counts and countdowns.
  • Stops immediately when the turn is aborted or the plugin is unloaded; pending waits are safely drained during hot reload and shutdown.

Installation and Activation

It is recommended to install and activate via npm in the web profile:

dsh plugin --profile web add dsh-reconnect

After installation, you must restart the running DSH web process. The package declares a dsh.bundle patch, and the profile package manager automatically adds it to the active bundle; manual changes to cordis.yml are usually unnecessary.

Update or remove:

dsh plugin --profile web update dsh-reconnect
dsh plugin --profile web remove dsh-reconnect

You can also install from GitHub, pinning a version for reproducibility:

dsh plugin --profile web add github:mrbeandev/dsh-reconnect
dsh plugin --profile web add github:mrbeandev/dsh-reconnect#v2.0.0

Environment requirements (from the README):

  • DeepSeek Harness with a Host settings service
  • Node.js ^22.19.0 or >=24.0.0
  • The web profile is required to see the visual settings card (the client-side settings card does not read credentials)

Configuration and Settings Panel

In Settings → Plugins → Plugin configuration → ReConnect automatic retry you can adjust:

  • Maximum retry delay: 1, 2, 5, 10, 30, 60, 120 seconds, or a custom value
  • Retry quota errors: off by default
  • Retry unknown errors indefinitely: on by default
  • Maximum unknown-error retries: defaults to 3, effective only when indefinite unknown-error retry is off

Changes take effect immediately.

YAML example (insert the reconnect plugin block):

- insert:
    - id: reconnect
      name: dsh-reconnect
      config:
        maxDelayMs: 15000
        retryQuota: false
        retryUnknown: true
        unknownMaxRetries: 3
Option Type Default Description
maxDelayMs integer 60000 Maximum local exponential backoff delay (milliseconds)
retryQuota boolean false Whether to retry indefinitely on quota/balance exhaustion errors
retryUnknown boolean true Whether to retry indefinitely on unknown error codes
unknownMaxRetries integer 3 Upper limit on consecutive unknown errors when retryUnknown is false

Use Cases and Notes

Suitable for: DSH web users who need to run agents for extended periods, have high tolerance requirements for occasional gateway/network/rate-limit failures, and want clear retry progress in the UI.

Notes:

  1. The plugin runs under the permissions of the current DSH process; review the GitHub source code and the MIT license before installation.
  2. Quota errors are not retried by default, to avoid meaningless request flooding when the balance is exhausted; if business needs explicitly require it, enable retryQuota.
  3. The community plugin directory SkillHub is an independent ecosystem site with no official affiliation to DeepSeek / 幻方 (High-Flyer); DSH itself follows “everything is a plugin”, and this package is a community-maintained version on npm and GitHub. The English version evolved from the MIT-licensed MistRain-1/dsh-reconnect.

Conclusion

With the steps above, you gain a layer of configurable, observable model request recovery beyond the Provider’s retries. Directory page: https://www.skillhub.cn/plugins/mrbeandev/dsh-reconnect; source code and full documentation: https://github.com/mrbeandev/dsh-reconnect; npm: https://www.npmjs.com/package/dsh-reconnect.

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

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

Xiaoye