Introduction

In the DeepSeek Harness (DSH) ecosystem, when a model request fails midway while using a slow or unstable endpoint, the default dsh-llm-retry rebuilds the same request and reruns it from scratch. This means that already streamed text (including long reasoning chains) is discarded, and an attempt that has already run for minutes may be repeated multiple times. dsh-resume-turn changes this behavior by resuming an interrupted reply from its partial output.

What Is This

dsh-resume-turn is a plugin for DeepSeek Harness (DSH), maintained by Harris Logic. It belongs to the model inference category and is licensed under the MIT License. The core purpose of this plugin is: when a model reply fails midway due to a network interruption or timeout, it automatically carries the already generated partial output into the next turn, allowing the model to continue from the interruption point instead of rerunning the full request from scratch.

Core Features

  1. Resume from partial output: Automatically collects content from already streamed visible text and reasoning blocks, instead of regenerating it.
  2. Visible guidance message: Injects a visible “auto-resume” guidance message that references the partial output and instructs the model to continue.
  3. Takes over the resume flow: Uses { kind: 'retry' } to take over the recovery/resume logic.
  4. Supports specific failure codes: Supports failure codes such as TIMEOUT, TRANSPORT, SERVER, and RATE_LIMIT.

Installation and Enablement

Installing the plugin requires the DSH package manager. Run the following command to complete the installation:

npx @deepseek-ai/dsh plugin --profile web add github:Harris-Logic/dsh-resume-turn

After installation, restart the configuration profile (or Web host) to activate the plugin. The plugin declares dsh.bundle.patch; the installer automatically appends it to dsh.profile.bundles and automatically applies its cordis.patch.yml plugin line, without requiring manual file edits.

Configuration

The plugin has no mandatory configuration items. Optional configuration items (in the config field of the cordis.patch.yml line in the configuration file, or as bundle configuration) are as follows:

key default meaning
maxResumesPerTurn 3 Maximum number of automatic resumes per turn; after exceeding this, the default retry takes over
resumeCodes ["TIMEOUT","TRANSPORT","SERVER","RATE_LIMIT"] Failure codes eligible for resume
initialDelayMs 2000 Backoff time before the first resume (doubles on each attempt, capped at 30s)
maxPartialChars 12000 Maximum number of partial output characters referenced in the resume message

Working Mechanism and Interaction

The plugin intervenes during the agent/request-error phase:
* Condition check: If the request was cancelled by the user, the error is non-transient, there is no partial output, a tool call is in progress, or the resume budget has been exhausted, it delegates to the default handling logic.
* Resume flow: Collects the blocks from the current attempt (assistant/block events), sets a cancellable backoff, calls agent.steer(resume message) (a visible auto-resume line containing the partial output and continuation instruction), and finally returns { kind: 'retry' }.
* Interaction with dsh-llm-retry:
* On providers where retryPolicy is mode: always, the plugin takes precedence. Returning { kind: 'retry' } short-circuits the retry chain.
* On providers where mode: normal is used, the plugin is only consulted if the retry chain order places it before llm-retry.

Limitations and Notes

  1. Boundary sentence rephrasing: Resuming references the partial output into the context, and the continuation may rephrase the boundary sentence (mitigated by “do not repeat” instructions).
  2. Consecutive failure counting: If the endpoint fails again immediately after a resume, the attempt counts against the per-turn budget. Once the budget is exhausted, the default retry takes over.
  3. In-memory state reset: Restarting the host resets in-memory resume budgets/boundaries (stored logs remain readable).

Conclusion

For agents deployed on slow or unstable endpoints, dsh-resume-turn can significantly reduce compute waste caused by network instability. For more details, refer to: GitHub | Community Catalog.