Preface

In the plugin ecosystem of DeepSeek Harness (DSH), a single plugin failure can prevent dsh web from starting, or cause long-running tasks to stall due to network disconnection/flow blockage. dsh-doctor is a monitoring plugin that runs in a separate Node process to handle startup failures and session stalls caused by plugins. It does not depend on dsh-daemon; it intervenes through its own mechanism and attempts to repair the environment.

Core Features

dsh-doctor provides four core capabilities:
1. Web Startup Recovery: Automatically attempts to recover failed Web service startups caused by plugins within a 60-second budget.
2. Tool Error Capture: Captures all tool invocation errors through tools/* event hooks.
3. Session Monitoring: Monitors all active sessions, detects stalls, and attempts recovery.
4. Safe Mode Patch: Supports disabling faulty plugins or enabling safe mode by writing patch files, without directly modifying the original configuration files.

Installation and Enablement

Installation method: Install it through the official directory or the GitHub repository.
Official directory link: https://www.skillhub.cn/plugins/d86e/dsh-doctor
GitHub repository link: https://github.com/d86e/dsh-doctor

How It Works

Web Startup Recovery (60-second budget)

The monitor probes the health of dsh web every 30 seconds. After three consecutive failures, it enters the fault handling process, hard-limiting the total duration of a single fault recovery attempt to no more than 60 seconds.

Simple path (about 10 seconds): Reads logs, identifies the faulty plugin via regex matching, disables the plugin line in the sibling file of cordis.patch.yml, then restarts dsh web.

Complex path (≤60 seconds): If a single fault cannot be identified, it writes a “safe mode patch” covering all plugins (allowing only dsh-core to run). After restart, it enters safe mode until safe mode is removed.

Tool Error Capture

The plugin subscribes to tools/execute and tools/post-execute events. When a tool call fails, the error is classified and logged without blocking the main process.

Session Monitoring

The monitor maintains a session state machine. When it detects that a turn is in the running state and no new events occur beyond the threshold duration, it sends a “continue” message via agent.followup to wake the session. It also provides dsh_doctor_watch_cancel for manual cancellation.

Usage Examples

Check the list of sessions being monitored:

dsh_doctor_watch_list()

Diagnose failed plugins:

dsh_doctor_diagnose()

Notes

  1. CLI doctor feature: The dsh doctor command is planned for version v0.3.0. The current version only supports diagnosis by tool calls inside a running dsh web process.
  2. Independence: The plugin does not call or depend on dsh-daemon; coexistence with it will not conflict.
  3. Configuration file safety: Safe mode patches and repair operations are written to cordis.patch.yml (without modifying the original file); you can inspect or roll them back at any time.
  4. Permissions: The plugin runs with the permissions of the current DSH process.

Conclusion

dsh-doctor provides DSH users with an independent fault recovery layer, suitable for scenarios requiring high availability and automatic fault tolerance.