The design philosophy of DeepSeek Harness (DSH) is “everything is a plugin.” When using third-party models (such as GPT or Qwen-thinking), models often do not adapt well to certain internal mechanisms of DSH, leading to compaction failures, sandbox permission escalation errors, or abnormal tool calls. dsh-model-compat-guard is a third-party model compatibility guard plugin that resolves these frequent compatibility issues by intercepting and repairing specific types of requests.
Core Features¶
This plugin intervenes in the request stream through DSH’s plugin mechanism, mainly fixing the following four issues:
-
Compaction truncation in thinking models
The root cause is that the defaultmaxTokenslimit indsh-compaction-basicis 8192, while the thinking tokens of thinking models count toward the same output budget and can easily exhaust the limit. The plugin intercepts requests wherepurpose === "compaction", raisesmaxTokensto 32768 (configurable), and lowers the reasoning effort to the cheapest level supported by the model, avoiding truncation errors. -
Sandbox permission escalation request failures
When the sandbox executor is mounted, the tool schema globally advertises thesandbox_permissionsfield, while the actual mode is resolved per session. When a model requests escalation in thedanger-full-accessmode, it can fail because no broader mode can be found andjustificationmust be non-empty, resulting in fail-closed behavior. The plugin parsesctx.sandboxPolicy, strips escalation requests that are guaranteed to fail (sandbox_permissions+justification), and executes according to the current mode. -
Missing tool descriptions
Tools such asbashandrun_codemarkdescriptionas required, but models often omit it. The plugin intercepts thetools/executepipeline and checks the schema before strict validation: if the requireddescriptionis missing, it automatically synthesizes one (for example, forbashit uses the first line of the command, and forrun_codeit uses the first line of valid code). -
Frequent Code Mode run_code errors
The TypeScript programs generated by models may have incomplete syntax (such as unpaired quotes) or misuse bash results (treating them as strings rather than structured objects). The plugin detects Code Mode requests (when only therun_codetool is present), appends a discipline block at the end of the system prompt, and standardizes how tool return values are read.
Installation and Activation¶
Installing the plugin requires specifying the pinned version v0.4.0. After installation, restart the DSH process for the configuration to take effect.
dsh plugin --profile web add github:782042369/dsh-model-compat-guard#v0.4.0
Uninstall command:
dsh plugin --profile web remove dsh-model-compat-guard
Configuration and Typical Usage¶
The plugin can be configured in ~/.dsh/compat-guard.json. The default configuration covers common scenarios and can be used with zero configuration.
Configuration file example (~/.dsh/compat-guard.json):
{
"compactionMaxTokens": 32768,
"compactionEffort": "auto",
"compactionPurposes": ["compaction"],
"fillDescription": true,
"descriptionTools": ["bash", "run_code", "subagent", "subagent_fork", "workflow"],
"codeDiscipline": "off",
"stripEscalation": "redundant",
"unknownPolicy": "preserve",
"modelInfoTtlMs": 300000,
"modelInfoTimeoutMs": 5000,
"logFixes": true
}
Configuration options:
* compactionMaxTokens: token limit for compaction requests, default 32768.
* compactionEffort: reasoning effort level; "auto" selects the cheapest level, while "keep" leaves it unchanged.
* stripEscalation: escalation stripping policy; "redundant" (default, strips only guaranteed-to-fail requests), "always" (also strips legitimate escalation requests), "off".
* codeDiscipline: Code Mode discipline; "off" (recommended to use the native ~/.dsh/AGENTS.md), "auto", "always".
* fillDescription: whether to automatically fill in missing tool descriptions, default true.
Test command:
node test/smoke.mjs
Applicable Scenarios and Notes¶
This plugin is suitable for scenarios where thinking models such as GPT and Qwen-thinking are used in DSH, or where Code Mode errors are encountered.
- Runtime environment: Only Node.js >= 20.0.0 is supported.
- Permissions: The plugin runs with the permissions of the current DSH process; it is recommended to review the GitHub source code before installation.
- License: MIT license.
Summary¶
dsh-model-compat-guard resolves compatibility issues for third-party models in the DSH environment by intercepting and repairing the request stream. It can run without complex configuration and is suitable for developers who need to reliably use thinking models or Code Mode.