Preface¶
DeepSeek Harness (DSH), when processing model requests, throws an LlmError once maxRetries is reached in the default llm-retry plugin’s normal mode, causing the current task to be interrupted. To address this, the dsh-429-guard plugin takes over 429-class errors (including insufficient_quota returned by DeepSeek) that the official plugin has abandoned, providing unlimited automatic retry capability to prevent tasks from being interrupted due to temporary rate limiting or quota issues.
Core Features¶
This plugin works in conjunction with the DSH host-side plugin via a floating widget in the top-right corner of the Web UI, mainly providing the following capabilities:
- Web UI Interaction: Displays a glassmorphism-style shield capsule in the top-right corner. Expanding the card reveals the switch status, retry count, and statistics. The card contains an “Auto Infinite Retry” toggle and a “Reset” button.
- Error Interception: Covers all errors where
code ∈ {RATE_LIMIT, QUOTA},status === 429, or the message contains429/rate limit/quota/insufficient_quota. - Unlimited Retries: When the toggle is enabled, encountering a 429-class error enters a retry loop until success or manual user stop.
- Coexistence Mechanism: Compatible with the official
llm-retryplugin, positioned downstream in the retry chain (waterfall), only taking over after the official plugin gives up. - Cancellability: Listens for the agent’s abort signal during retries; when a user manually stops the task, the current retry is immediately abandoned.
- Persistent Statistics: Cumulative retry count, last interception time, and other data are stored in
$(DSH_HOME)/storages/dsh-429-guard.json.
Installation and Activation¶
After installing the plugin, the DSH Web application must be restarted to load the components.
dsh plugin --profile web add github:suufon/dsh-429-guard
After installation, a shield floating widget should appear in the top-right corner. To uninstall:
dsh plugin --profile web remove dsh-429-guard
Usage¶
- View and Control: Click the shield capsule in the top-right corner to expand the card. The card displays the current toggle status.
- Enable Retry: Turn on the “Auto Infinite Retry” toggle.
- Observe Retries: When a model request encounters a 429 or insufficient quota error, the system automatically starts retrying, the retry count on the card increases, and a “Retrying” breathing light effect is displayed.
- Status Alert: If the error type is
QUOTA(quota exhausted), the card displays a prominent warning, and the capsule status dot turns yellow. - Stop or Reset: Close the toggle when automatic retries are no longer needed to restore default pass-through; click “Reset” to clear the statistics counters.
Technical Implementation and Mechanism¶
- Architecture Design: Adopts a dual-layer architecture. The host side (
lib/index.js) listens for theagent/request-errorevent and executes retry logic; the client side (lib/client.js) provides the floating widget UI and communicates via REST API. - Retry Chain: A request failure triggers the
agent/request-errorevent. After the officialllm-retryplugin gives up, this plugin takes over. If the toggle is enabled and the error is determined to be a 429-class error, it returnskind: 'retry', and the Agent loops to re-initiate the request. - Backoff Strategy:
- Prefer the
retry-afterreturned by the provider (capped at 240s). - Otherwise, use exponential backoff (initial 2s, doubling each time, capped at 60s, with ±25% jitter).
- Prefer the
- Security Restrictions: REST API routes only allow access from loopback trusted origins (same-origin, 127.0.0.1/::1) to prevent CSRF attacks.
Summary¶
dsh-429-guard is a lightweight guard plugin designed for the DSH environment. By combining UI interaction with backend retry logic, it solves the problem of the official plugin giving up too early when handling 429 errors. It is released under the MIT license and is suitable for developers who need to handle burst rate-limiting scenarios during long-running tasks.
Project URL: https://github.com/suufon/dsh-429-guard