dsh-recovery-resume: Auto-resume interrupted tasks after DSH restart

Introduction

When running agents with DeepSeek Harness (dsh), tasks are frequently interrupted by process restarts: crashes, upgrades, or manual restarts can leave the current turn hanging mid-way. After a restart, the session remains intact, but the agent will not automatically resume work; it typically requires you to send another message to prompt action. If you are away from the terminal, downloads, pushes, or long-chain tool calls may remain suspended indefinitely.

The community plugin dsh-recovery-resume (Maintainer: flandre2233, Category: Workflow) automatically queues a recovery message after a DSH restart. It requires the agent to verify the actual progress before continuing, rather than assuming success or failure. The following section covers its positioning, trigger conditions, installation, and usage notes.

What is this?

dsh-recovery-resume is a host plugin for DSH: after a Harness restart, if an “unhandled interruption” is detected, it automatically allows the agent to continue from the appropriate location. The recovery message emphasizes checking exactly how far the task has progressed (e.g., if a restart occurs mid-download or mid-push, the agent cannot assume the operation completed or failed).

Repository: https://github.com/flandre2233/dsh-recovery-resume
Community Directory Page: https://www.skillhub.cn/plugins/flandre2233/dsh-recovery-resume
Current Package Version: 0.1.3 (MIT License).

Core Features

Conditions for Automatic Recovery

All of the following conditions must be met for automatic recovery to occur; otherwise, the plugin takes no action:

  1. The previous task ended in an accidental interruption (interruption, error, or truncation due to excessive output), rather than a normal completion.
  2. You have not sent a new message or started a new task since the interruption.
  3. The interruption occurred within 15 minutes (older interruptions are ignored; this duration is currently hardcoded and not configurable).
  4. The session has been reopened.

If the previous failure was due to a non-retryable issue (e.g., invalid API key, insufficient balance, conversation limit exceeded), the plugin will skip recovery. The criteria align with DSH’s official definition of “worth retrying.”

If there is an active goal in the session, the plugin will attempt to advance it, similar to the “Continue” button in the UI. Goals that you have manually paused will not be automatically resumed.

Preventing Repetitive Recovery Loops

To avoid a “Restart → Recovery → Crash → Recovery” loop, the plugin includes three built-in restrictions:

Safeguard Rule
1 Max 1 automatic recovery per DSH process startup cycle for the same session.
2 If 3 consecutive recoveries yield no progress, stop automatic recovery. Records are saved in $DSH_HOME/recovery-attempts.json (not cleared on restart).
3 Cooldown between recoveries: 10 minutes after the 1st, 20 minutes after the 2nd.

If the task makes confirmed progress after a recovery, the relevant counters are reset. When limits are reached, only a log is written; no other actions are performed.

Known Scope and Limitations

The README states: Verified only on DSH 0.1.6-alpha.1 and macOS 13 (Intel); the plugin relies on DSH internal interfaces, so it is recommended to re-run tests after upgrading DSH. The plugin does not determine if a task was already completed before the restart—if it was, the agent may perform an extra round of checks, which is expected behavior. Subagent sessions are not handled.

Installation and Activation

The plugin is loaded as a host plugin with DSH. Before installing, please review the repository source code and MIT license yourself. The plugin runs with the permissions of the current dsh process, similar to other DSH plugins you trust on your local machine.

Installation command (from the repository README):

dsh plugin --profile web add github:flandre2233/dsh-recovery-resume

After installation, restart DSH once for the plugin to take effect. No additional dependencies or compilation are required.

Verify if it is loaded:

dsh --profile web --dump-config | grep -A2 recovery-resume

How to Verify it is Working

Plugin logs appear in the terminal running dsh web; if DSH is opened via a desktop launcher, the common location is ~/.dsh/host.log (generated by the launcher; this file may not exist if DSH is run manually):

grep dsh-recovery-resume ~/.dsh/host.log

When recovery is triggered, the logs may look like:

dsh-recovery-resume: agent created id=session-… status=idle
dsh-recovery-resume: ★ Detected unhandled interruption (reason=interrupted turnSeq=8451 lastTool=bash)
dsh-recovery-resume: Recovery message queued for session-…
dsh-recovery-resume: Re-armed goal …

In most cases, having no recovery logs is normal. For example, “No recovery needed (no unhandled non-human interruption at tail)” indicates the last session ended normally or you have already continued the conversation; “Skipped … (this process has already recovered 1 time)” indicates the single-startup recovery limit is in effect; “Cooling down (… N seconds remaining)” indicates the cooldown rule is active. If there are absolutely no relevant logs, use --dump-config to check if the plugin is loaded.

Development and Testing

The repository provides logic tests that do not depend on the DSH runtime (Node >= 20):

npm test

You can also run it individually: node tests/logic.test.mjs (The README states there are approximately 85 test cases, runnable on Windows).

Use Cases and Notes

Suitable for workflows involving long-running unattended agent execution where Harness restarts have caused turns to hang. It is not suitable for expecting the plugin to infinitely retry under arbitrary errors—permanent errors are intentionally skipped.

The DeepSeek Harness ecosystem emphasizes “everything is a plugin”; community directories like SkillHub are independent sites and have no official affiliation with DeepSeek or High-Flyer. Before installing third-party plugins, please read the source code and license, and understand how they integrate with DSH via host permissions.

Conclusion

dsh-recovery-resume solves the problem where the session persists after a DSH restart but the task stalls: it automatically recovers under strict conditions and multiple safeguards, while forcing the agent to verify the real status first. For details, you can view the README and design notes in docs/notes.md via the directory page or GitHub.

  • Directory Page: https://www.skillhub.cn/plugins/flandre2233/dsh-recovery-resume
  • GitHub: https://github.com/flandre2233/dsh-recovery-resume
羽毛球分组比赛记分
小程序二维码

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

Xiaoye