@ohmykreee/dsh-llm-retry-boost: Infinite Retries with Bounded Backoff for Transient Failures

Introduction

When running Agents in DeepSeek Harness (DSH), model requests occasionally encounter overload, rate limiting, timeouts, or network jitter. The built-in executor @deepseek-ai/dsh-llm-retry retries up to 5 times in the default retryPolicy.mode: normal, with backoff starting at 500ms and doubling, capped at 10s. If transient failure recovery is slightly slow, sessions may fail after just a few retries.

Some adjust the provider’s retryPolicy to always to get infinite retries, but that causes configuration errors like authentication failures, invalid requests, and running out of credits to be retried infinitely as well, causing the interface to spin indefinitely while real errors appear late. Below is an introduction to the community plugin @ohmykreee/dsh-llm-retry-boost (maintainer ohmykreee, category: Model Inference): It performs “configurable attempts + capped backoff” only for transient failures; other errors are handed back to the built-in logic.

What is it

@ohmykreee/dsh-llm-retry-boost is a DSH Host plugin bundle, mounted via the Loader row llm-retry-boost in the profile. It adds a layer of retry for model requests within Agent turns: failures hitting the whitelist are retried by the plugin according to custom budgets and backoff curves; failures not hitting the whitelist are passed to the built-in llm-retry unchanged, behaving the same as without the plugin installed.

The configuration page is a browser bundle (client.js), registered to the plugins.row.config slot of the plugins page. Runtime dependencies are only the host’s built-in @deepseek-ai/schemastery (peer) and the page’s React. Current npm version is 1.0.1, license MIT.

Comparison with Built-in Retry

Comparison of built-in normal (default), built-in always, and this plugin’s default configuration follows (source: project README).

Built-in normal (default) Built-in always This plugin (default config)
Retry count for retryable errors 5 times Unlimited Unlimited (maxRetries: 0)
Wait time for retryable errors 500ms start ×2, 10s cap Same as normal backoff fields 1s start ×2, 60s cap (configurable)
Criteria Error code whitelist No judgment, retry all Whitelist (5 built-in + HTTP status)
Configuration errors Do not retry, report directly Also retried infinitely Handed back to built-in logic (default no retry)

This plugin only replaces the “retry budget,” not the “error classification”: SERVER, RATE_LIMIT, TIMEOUT, TRANSPORT, EMPTY_RESPONSE and matching HTTP statuses are infinitely retried with backoff by the plugin; other errors go to the built-in executor.

Core Behavior

Retry Determination

Whether to enter the plugin’s retry chain depends only on LlmFailure.code / LlmFailure.status:

  1. Error code is in retryableCodes (default EMPTY_RESPONSE, RATE_LIMIT, SERVER, TIMEOUT, TRANSPORT);
  2. Or error code is like HTTP_503 and status is in retryableHttpStatuses (default 408, 425, 429, 500, 502, 503, 504);
  3. Or failure.status hits the same status table.

If hit, the plugin schedules retries; if not, it hands it to the built-in executor unchanged. ABORTED and already aborted turns are never retried.

Wait Time

Backoff formula:

delay(n) = min(initialDelayMs × 2^(n-1) × jitter, maxDelayMs)

n is the nth attempt in the current retry chain (starting from 1); jitter is uniformly chosen within [1-jitterRatio, 1+jitterRatio]. Provider’s Retry-After takes precedence, but does not exceed maxDelayMs. The default curve is approximately 1s → 2s → 4s → … → 60s, then continues retrying at 60s.

Logging and Boundaries

  • Writes to the built-in llm/retry event on scheduling, and llm/retry-started after waiting ends; each retry also prints a warn in the host logs (field logRetries defaults to true).
  • Retry counts are recorded in memory as (session, provider), zeroed on step/start or turn/end; after process restart, backoff starts from initialDelayMs again.
  • Retry stops immediately when a turn is cancelled; plugin unloading removes listeners via cleanup.
  • It only covers failure paths hooked up by the built-in executor within Agent turns; consumers directly calling ctx.llm.stream() do not retry at all.
  • This plugin does not modify the provider’s retryPolicy. If a provider already has retryPolicy: always, configuration errors might still be infinitely retried by the built-in executor after next(), so keeping the default normal avoids this.

Installation and Enabling

Recommended installation via npm:

  1. Open DSH Settings → Plugins → Install Plugin, fill in package name @ohmykreee/dsh-llm-retry-boost.
  2. After installing and enabling, restart DSH or reload the plugin. A line LLM Infinite Retry (Capped Backoff) will appear in the plugins page.

Alternatively, let the Agent install it in DSH by sending:

Install @ohmykreee/dsh-llm-retry-boost plugin and enable.

When installing from source, just fill in the absolute path of this repository’s directory in the Plugin Manager (restart DSH after code changes to take effect). If upgrading from an old version to one with client.js and the config page doesn’t appear, restart DSH, or close and reopen the plugin row then refresh the page.

The plugin runs with the current DSH process permissions; you can view source code and the MIT license at GitHub Repository before installing.

Configuration

Path: Plugins → LLM Infinite Retry (Capped Backoff) → Configure on the row.

Editable fields include: maxRetries (0 means always retry), initialDelayMs, maxDelayMs, jitterRatio, respectRetryAfter, configErrorBehavior, logRetries. The top of the page previews the current backoff curve; after saving, it writes to the current profile and takes effect immediately without a restart. Toggle for daily use is the switch on the right side of the plugin row, not inside the config page.

retryableCodes / retryableHttpStatuses are not in the form and need to be modified in YAML along with the patch.

Loader Row YAML

Complete example (default values in cordis.patch.yml in the repo):

- insert:
    - id: llm-retry-boost
      name: '@ohmykreee/dsh-llm-retry-boost'
      config:
        enabled: true
        retryableCodes: [EMPTY_RESPONSE, RATE_LIMIT, SERVER, TIMEOUT, TRANSPORT]
        retryableHttpStatuses: [408, 425, 429, 500, 502, 503, 504]
        maxRetries: 0
        initialDelayMs: 1000
        maxDelayMs: 60000
        jitterRatio: 0.1
        respectRetryAfter: true
        configErrorBehavior: delegate
        logRetries: true

configErrorBehavior defaults to delegate: non-whitelist errors are handed to the built-in executor (configuration errors report immediately). When set to bounded, non-whitelist errors are still retried, but use the built-in limited count and backoff (from provider’s retryPolicy). Unknown configuration fields cause the loader to fail to load and report the field name, avoiding silent use of default values.

Use Cases and Notes

Suitable for long-running Agents that want transient faults to auto-handle, while avoiding infinite retries for key errors or running out of credits.

Please note:

  1. When maxRetries: 0, the turn will not end in failure during retries; it only stops on success, user cancellation, or plugin unloading. If you don’t need infinite retries, please set a positive maxRetries.
  2. Every retry is a real request and may incur billing.
  3. Backoff counts are not persisted across processes.
  4. Runtime environment requires Node >=22 (see engines in package.json).

Conclusion

@ohmykreee/dsh-llm-retry-boost adds a whitelist to distinguish transient from configuration failures on top of DSH’s built-in retry, uses configurable capped backoff to extend the recovery window for transient faults, and avoids the “infinite spinning” of the always mode.

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

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

Xiaoye