dsh-unstuck: Automatic Recovery for DeepSeek Harness Session Disconnection and Stalled States

Preface

When running long tasks in DeepSeek Harness (DSH), a common experience is that the interface appears frozen: there are no errors, and it isn’t waiting for your approval, yet the agent has stopped executing. You are forced to manually send a “Continue,” allowing the task to resume. Another scenario involves turns being logged as completed in the logs; however, the model actually intended to invoke a tool, but the compatibility layer output the call markup as plain text. The loop mistakenly assumes “this turn is finished” and silently idles. There are also “zombie” states where a request has been sent, but no stream fragments are received for a long time.

The desktop client includes a “Continue” button that can handle some abnormal endings, but it relies heavily on manual intervention and is often helpless against “false completions”—it treats completed as finished work and refuses to resume. The following introduces the community plugin dsh-unstuck (Maintainer: Chlyz621, SkillHub Category: Workflow). It performs structured detection based on session logs within the process, automatically resending continuation messages or aborting improper advancements at appropriate times. It requires no judge model and makes no additional network requests.

What is this?

dsh-unstuck is a supervisor plugin attached to DSH: when a conversation turn ends abnormally, is marked as completed but is actually stuck, or when a model request experiences a long stream stall, it automatically unstucks according to policy. When you are blocked on approval or Q&A, it only logs and notifies; it does not answer for you. Detection is entirely based on session log structure and does not invoke a judge model.

Core Capabilities

The plugin README narrows its responsibilities to a few verifiable phenomena and actions, while clearly defining boundaries of “non-interference.”

Abnormally Ended Turns

When the turn/end reason is error, aborted (not initiated by you), max-tokens, or interrupted, the plugin automatically sends a continuation message (default text: “Continue”) after a short delay. The source is marked as dsh-unstuck to avoid being treated as user input.

Swallowed Tool Calls (False Completion)

Some OpenAI-compatible relays treat DeepSeek’s native ||DSML|| tool markers as plain text output. The log contains only reasoning + text with no tool_calls, yet the turn is recorded as completed. The plugin identifies this via structural rules, such as reasoning and text being byte-for-byte identical, text being empty while reasoning is not, or broken call markers remaining at the end. It then sends a targeted continuation prompt (continueOnSwallowed, enabled by default) to urge the model to re-initiate the tool call. This is the primary enhancement over DSH’s built-in “Continue” button.

Request Stalling (stall)

If a model request has been sent but no stream fragments arrive within stallMs (default 180000 ms), it is judged as stalled: the current turn is cancelled (kind: 'hook', keeping the inbox), and a “Continue” is sent after waiting for stallResumeMs.

Unanswered Questions (Optional)

If confirmation-seeking phrasing or second-person questions appear at the end of the body, but operations like file modification begin in the same turn, the agent might start working before you have answered. pauseOnUnansweredQuestion defaults to mutate: once a write/delete/modify file tool is detected after a question, the turn is aborted, and the floor is returned to you. The log records question-paused, and it will not automatically send “Continue” for you.

Approval and Q&A

When waiting for your approval or answers: it only logs and can configure timeout notifications (notifyBlocked); it absolutely never answers on your behalf.

Explicitly Not Handled

The plugin skips and records reasons like continue-skipped in unstuck.jsonl for the following scenarios: you manually stopped, the turn is genuinely complete, there are already messages from you in the inbox, consecutive automatic continuations exceed continueMax (default 3), or non-retryable errors in skipCodes (such as authentication, quota, or context errors).

There is a backoff for automatic continuations within the same session: extra waits of 1.5s / 5s / 15s before the 1st, 2nd, and 3rd attempts. If you manually send a message, the continuation budget resets to zero.

Installation and Activation

Installation commands follow the README. To install from GitHub (replace tauri with your profile name):

dsh plugin --profile tauri add github:Chlyz621/dsh-unstuck

After installation, fully exit DeepSeek Harness (including the system tray) and reopen it to load the plugin.

For local code modifications or offline installation, run the following in the repository root directory (the README also provides parameter explanations for install.ps1 / uninstall.ps1):

cd <repo-root-directory>
pwsh -File .\install.ps1

Configuration file path: <DSH_HOME>/unstuck/config.json. An example can be copied from unstuck.config.example.json in the repository. Priority is: Built-in Defaults < Profile’s cordis.patch.yml < config.json.

Runtime logs: <DSH_HOME>/unstuck/unstuck.jsonl.

Typical Usage: Confirming Plugin Loaded

After startup, a boot event should appear in the logs. View recent records:

Get-Content "$env:USERPROFILE\.dsh\unstuck\unstuck.jsonl" -Tail 20

Common event types include: continue-sent (continuation sent), turn-swallowed (false completion detected), stall-detected (stall), continue-budget-exhausted (budget used up), question-paused (interrupted due to unanswered question), etc. For finer debug lines, set verbose: true in config.json.

When tuning parameters, only change the keys you care about, such as continueMax, stallMs, pauseOnUnansweredQuestion (off / mutate / any), continueOnUserAbort (never / silent / always). Restart dsh after making changes.

If you wish to fundamentally reduce the probability of “DSML being treated as plain text,” the README suggests optional directions including: switching to models with native OpenAI-style tool calls, reducing reasoningEffort, or using DeepSeek official endpoints—the plugin itself only acts as a fallback and does not replace relay layer fixes.

Use Cases and Notes

Who it is for: DSH users running agents unattended for long periods, using OpenAI-compatible relays, or frequently encountering “silent stops / false completions / stream stalls,” who wish to automate continuation decisions and record them in auditable logs.

Permissions & Security: The plugin runs with the same privileges as the current dsh process. It can read sessions, send continuation messages, and cancel turns under specific policies. Please read the source code and the MIT license before installing; the community directory SkillHub has no official affiliation with DeepSeek / High-Flyer and is not an official app store.

Environment: package.json requires Node >=22.19.0, with a peer dependency on @deepseek-ai/cordis ^4.0.1. autoRetry (model request layer retry) is disabled by default to avoid stacking with dsh’s own retries; enable it in the configuration if needed.

Conclusion

dsh-unstuck codifies “when to resume and when to return the floor” into configurable structural rules and persists them to unstuck.jsonl, serving as a workflow enhancement within the DSH “everything is a plugin” ecosystem. For installation or changelogs, refer to the GitHub README; you can also jump to the repository and Issues from the SkillHub directory page.

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

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

Xiaoye