Introduction¶
When running agents in DSH, the common issue is not “the model answered incorrectly” but rather turns ending at places where they shouldn’t: API interruptions due to rate limiting or gateway errors, tool failures being treated as normal completions by the framework, or models outputting only thoughts without any actual response before stopping. Once session logs are corrupted, history often becomes entirely inaccessible. Simply switching models or manually retrying rarely leaves explainable reasons at every exception point.
Below is an introduction to the community plugin dsh-harden (maintainer thissensen). It provides protection at key points in the agent lifecycle, with the goal of ensuring stops have clear reasons rather than silently becoming “normal completions”. The plugin is categorized as workflow, with the npm package name dsh-harden, version 0.0.2 in current documentation, license MIT, and requires host DSH >= 0.1.7-rc.1.
What Is This¶
dsh-harden self-positions as “a guardian layer for DSH runtime”. It does not replace DSH core, but instead adds a fallback and repair layer through Cordis patches and settings page capabilities for scenarios such as API failures, tool failures, empty turns, context bloat, parallel sub-agent notifications, and session persistence exceptions.
Catalog page: SkillHub — thissensen/dsh-harden
Source code and documentation: GitHub — thissensen/dsh-harden
Core Features¶
The capabilities listed in the documentation are as follows, corresponding to the settings page cards and README usage descriptions.
API and Turn Continuation¶
- Network request interruption continuation (toggleable in settings): After official retries are exhausted, additional retries are performed according to configuration; can set network retry count (0–99, 0 means no fallback) and failure characteristics triggering retries (error codes
SERVER/RATE_LIMIT/TIMEOUT/TRANSPORTand HTTP status codes502/429; if left blank, no failures will be retried). - Tool call failure continuation (requires enabling, and must configure failure message prefix): When tool call failures are swallowed and the framework still treats the turn as normally completed, injects a prompt to make the model re-initiate. When the prefix is empty by default, this rule does not take effect; you need to paste the fixed beginning of the platform’s warning, matching the entire beginning segment, case-sensitive. Example:
⚠ Could not execute tool; when the prefix starts with<, paired occurrences of this marker in the body also count as failures. - Turn completion without body content (toggleable): When the last step only has thoughts without any response or tool calls, pulls back to run another step, addressing issues like “outputting only thoughts and directly interrupting”.
Context and Sub-Agents¶
- Automatic context compression (toggleable): After the session exceeds the trigger threshold (plugin default
200K, also supports formats like1M,100000), earlier history is condensed into summaries, with the interface using the platform’s built-in “context has been compressed” prompt. Compression scope has three levels: compress all / main agent only / sub-agents only (default compress all); can customize summary instructions. - Sub-agent notification aggregation (toggleable, disabled by default): When multiple sub-agents finish in parallel, intermediate notifications are held back first and merged into one delivery after all complete, avoiding waking up the main agent individually.
- Automatic repair of sub-agent session anomalies (always enabled, no toggle): When the platform is about to write non-compliant retry events, corrects them before persistence, reducing sessions that cannot be opened; during correction, there’s a light-colored hint at the end of the turn, with traces written to the session log, still visible after restart.
Tools and Session Repair¶
- Background task tools (toggleable): When enabled, the model can use
job_backgroundto start background commands and manage them withjob_list/job_output/job_kill; integrates with pwsh to mitigate limitations when only Git Bash is available for creating background tasks exceeding approximately 120 seconds. When disabled, related tools disappear from the model side. - Repair corrupted sessions: The settings page provides a scan button to scan all session logs and repair known corruption patterns, making “stored session is corrupt” type history re-loadable.
The settings entry is in the “DSH Optimization” section of the DSH interface, with eight cards total; screenshots may differ slightly from old version text, defer to the actual interface.
Installation and Activation¶
Installation only places the package; it must also be registered to the profile for DSH to load it at startup.
Install Package (Choose One of Three)¶
From npm:
npm install dsh-harden
From GitHub Releases: After downloading dsh-harden-<version>.tgz:
dsh plugin --profile web add file:<absolute path to the tgz file>
From source build: Must complete the build before the first DSH startup (client shell is constrained by startup snapshots). See the repository README for steps: install dependencies, node scripts/link-deps.mjs, pnpm build (tsc host + vite client).
Register to Profile¶
Web client (link path example, use corresponding link or version range when installing from npm):
dsh plugin --profile web add link:<absolute path to the cloned directory>
Desktop client: Edit two places in ~/.dsh/profiles/desktop/package.json—add "dsh-harden": "link:<directory>/dsh-harden" to dependencies (use version range when installing from npm); add "dsh-harden" to the dsh.profile.bundles array. Run pnpm install in that directory and restart the desktop client.
Typical Usage and Configuration Order¶
- Install according to the paths above and complete profile registration, restart DSH.
- Open DSH Optimization settings, at least enable as needed: network continuation, turn without body, context compression, background tasks, etc.
- Must fill in “failure message prefix” (if tool failure continuation is needed): If not filled, the rule for swallowed tool failures will not take effect. Paste the fixed beginning of the platform warning you see in the interface.
- Network continuation: Set retry count and failure characteristics; leaving failure characteristics blank means no additional retries for any failures.
- Context compression: Confirm threshold and compression scope (main agent / sub-agents / all), modify summary instructions if necessary.
- If history cannot be opened, perform scan and repair in the Repair Corrupted Sessions card.
The plugin runs with the current DSH process permissions; it is recommended to read the repository source code and MIT license before installation to confirm compliance with your environment and requirements. SkillHub is a community plugin catalog, with no official affiliation with DeepSeek / High-Flyer.
Conclusion¶
dsh-harden converges “mysterious stops” such as API interruptions, swallowed tool failures, empty thought turns, corrupted logs, long contexts, and sub-agent notifications into configurable, scannable guardian logic. After installation, remember to register the profile and complete key items like failure message prefix in the settings page.
- Catalog page: https://www.skillhub.cn/plugins/thissensen/dsh-harden
- GitHub: https://github.com/thissensen/dsh-harden