Introduction¶
The core philosophy of DeepSeek Harness is “Everything is a plugin.” However, in real-world operations, restarting backend processes or reloading resources often creates risks such as session interruption, incomplete work draining, or context loss. The dsh-restart-resume plugin is designed to address these issues. Instead of relying on complex internal mechanisms, it uses an external supervisor to manage the process lifecycle and provides post-restart same-session resume capability.
Plugin Positioning¶
This is a secure self-restart and same-session resume plugin for DeepSeek Harness, maintained by Asteroid0449 and released under the MIT license. It focuses on solving problems that traditional restart methods often encounter, such as force-killing sessions, breaking context, or leaving data unpersisted.
Core Features¶
This plugin provides the following core capabilities:
- Work draining: By default, it waits for all active sessions, published sub-agents, and background jobs to drain, preventing work loss during restart.
- Supervised restart: An external supervisor restarts the backend and only responds to exit code 75, avoiding infinite restart loops caused by ordinary crashes.
- Same-session resume: After restart, it automatically attempts to restore the original session’s messages, maintaining context continuity.
- Automatic web page recovery: After the resume state is persisted, the web page recovers automatically.
- Status toolset: Provides the
dsh_restart,dsh_restart_status, anddsh_restart_canceltools for controlling the restart process and querying status.
Installation and Enabling¶
After downloading the corresponding release package (0.2.2) from Releases, install it into the Web profile using the DSH CLI:
dsh plugin --profile web add .\dsh-restart-resume-0.2.2.tgz
After installation, the plugin registers three tools into the current session.
Typical Usage¶
1. Initial Verification¶
After installation, you can query the self-restart status using an Agent tool to confirm that the plugin has been correctly registered.
2. Supervisor Contract Configuration¶
DSH must be started by a supervisor that understands exit code 75. Before relaunching the process, the supervisor needs to set the following environment variables:
DSH_RESTART_SUPERVISOR=1
DSH_BOOT_ID=<new identifier generated at each start>
DSH_RUNTIME_VERSION=<DSH version actually verified by the launcher>
3. Configure and Call¶
When calling the restart tool, you can configure resumeMode:
* continue: Continue the unfinished configuration, validation, and delivery from the original task (default).
* report-only: For standalone testing.
Example tool calls:
* dsh_restart: Schedule a supervised restart and, by default, write a persistent marker.
* dsh_restart_status: Query the current stage, countdown, blocking items, and bootId.
* dsh_restart_cancel: Cancel a restart request that has not yet exited.
Use Cases and Precautions¶
Applicable scenarios: Suitable for production environments where backend maintenance, version upgrades, or resource reloading must be performed without interrupting the Agent context.
Precautions:
1. Supervisor dependency: DSH must be started by a supervisor that understands exit code 75. The plugin cannot resurrect an already exited process on its own. Without a supervisor, the dsh_restart tool refuses to run.
2. Drain mechanism: By default, it waits for all active sessions, published sub-agents, and background jobs to drain. If new work appears during this period, it falls back to a waiting state.
3. Safety limits: Atomic markers, expiration, rate limiting, and idempotent message mechanisms are intended to avoid duplicate resumes and restart loops.
4. Inspect the source: Before installation, review the source code and license.
Summary¶
This plugin implements secure self-restart and same-session resume for DeepSeek Harness through a strict supervisor contract and atomic marker mechanism. It avoids the risks of blind restarts and is a practical tool for maintaining long-running agent systems.