MistRain-1/dsh-reconnect
断线无限重新连接,适用于不稳定的API或者中转站
Project Overview项目介绍
dsh-reconnect is a Host-side plugin for DeepSeek Harness that retries failed model requests with exponential backoff after the built-in Provider policy gives up. It covers dropped connections, rate limits, timeouts, 5xx, and missing-model errors, making it suitable for unstable relays, gateways, and long-running tasks. Configuration is done via the settings card or YAML, with no restart required. QUOTA is skipped by default, unknown errors retry indefinitely unless capped, tool errors are not retried, and a provider Retry-After bypasses the local backoff cap.
dsh-reconnect 是 DeepSeek Harness 的 Host 端插件,监听 agent/request-error 事件,对失败模型请求按指数退避自动重试,覆盖断连、超时、限流、5xx 及缺失模型等场景,适用于不稳定中转节点和长任务。需在设置面板或 YAML 中配置 maxDelayMs 等参数;QUOTA 默认不重试,未知错误无限重试但可设上限。Provider Retry-After 不受本地封顶限制,工具错误不触发重试。
请帮我了解并安装插件:【dsh-reconnect】【https://github.com/MistRain-1/dsh-reconnect】
Send this message to DSH in your current session. CLI install commands may not be accurate across systems — DSH will figure it out for you.把上面这条消息直接发给当前会话里的 DSH,让它帮你了解并安装。安装命令不一定准确,发给 DSH 更稳。
Or use CLI install (for developers)或使用命令行安装(适合开发者)
CLI Install命令行安装
dsh plugin --profile web add github:MistRain-1/dsh-reconnect
把 MistRain-1/dsh-reconnect 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-reconnect
Safe model-request retry for DeepSeek Harness with exponential backoff, relay/proxy failure recovery, and a unified settings panel.
Version: 2.0.0
Project Description
dsh-reconnect is a Host-side plugin for DeepSeek Harness (DSH). It retries failed model requests so temporary network failures do not interrupt an agent turn or a long-running task.
The plugin listens to the DSH agent/request-error waterfall event. After the built-in normal Provider retry policy gives up, or when a Provider's always policy delegates recovery downstream, the Agent loop sends the same request again according to this plugin's policy.
Suitable Use Cases
- Unstable relay stations, reverse proxies, API gateways, or forwarding services
- Relay nodes that disconnect, reset connections, or return incomplete responses
- Intermittent network failures and transport errors
- Temporary provider outages, server-side 5xx errors, rate limits, and timeouts
- Long-running tasks that should survive short-lived provider or network failures
Retry Policy
| Condition | Behavior |
|---|---|
EMPTY_RESPONSE / RATE_LIMIT / SERVER / STREAM_CLOSED / TIMEOUT / TRANSPORT |
Retry indefinitely (transient connection/service failures) |
Model missing or not configured (MODEL_NOT_FOUND, MODEL_NOT_CONFIGURED, or matching Provider text) |
Retry indefinitely while waiting for model/account configuration to recover |
QUOTA (insufficient balance or exhausted quota) |
Do not retry by default; retried when retryQuota: true |
Unknown errors such as PI_AI_ERROR |
Retry indefinitely by default; disable retryUnknown to apply the configurable consecutive-failure cap |
| Tool/argument/unknown-tool/auth/credential/context-overflow/aborted | Never retried; step ends immediately |
Key design points:
- Only retries failures that "resending the same request" can fix — dropped connections, rate limits, timeouts, 5xx.
- Tool execution errors (
tool/result) are outside this plugin's retry boundary. Error routing uses the machine code fromagent/request-error, rather than guessing from message text; an unknown machine code uses the configured unknown-error path (bounded only whenretryUnknownis disabled). - Permanent errors (credentials, request content, context overflow) stop immediately; missing or unconfigured models are the deliberate exception and keep retrying while configuration recovers.
retryQuotaandretryUnknowncontrol this plugin's fallback chain. The Hostalwayspolicy delegates recovery to downstream waterfall listeners, so this plugin handles the recoverable failure categories once and does not create a second parallel retry loop.
Backoff and Cancellation
- Exponential backoff:
1s -> 2s -> 4s -> ..., capped at60sby default (the settings panel offers 1/2/5/10/30/60/120 seconds or a custom value;maxDelayMsoverrides in milliseconds) - Honors a positive
providerRetryAfterMswhen available. It is a provider minimum wait and is not capped by the local exponential-backoff limit; only the Node timer maximum applies. - Logs the provider, error code, turn, step, retry count, and delay
- Emits standard
llm/retryevents so the Harness conversation UI shows the continuous retry count and countdown - Stops when the current turn is aborted, the plugin is stopped, or the plugin is hot-reloaded; active waits are drained during cleanup.
Visual Configuration
Open Settings → Plugin configuration. ReConnect is shown as a plugin card in that page:
- Max wait per attempt: drop-down presets (1/2/5/10/30/60/120 seconds) or a custom value
- Retry on quota: toggle, off by default
- Retry unknown errors indefinitely: toggle, on by default
- Max retries for unknown errors: default 3. Missing or unconfigured model errors are not subject to this cap and always retry.
Changes take effect immediately without restarting DSH.
YAML Configuration
The plugin accepts optional values in its Cordis row config:
maxDelayMs(integer milliseconds, default60000): caps the local exponential-backoff delay; for example15000produces1s -> 2s -> 4s -> 8s -> 15s -> 15s...indefinitely. A positive ProviderRetry-Afterremains authoritative.retryQuota(boolean, defaultfalse): whetherQUOTAerrors are also retried.retryUnknown(boolean, defaulttrue): whether unknown errors are retried indefinitely.unknownMaxRetries(integer, default3): bounded cap for consecutive unknown failures in the same model step; missing or unconfigured model errors do not use this cap.
The settings service persists the plugin card values. Restore defaults removes the user overrides and immediately returns to the schema/Cordis defaults; a restart is not required.
The plugin's own retry policy is the downstream recovery for both Provider normal and always policies. The two layers do not multiply retries: normal schedules only its configured codes before this plugin, while always delegates the decision downstream.
maxDelayMs caps the local exponential wait, not a Provider Retry-After value and not the total retry duration.
- insert:
- id: reconnect
name: dsh-reconnect
config:
maxDelayMs: 15000
retryQuota: false
retryUnknown: true
Invalid or missing maxDelayMs values fall back to 60000.
Download
The package is platform-independent. Choose one of the following methods.
Method 1: GitHub Web Download
- Open https://github.com/MistRain-1/dsh-reconnect.
- Select Code and then Download ZIP.
- Extract the archive and use the extracted
dsh-reconnect-maindirectory as the plugin package.
Method 2: Git Clone
Windows PowerShell:
git clone https://github.com/MistRain-1/dsh-reconnect.git "$HOME\dsh-reconnect"
macOS:
git clone https://github.com/MistRain-1/dsh-reconnect.git "$HOME/dsh-reconnect"
Linux:
git clone https://github.com/MistRain-1/dsh-reconnect.git "$HOME/dsh-reconnect"
Method 3: Download the ZIP from a Terminal
Windows PowerShell:
Invoke-WebRequest -Uri https://github.com/MistRain-1/dsh-reconnect/archive/refs/heads/main.zip -OutFile dsh-reconnect.zip
Expand-Archive -Path dsh-reconnect.zip -DestinationPath .
macOS:
curl -L https://github.com/MistRain-1/dsh-reconnect/archive/refs/heads/main.zip -o dsh-reconnect.zip
unzip dsh-reconnect.zip
Linux:
wget https://github.com/MistRain-1/dsh-reconnect/archive/refs/heads/main.zip -O dsh-reconnect.zip
unzip dsh-reconnect.zip
After downloading, register the package in the DSH Cordis composition:
- insert:
- id: reconnect
name: dsh-reconnect
A DSH restart is required after installing the persistent plugin package.
Requirements
- DSH Host plugin
- Uses the
agent/request-errorwaterfall event and the Host settings service - Client side provides a unified-format settings card and never reads credentials
License
MIT
Han-1413141/dsh-cost-meter
Ychris12138/dsh-usage-stats
slywalker2006/dsh-passwords
songoao25/dsh-bottom-info-bar
LiZhenNet/dsh-antigravity
dingminhua/dsh-connect-trae
wenzetan/dsh-quota-panel