dsh-restart-task: Recovering Interrupted DSH Turns

Introduction

When running long tasks in DeepSeek Harness (DSH), three types of interruptions are common: model request failures, replies being truncated due to hitting the output token limit, and turns ending with error, aborted, or interrupted. The product’s built-in retry budget is often too tight, and failed rows or “retried” records remain in the conversation. If output truncation requires manual copy-pasting to continue, it is both cumbersome and prone to disrupting turn order. The community plugin dsh-restart-task (maintained by zchuxi) targets the Web profile. It employs a three-layer strategy: “Visible Retry + In-turn Continuation + Optional New Turn Follow-up,” and provides manual controls next to the input box. Its design principle is to minimize unnecessary traces in the conversation for recovered requests. The following section introduces what it is, what it does, and how to install and use it.

What is this

dsh-restart-task is a Web client plugin for DSH (platform: "web"), currently at npm package version 1.5.1 and licensed under MIT. It does not alter the semantics of the agent’s core loop but hooks policies at product seams such as agent/request-error and agent/turn-stopping. It also renders a circular “Continue / Resend” control and a settings card in the composer input area.

Applicable DSH runtimes (verified by the loader against peerDependencies["@deepseek-ai/dsh"]):

>=0.1.7-rc.1 <0.1.8-0 || >=0.1.8-rc.1 <0.2.0-0 || >=0.2.0-rc.1 <0.3.0-0

Node >= 24 is also required. If the version does not match, the bundle will be skipped at startup, with prompts indicating exemption methods like dsh plugin allow-version. Older DSH versions lack the settings and message format seams that this plugin relies on and should not be force-installed.

Core Functions

The plugin divides recovery capabilities into three layers, with items toggleable in the settings (default values are listed in the settings table later).

Layer 1: Widening the Visible Retry Budget

When a model request step fails and routes to a retry policy, the plugin prepends itself into the waterfall chain before the product’s built-in dsh-llm-retry, replacing the payload.retryPolicy in place. In normal mode, it scales up maxRetries (default 30) and the backoff base retryBaseDelayMs (default 2000 ms, capped at 60 s). retryableCodes still follow the provider’s resolution—deterministic errors like 401 or quota exhaustion will not turn into infinite loops. Retries are executed by the product’s executor, displaying a retry row with a live countdown in the conversation, which users can cancel.

The optional retryForever (default off) switches to the product’s always mode for infinite retries on any failure, suitable for unattended long tasks, though it lacks terminal error guards.

hideSettledRetry (default on) hides settled records like “Retried model request (N/M)” or “Model request retry canceled (N/M)” after retries conclude, while the ongoing countdown is retained.

Layer 2: In-turn Continuation (keep-alive)

When a step ends due to max-tokens and the step’s conclusion is indeed truncated, the plugin calls agent.steer(...) at the agent/turn-stopping boundary to run another step without starting a new turn, effectively continuing within the same turn. This is constrained by maxTurnContinues (default 5 per turn, 0 for unlimited). This does not apply to aborted or error paths.

The steer instruction is persisted as a user/message, displayed as a collapsed record by default (can be hidden via hideContinueRow), and will not appear as a user speech bubble.

Layer 3: Starting a New Turn to Continue

When a turn has ended in failure, manually or automatically (autoContinue, default off) sending a plugin-sourced message via agent.followup sets source.kind to dsh-restart-task. This starts a new turn, adding a collapsed/notification record to the conversation (hidden by default). Therefore, Layer 3 is disabled by default and is triggered on-demand via the input box control.

Manual Control and Send Key Takeover

When the previous turn ended with error / aborted / interrupted, or the output limit was reached before completion, or a lastAgentError exists, a circular control appears to the left of the send key: Continue resumes from the interruption; if only the last send failed (promptError), it displays Resend for the previous input. The control is not rendered while the agent is running, if there is nothing to do (blank state), or if the input box already contains a draft.

sendBecomesContinue (default on): When the input box is empty and there is “continuation available,” the send key—usually greyed out by the product—is taken over by the plugin to function as “Continue last task” (styling for aria-label etc. is handled by the plugin). As soon as the input box has content, control is immediately returned to avoid accidentally turning a send into a continue. The Enter key is not hijacked and still follows the product’s default shortcuts.

