DeepSeek Harness Plugin: dsh-auto-resume

Overview

When running agents on the desktop app, sessions are frequently interrupted due to process kills, network instability, app crashes, rate limiting, and similar issues. If a session was stopped intentionally by the user, we naturally want it to stay stopped. But when the interruption is accidental, it’s usually desirable for the session to pick up where it left off.

DeepSeek Harness (DSH) is built on the philosophy of “everything is a plugin.” dsh-auto-resume is a client-side plugin designed around this principle: it runs only when the desktop app starts up, scans sessions across all projects, and automatically resumes any session that was stopped due to an abnormal cause (as opposed to being intentionally stopped by the user).

Plugin Positioning

  • Name: dsh-auto-resume (maintainer: goodjin)
  • Category: Client
  • Core value: After the desktop app starts, automatically resume sessions that were interrupted abnormally (crash / exit / network and rate-limit errors with periodic retry). Sessions stopped by the user are never resumed.

Core Capabilities

1. Identifying Abnormal Sessions

The plugin scans sessions across all projects and identifies the following abnormal terminations:

  • Interruptions left behind by a killed process, power loss, or crash (the interrupted wrap-up synthesized by the host during crash recovery);
  • In-run errors: network disconnection, timeout (error);
  • Interruption caused by the desktop app exiting (aborted/disposed);
  • Queued messages that were never delivered because the turn never reopened.

Sessions stopped by the user are never auto-resumed (the host marks them with an aborted/user wrap-up, and this plugin honors that semantic). A single manual stop serves as a permanent exemption for that session—no additional toggle required.

2. Behavior and Limitations

  • Scans only once at desktop startup (default delay: 8 seconds), dispatching a resume message to only one session at a time (default interval: 2 seconds).
  • Only processes abnormal sessions whose last activity was within the past 24 hours.
  • The resume message template can be customized via configuration.

3. Periodic Retry for Transient Failures

Failures like network disconnection, timeout, or 429 rate limiting—the kind that “might resolve on their own after a while” (identified by summary text and stable error codes such as QUOTA_EXCEEDED, fetch failed, ECONNRESET)—are registered in a retry ledger:

  • Registered immediately upon occurrence: The plugin listens to the host’s session event broadcast. When a turn ends with one of these failures, it’s logged to the ledger on the spot—no need to wait for the next restart. The startup scan also performs a sweep (catching failures that occurred while the app wasn’t running).
  • Every retryIntervalMs (default: 10 minutes), the plugin checks the status by inspecting the log tail:
  • If the turn after re-dispatch completed normally (resume succeeded) or was manually stopped by the user → remove from ledger;
  • Still failing at the same point → record a consecutive failure and dispatch another resume message.
  • If consecutive maxRetries (default: 3) cycles still fail → give up and mark as no-retry (persisted to disk; the startup scan won’t touch it after restart either; the marker is cleared once the session exits the failure state, and normal registration resumes).
  • The retries section in the ledger route shows: ledger path, sessions still in the retry cycle, sessions that were abandoned, and the action from the most recent cycle (including overloadDone: sessions that were concluded by convention due to temporary service unavailability).

4. “Service Temporarily Unavailable” Failures: Wait 5 Minutes, Retry Once

When the server explicitly states “I can’t handle this right now, please retry later,” rapid or within-10-minute re-dispatch will only result in continued rejections. This category covers (all are transient failures and will be registered):

  • 529 overloaded_error, with a message like “The current service cluster is under high load, please retry later” (observed with MiniMax);
  • 500 and other 5xx, api_error, Chinese messages like “network error / network anomaly,” please retry later (observed with GLM: GLM request failed (500): …[network error…please retry later.]);
  • English equivalents: service unavailable / bad gateway / upstream error, etc.

It gets its own dedicated cadence:

  • Wait overloadRetryDelayMs (default: 5 minutes), then re-dispatch once, then stop and remove from the ledger—no further cycles. The success or failure of this attempt does not trigger additional queued retries (increase overloadMaxRetries if you want more attempts).
  • If the session successfully resumes on its own or is stopped by the user before the deadline, it’s removed from the ledger and no further dispatch occurs.
  • The wait is calculated per each session’s own deadline (persisted in the ledger; survives restarts).
  • 429 rate limiting, 401 authentication failures, and pure timeouts do not fall into this category. They follow the standard retryIntervalMs (default: 10 min) × maxRetries (default: 3) cadence. The two are independent of each other.

5. Parent Session Awaiting a Child Session

A parent session has often already finished outputting its response block and is now waiting for a child session to proactively send a reply (the host’s guidance to the model is “end the turn when only waiting for subagent results remains”). In this state, the parent session’s turn ends normally, and session-level detection would classify it as “completed normally” and skip it—but the child session’s work is stuck mid-way with no one to pick it up.

The plugin additionally recognizes this pattern: parent session ended normally AND its subagent directory contains child sessions AND at least one of those child sessions also has an abnormal termination (the interrupted / disposed synthesized by the host during cold read) → classified as “awaiting child” (ledger reason: awaiting-child). The parent session is woken up, and those child sessions are restored as well.

If a child session has already reported its result to the parent, it does not count as “still waiting”: a settlement notification (source tag subagent-settled) in the parent’s log indicates the parent is already aware of the result. Waking it up at this point would be redundant. The notification counts even if it’s still sitting in the inbox unclaimed—the result has been delivered.

