Introduction¶
When using DeepSeek Harness (DSH) on Windows, the local ACL sandbox (@deepseek-ai/dsh-sandbox-local) creates a private temporary path for every “session + workspace” combination within the system temporary directory (in the format %TEMP%\dsh-XXXXXX). It caches this path and its corresponding capability-SID authorization throughout the provider’s lifecycle. If Storage Sense, Disk Cleanup, or manual deletion removes this directory, the upstream implementation does not check for its existence before reusing the cache. Consequently, the runner refuses to start because --temp points to a non-existent path. All subsequent commands within that session fail with SANDBOX_UNAVAILABLE, and retries are futile until DSH is restarted. Furthermore, the Agent often misidentifies this backend infrastructure failure as “sandbox corruption” and repeatedly requests danger-full-access privilege escalation.
Below is an introduction to the community plugin dsh-sandbox-temp-guard (maintainer: wsm000, category: admin-security). Until an official upstream fix is implemented, this plugin performs self-healing on the temp directory and appends troubleshooting guidance to errors that still slip through. For background discussion, see deepseek-ai/deepseek-harness Discussion #8550.
What is this?¶
dsh-sandbox-temp-guard is a Cordis plugin for DSH. Targeting the Windows ACL sandbox, it automatically recreates the directory and restores ACL authorizations if the OS cleans up the session’s private temp directory. Simultaneously, it annotates “backend unavailable” errors appearing in tool results to guide the model away from misusing sandbox_permissions for privilege escalation. The plugin has zero runtime dependencies (only Node built-in modules), is licensed under MIT, and is currently at package version 0.1.0. Community directory page: https://www.skillhub.cn/plugins/wsm000/dsh-sandbox-temp-guard; Source code and documentation: https://github.com/wsm000/dsh-sandbox-temp-guard.
Failure Chain and Plugin Responsibilities¶
Upstream temp creation is roughly equivalent to:
const tempDir = mkdtempSync(join(tmpdir(), 'dsh-')) // %TEMP%\dsh-XXXXXX
// + a revocable capability-SID ACL authorization
this.tempCapabilities.set(key, { dir: tempDir, writeSid, grant })
Subsequently, every confine() directly reuses the cached dir without checking if the directory still exists. The typical failure chain after the directory is cleared is:
- The runner receives
--temp <missing_path>, andrequireDirectoryfails →windows-acl-run: --temp is not an existing directory(exit 127). - The seam throws
SandboxUnavailableError(SANDBOX_UNAVAILABLE) following a fail-closed policy. - Every subsequent command in that session fails before execution, as the bad path remains in the cache.
The plugin provides two capabilities (as described in the README):
- Repair (Core): Before each tool execution (and configurably periodically), it locates the temp capabilities cached by active sandbox providers, performs
mkdirSyncfor missing directories, and re-appliesgrant.add(dir)(when a directory disappears, its ACEs disappear with it, so re-granting is mandatory). Ideally, the error never surfaces to the model. - Annotation (Hygiene): If
SANDBOX_UNAVAILABLE/windows-acl-run: --tempstill appears in tool results,tools/post-executeappends guidance: clarifying that this is a backend infrastructure failure rather than a policy denial; advising against usingsandbox_permissionsto escalate privileges; stating that the guard has already rebuilt the temp and asking to retry once as-is; if it still fails, the session must be restarted.
Access to the provider’s internal tempCapabilities uses generic discovery (traversing the object graph to find caches shaped like a Map with entries containing { dir, grant.add }); if upstream field names change, it degrades to a no-op rather than crashing. The field shape has been verified against dsh-sandbox-local in DSH 0.1.7-rc.2.
Installation and Activation¶
The installation mechanism utilizes the official dsh plugin command; the README notes it has been tested on DSH 0.1.7-rc.2. Choose one of the following:
# GitHub source (default path when not published to npm; marketplaces like DSH-Plugins-Marketplace
# index plugins via topic:dsh-plugin, and one-click installation also uses this spec)
npx @deepseek-ai/dsh plugin --profile desktop add github:wsm000/dsh-sandbox-temp-guard
# npm (if this plugin is published to npm; marketplaces prefer npm for published plugins, which is faster and more stable)
npx @deepseek-ai/dsh plugin --profile desktop add dsh-sandbox-temp-guard
# Local tarball (development/internal testing)
pnpm pack # produces dsh-sandbox-temp-guard-0.1.0.tgz
npx @deepseek-ai/dsh plugin --profile desktop remove dsh-sandbox-temp-guard # remove first if version changes
npx @deepseek-ai/dsh plugin --profile desktop add ./dsh-sandbox-temp-guard-0.1.0.tgz
For development, a file:/// source overlay is also available (zero runtime dependencies; tarball / npm / overlay all work):
# dev.patch.yml
- insert:
- id: sandbox-temp-guard
name: 'file:///C:/abs/path/to/dsh-sandbox-temp-guard/src/index.js'
config:
repairBeforeToolExecution: true
sweepIntervalMs: 60000
annotateBackendFailure: true
npx @deepseek-ai/dsh --profile dev --patch ./dev.patch.yml
In the DSH ecosystem, capabilities are often mounted as plugins. Community directories like SkillHub are independent sites with no official affiliation with DeepSeek or High-Flyer. Please review the repository source code and MIT license before installing. The plugin runs with the permissions of the current dsh process; as with any DSH plugin, you should ensure you trust the maintainer and the code behavior before enabling it.
Configuration¶
The plugin is injected via cordis.patch.yml. You can override the keys in the table below in your patch or plugin configuration:
| Key | Default | Description |
|---|---|---|
repairBeforeToolExecution |
true |
Scan and repair before every tool execution |
sweepIntervalMs |
60000 |
Periodic fallback scan interval; 0 disables it |
annotateBackendFailure |
true |
Append troubleshooting guidance to backend failure results |
The typical usage is to simply keep the defaults after installation: repair before execution, periodic scanning every minute, and failure result annotation are all enabled by default.
Verification¶
The repository provides offline tests that do not rely on a live DSH process:
node test/run-test.mjs # 17 offline assertions: discovery/rebuild/re-grant/fault tolerance/hook wiring/annotation
Use Cases and Limitations¶
Who it is for: Developers or teams using the DSH desktop profile on Windows long-term, with dsh-sandbox-local enabled, in environments where %TEMP% is periodically cleaned. This plugin is a transitional solution until upstream implements “check existence, recreate and re-grant if missing” before materializeAclGrant() reuses the cache. Once upstream is fixed, you can re-evaluate whether to remove this plugin.
Known Boundaries:
- It only handles the specific failure of the temp directory being cleaned; if the provider is completely unavailable (e.g., ACL backend crash), the annotation will suggest restarting the session, which is currently the only recovery method.
ctx.get('sandbox')is an optional access; it safely degrades if missing.
Conclusion¶
dsh-sandbox-temp-guard reduces session-level SANDBOX_UNAVAILABLE errors caused by the Windows sandbox temp being cleared by the system from “requires DSH restart” to “self-healable,” and reduces the Agent’s erroneous privilege escalation attempts during backend failures. Directory page: https://www.skillhub.cn/plugins/wsm000/dsh-sandbox-temp-guard; GitHub: https://github.com/wsm000/dsh-sandbox-temp-guard.