If more than one [data-composer-card] is detected on the page, the send key takeover yields entirely, though the circular control still functions within its slot scope.

Installation and Activation

The plugin runs with the current DSH process permissions; it is recommended to review the GitHub repository source code and the MIT license before installing. The community catalog SkillHub entry and GitHub have no official affiliation with DeepSeek/Founder Huan and are part of the community ecosystem.

Install from the repository first (no npm registry required) for the web profile:

dsh plugin --profile web add github:zchuxi/dsh-restart-task

You can also use HTTPS or a local link (path must not contain spaces):

dsh plugin --profile web add https://github.com/zchuxi/dsh-restart-task
# dsh plugin --profile web add link:<path-without-spaces>

After installation, a profile restart is required (for the host side lib/index.js changes to take effect); the browser side lib/client.js supports HMR, allowing hot updates to the page upon save.

To remove:

dsh plugin --profile web remove dsh-restart-task

The CLI will reject the desktop profile name; for the Electron side, please install via the plugin manager using the same git address.

Typical Usage

1. Long tasks dependent on network/API

Keep the defaults retryFailedRequests: true and maxRequestRetries: 30. When a request fails, observe the countdown retry row in the conversation and adjust retryBaseDelayMs in settings if necessary. Do not enable retryForever without understanding the risks.

2. Long answers truncated by max-tokens

Keep keepAliveOnMaxTokens: true. After truncation, a “Continue” option appears in the input box, or you can click the taken-over Send key directly with empty input; in-turn continuation will steer in the background, and continuation rows are hidden by default. If the number of continuations per turn is insufficient, increase maxTurnContinues in the settings.

3. Turn has failed, requiring an explicit new turn to continue

Keep autoContinue: false (default) and click the circular control or the Send key “Continue” when the input box is empty. If you wish to automatically follow up after a failure within delayMs (default 1500 ms), you can enable autoContinue and configure trigger conditions like onError, onInterrupted, onMaxTokens, etc. User-initiated stops will never trigger automatic continuation.

4. Adjusting Settings

Open Plugin Manager → Plugins page → dsh-restart-task (plugins.bundle.config slot). The main fields and their default values are as follows (for full descriptions, see README §8):

Field Default Brief Meaning
retryFailedRequests true Scale up visible retry budget on failure
maxRequestRetries 30 Max retry count (0 for no retry)
keepAliveOnMaxTokens true In-turn continuation on output limit
maxTurnContinues 5 Continuations per turn (0 for unlimited)
autoContinue false Auto start new turn after failure
sendBecomesContinue true Send key acts as continue when input is empty
hideContinueRow true Hide plugin collapsed rows
hideSettledRetry true Hide settled retry records

Writes are applied in real-time via configForms.get('restart-task') (fields are .volatile()), requiring no restart; if the browser client is newer than the host, the card will prompt that a DSH restart is required for some items to take effect.

Scenarios and Notes

Suitable for: Developers running agents under the Web profile who frequently encounter transient request errors, experience long output truncation, want to minimize manual copy-paste continuations, and wish to reduce the noise of “retried” records in the conversation.

Notes:

  1. The plugin reads the product DOM and rendering conventions (e.g., data-chat-flow-kind="model-retry"); if DSH major versions change UI structures, hiding rules or send key takeover may silently fail, though the circular control usually remains functional.
  2. Layer 3 inevitably adds a turn and a producer-sourced record; if “zero extra turns” is the goal, prioritize Layers 1 and 2 and manual continuation, and understand the overhead of autoContinue.
  3. In-turn continuation and continue instructions are visible to the model (Layers 2 and 3 each add an instruction-type message); Layer 1 retries are invisible to the model, yet still rebuild the same prefix to benefit KV cache.
  4. Installation implies trusting the plugin code to execute within the same DSH process; please audit the source code yourself in production environments.

Conclusion

dsh-restart-task consolidates “retry on failure, continuation on truncation, restarting a bad turn” into a configurable strategy set, while striving to clean up UI noise after recovery is complete. Directory and documentation:

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

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

Xiaoye