What needs resuming is the child session itself, not the parent. The parent is left undisturbed and won’t redo work it already completed. Restoring a child session goes through the canonical path the host provides for “humans”: child sessions are managed by the subagent router; generic session dispatch will be rejected (owned by subagent routing). The proper path is to attach the parent session online (without any message), then queue a human-written prompt into the child session’s inbox (if the child session isn’t in memory, it’s cold-restored from its log). Once the child session finishes, the host delivers the settlement notification to the online parent, which is woken up when idle to wrap things up.

Attaching must go through sessionController.agents.resolveAgent (the same entry point used before prompt() dispatches a message): cold restore will re-attach the agentPreset according to the session record, ensuring the full combination (preset/skills/local tools) is assembled. Never fall back to bare ctx.agents.resume—it carries no combination whatsoever, leaving the attached parent with only base tools (platform tools + MCP connectors). Worse, it propagates to the entire session tree via the child session’s cold-restore “inherit combination from parent” mechanism, and subsequent GUI conversations won’t self-heal either. When the canonical path is unavailable, the plugin will abandon child session restoration (logging the reason) rather than perform a bare attach.

Child sessions that can’t be restored (external backends: Codex / Claude Code / ACP, etc., which have no local session logs) are not forced; the parent session re-delegates instead.

6. Observability

Scan results are logged in a single line, plus a read-only status route GET /auto-resume/health (returns the full ledger from the most recent startup: who was scanned, who was matched, who was resumed, skip-reason distribution, and whether the subagent service is present, which child sessions were restored).

Installation & Activation

Installation command (quoted from the README):

dsh plugin --profile <your profile> add github:goodjin/dsh-auto-resume

Or install the npm package (equivalent effect, also no build step required):

dsh plugin --profile <your profile> add @goodjin2/dsh-auto-resume

Manual installation (desktop profile):

  1. Add "@goodjin2/dsh-auto-resume": "link:<path to this repo>" to package.json dependencies;
  2. Add @goodjin2/dsh-auto-resume to dsh.profile.bundles (bundle ID = package name);
  3. Run pnpm install;
  4. Merge the insert section from this package’s cordis.patch.yml into the profile’s cordis.patch.yml;
  5. Restart the desktop app to take effect.

After installation, the plugin is enabled by default (enabled defaults to true) and will begin scanning 8 seconds after the desktop app starts.

Configuration

Common configuration keys for the mount-line config:

Key Default Description
enabled true Master switch; when false, the plugin loads but does not scan.
lookbackHours 24 Only resume sessions whose last activity falls within this window.
startupDelayMs 8000 Delay (ms) before scanning begins after startup.
staggerMs 2000 Interval between consecutive dispatches.
includeError true Whether to resume sessions that ended with error.
includeDisposed true Whether to resume sessions interrupted by desktop app exit (aborted/disposed).
maxObservations 30 Maximum number of recent candidates to fully read per startup (cost guardrail).
resumeChildren true Whether to restore interrupted child sessions (via the parent’s subagent router canonical path).
maxChildObservations 20 Maximum number of child session logs to read during the detection phase.
maxChildResumes 10 Maximum number of child sessions to restore per startup.
retryIntervalMs 600000 Retry interval for standard transient failure sessions; 0 = no periodic retry.
maxRetries 3 Consecutive failure threshold before giving up and marking as no-retry for standard transient failures.
overloadRetryDelayMs 300000 Wait duration before retrying “service temporarily unavailable” type failures (5xx / cluster overload / network errors, etc.) (default 5 min); 0 = no wait.
overloadMaxRetries 1 Maximum re-dispatch attempts for “service temporarily unavailable” type failures (default 1: wait 5 min then retry once).
messageTemplate See config.ts in source Resume message template with {reason}/{time} placeholders.
childMessageTemplate See config.ts in source Resume message template for child sessions with {parent}/{reason}/{time} placeholders.

The two include* toggles only govern the two categories that “should be resumed but are blocked by the toggle”:

  • Manually stopped sessions (aborted/user) are unaffected by any toggle—a single manual stop is a permanent exemption; they will never be auto-resumed;
  • When includeDisposed=false, sessions interrupted by desktop app exit are not resumed; the ledger records the skip reason as disposed-excluded (similarly, includeError=false records error-excluded). This makes it immediately clear the skip was caused by a toggle, not a “normal completion.”

Use Cases & Cautions

Scenarios where dsh-auto-resume is suitable:

  • The desktop app is prone to interruptions due to network instability, server-side rate limiting, temporary service unavailability, etc.;
  • Session hierarchies are deep, involving parent and child sessions;
  • You want abnormal sessions to be automatically restored after a desktop app restart without manually re-running them.

Cautions:

  • The plugin runs with the permissions of the current DSH process. Review the source code and license (MIT) before installing;
  • Child session restoration depends on the host-provided sessionController.agents.resolveAgent canonical path. If this path is unavailable, restoration will be abandoned;
  • The plugin’s read-only status route GET /auto-resume/health can be used to monitor ledger state and restoration results.

Closing

dsh-auto-resume is a lightweight client-side plugin that, through periodic retry and fine-grained failure classification, helps the DSH desktop app automatically restore abnormal sessions after a restart—particularly with dedicated handling for the “awaiting child session” pattern. If you frequently encounter unexpected session interruptions, consider installing and configuring it, and monitor restoration effectiveness via the /auto-resume/health route.

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

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

Xiaoye