Introduction

When connecting to SenseTime SenseNova or other LLM gateways, you may encounter transient failures. When the gateway returns 429 insufficient_quota, DSH’s error classifier categorizes it as a QUOTA code rather than the generic RATE_LIMIT code. By default, DSH’s built-in retry mechanism (dsh-llm-retry) does not include the QUOTA error code, causing such requests to fail-fast on the first failure and preventing recovery through retries. This requires manual intervention by developers or frequent use of the “Continue” feature.

The dsh-retry-boost plugin is designed to solve this problem. It hot-injects a hardened retryPolicy to cover all llm-pi-ai providers and uses an exponential backoff mechanism to automatically retry until the task completes.

What It Is

This is a DeepSeek Harness (DSH) workflow plugin maintained by developer hhb1028 and licensed under the MIT License.

Its core role is to hot-inject a retryPolicy that includes the QUOTA error code into the configuration of all llm-pi-ai providers when DSH starts. Because the change is merged through DSH’s settings provider, it takes effect immediately without restarting the process.

Core Features

  1. Hot injection at startup: After DSH starts, the plugin automatically fills in or enhances retry policies for all existing llm-pi-ai providers.
  2. Automatic runtime completion: The plugin listens to the llm/adapters-updated event. Providers added while DSH is running are automatically given a protected retryPolicy without requiring a restart.
  3. Variant route detection: The plugin automatically detects unprotected variant routes (such as vision-toolkit-*) and emits warnings in the logs, indicating that these routes may still be interrupted by QUOTA errors.
  4. Flexible policy configuration: Supports the fill, boost, and force strategies, as well as the normal (bounded retries) and always (unlimited retries) modes.
  5. Exponential backoff: Uses an exponential backoff policy from 1s to 60s with a 0.2 jitter ratio to mitigate network congestion.

Installation and Activation

Install the plugin through the official CLI. Ensure that your DSH version meets the requirement (>= 0.1.1-rc.1).

dsh plugin --profile <你的profile名> add dsh-retry-boost

After installation, restart DSH. The logs will display a success message indicating that the injection succeeded, for example:
dsh-retry-boost: injected retry policy for "sensenova" (mode=normal retries=50 backoff=1000ms->60000ms codes=8)

The injected policy is written directly to the llm-pi-ai.providers.*.retryPolicy section in the profile’s settings.yaml. You can modify it manually at any time.

Configuration Options

Adjust the parameters in the profile’s cordis.patch.yml roster line or in the DSH plugin configuration UI:

Key Default Description
strategy fill fill: only handles providers that do not have an explicit retryPolicy; boost: merges missing error codes and raises limits; force: replaces all of them with the plugin’s policy
mode normal normal: bounded retries; always: infinite retries (use with caution)
maxRetries 50 Maximum retry count in normal mode
initialDelayMs 1000 Initial backoff delay (milliseconds)
maxDelayMs 60000 Maximum backoff delay (milliseconds)
jitterRatio 0.2 Jitter ratio (0-1)
retryableCodes 8 codes List of failure codes that should be retried (includes QUOTA)
warnUnprotectedVariants true Whether to warn when unprotected variant routes are detected

Coverage and Known Limitations

This plugin only affects providers under the llm-pi-ai namespace. The following paths are out of scope and are not protected by this plugin:

  1. Image input variant routes (such as vision-toolkit-*): These routes are registered by vision plugins through registerAdapter. Their retryPolicy is captured at registration time and does not read settings from llm-pi-ai. The plugin warns about this, but it cannot directly fix it.
  2. Third-party LLM adapter plugins: Routes owned by and registered through other plugins also do not go through the llm-pi-ai namespace.

Environment Requirements:
* DeepSeek Harness >= 0.1.1-rc.1
* Node.js >= 20

Uninstallation Notes:
After uninstalling, the injected retryPolicy section in settings.yaml is not automatically removed. You must manually clean up this configuration section to restore DSH’s default behavior.

Differences from dsh-chat-continue

Feature dsh-retry-boost (this project) dsh-chat-continue
Positioning First line of defense: enables DSH’s built-in retry mechanism Second line of defense: fallback retries after the built-in retry mechanism is exhausted
Mechanism Hot-injects retryPolicy and uses the official retry path Intercepts agent/request-error and resends the request itself
Backoff Exponential backoff (1s -> 60s + jitter) Fixed interval
Complementarity Used alone, it can resolve most transient failures Can be stacked as a last-resort safeguard

Conclusion

dsh-retry-boost standardizes a retry policy validated in production environments, resolving 429 transient failure issues in scenarios such as SenseTime gateways. After installation, DSH’s built-in retry mechanism will be able to handle QUOTA errors, greatly reducing task interruptions caused by network jitter.

For more details and the source code, visit the GitHub repository.