Preface¶
When running Shell commands via an agent in DeepSeek Harness (DSH), the common permission tier is workspace-write: it only allows writes within the workspace and is safer than danger-full-access. On the Windows desktop edition (Electron-packaged), if the sandbox uses the ACL local runner, some environments will immediately fail under workspace-write with exit code 3221225794 (0xC0000142, STATUS_DLL_INIT_FAILED); pwsh, cmd, and powershell behave consistently. read-only and danger-full-access often remain usable. Below is an introduction to the positioning, mechanism, and installation method of the community bundle dsh-sandbox-console-fix. The repository has been archived by its maintainer, and the code is marked as AI-generated and not reviewed by humans; please read the source code yourself before installing.
What Is This¶
dsh-sandbox-console-fix is a Windows-oriented DSH bundle (dsh-plugin), maintained by GitHub user TJZF-4j97, and categorized as admin-security in the SkillHub directory. It targets DeepSeek Harness desktop 0.2.0-rc.2 (the README states Electron 44.0.0 / Node 24.18.1, verified on Windows 11 22H2 x64). By supplementing the ACL sandbox runner with a console or adjusting the process token’s Default DACL, it enables restricted Shell child processes under workspace-write to launch again. The README emphasizes that it does not loosen integrity labels, workspace capabilities, deny ACEs, or dsh-fs-sandbox file policies. On Linux / macOS, the patch lines carry platform guards, the composition remains unchanged, and the package is a lazy no-op.
The upstream problem was reported as a Discussion: https://github.com/deepseek-ai/deepseek-harness/discussions/9280. Since 2026-10-19, the repository has been archived: on hosts without elevated privileges (UAC enabled, Harness not launched “as administrator”), the bundled runner can already launch workspace-write restricted child processes, so the bundle does not need to be installed; on elevated-privilege hosts (UAC disabled or Harness launched as administrator), the failure may still occur, and the bundle remains available as a temporary workaround.
Symptoms and Root Cause (Summary)¶
In the desktop application, windowsAclRunnerInvocation() of dsh-sandbox-local is used when a built entry exists:
if (existsSync(builtEntry)) return [process.execPath, builtEntry];
At this point, process.execPath is DeepSeek Harness.exe (GUI subsystem, no console). When the runner spawns a restricted child process, it relies on the child inheriting the runner’s console; when there is no console to inherit, console-subsystem child processes attempt to create a console on their own during DLL initialization, which fails under the low-integrity, write-restricted token corresponding to workspace-write, yielding 0xC0000142.
The read-only path already merges Everyone and similar ACEs into the restricted token’s Default DACL in the shipped code; workspace-write merges the capability write SID instead of Everyone. On hosts where the token’s Default DACL lacks Everyone, the above console-creation path is more prone to triggering failures.
Core Functionality¶
The bundle uses cordis.patch.yml to disable the shipped sandbox line on Windows and insert its own provider (consistent with dsh-base’s platform-guard approach for bash-sandbox). A subclass overrides the runner invocation of LocalSandboxProvider, inserting a preload isomorphic to the DSH development path into argv:
shipped: [execPath, runner.js, …profile, --, target]
this: [execPath, --import <console-shim.mjs>, runner.js, …profile, --, target]
Before the runner derives the restricted token, console-shim.mjs merges a full-access Everyone ACE into the Default DACL of the runner process token (the same kind of ACE already merged by the shipped read-only path); if the merge cannot be applied, it falls back to AllocConsole() while saving/restoring the three standard handles and hiding the window. The README states that the restricted token’s low integrity, write-restricted SIDs, workspace/private temp directory grants, deny ACEs, Job, stdio, and fs policies are consistent with the shipped version; only the extra ACE in the Default DACL aligns with the read-only path.
Debugging: when the environment variable DSH_SANDBOX_CONSOLE_FIX_DEBUG is set to a file path, it records the path taken (in subsequent security self-checks, the diagnostic behavior was changed to primarily write to stderr to avoid arbitrary-path file writes — refer to the repository’s current README).
Relationship with @argszero/cordis-plugin-sandbox-grant-advisor (0.17.0): the advisor names and diagnoses native-init-class failures; this bundle is the fix implementation. A long-form discussion of the mechanism can be found in upstream Discussion #9238.
Installation and Activation¶
Install via the Plugin Manager following DSH conventions (the manager handles package installation and bundle selection); do not construct CLI installation commands yourself based on the plugin name.
- Open the Plugin Manager and install the bundle from
https://github.com/TJZF-4j97/dsh-sandbox-console-fixor the absolute path of that directory. - Restart the Harness.
- Set the session to
workspace-writeand run any Shell command to verify.
The package intentionally declares no dependencies: index.js loads LocalSandboxProvider from the running Harness bundle, and console-shim.mjs resolves koffi within the same installation tree. The README records the installation result as Packages: +1, with no additional downloads and no pending build script.
The unrecommended manual method (excerpt from the README): copy to the profile’s node_modules, add dsh-sandbox-console-fix to dsh.profile.bundles, and restart; the Plugin Manager snapshots/restores package.json and pnpm-lock.yaml if installation fails.
Uninstallation: remove the bundle name from the profile’s bundles list, delete the dependency, and restart; the README states that no system-level changes requiring cleanup by this bundle are left behind.
Typical Usage and Verification¶
When the session is workspace-write, the README provides the following verification steps:
$PSVersionTable.PSVersion # expect a normal version number, not 0xC0000142
Set-Content 'C:\Users\<you>\nope.txt' 'x' # expect [sandbox: file access denied under workspace-write mode]
Set-Content '.\ok.txt' 'x' # expect success
Remove-Item '.\ok.txt'
The README notes: within the restricted Shell, stdio piped between different programs may still be rejected by the sandbox (EPERM), regardless of whether this bundle is installed; bare & some.exe, PowerShell cmdlet piping, and file redirection remain usable.
The mechanism can also be reproduced without installing the bundle (requires preparing an extracted-runner path according to scripts/README.md):
node scripts/console-probe.cjs
node scripts/console-probe.cjs --host electron
node scripts/full-chain-repro.js --help
powershell -File scripts/escape-test.ps1 -Workspace <dir>
Applicable Scenarios and Notes¶
Who it suits
- Users on Windows 10/11 x64 with Harness desktop
0.2.0-rc.2who see Shell report0xC0000142underworkspace-write; especially the elevated-privilege hosts still emphasized in the README after the 2026-10-19 update. - Users who need an admin-security-class solution to restore Shell usability within the sandbox boundary, and who are willing to accept the risk of unreviewed third-party code.
No need to use
- Non-elevated Harness: when the shipped runner can already launch
workspace-writerestricted child processes, the maintainer has uninstalled and archived the repository on the reporting machine. - For a long-term solution, focus on the upstream structural fix for
setTokenDefaultDaclGrant(Discussion #9038 / #8775; #9280 and #9282 have been closed following updated conclusions).
Security and Trust
- The full text is marked: DeepSeek V4.1-flash AI-generated, with no human review, auditing, or approval. Read
index.js,console-shim.mjs, andcordis.patch.ymlyourself before installing. - The plugin runs under the permissions of the current DSH process; the README’s security self-check lists fixes for koffi/module resolution, diagnostic env, missing shim, and Default DACL verification, and explains the deployment-surface risk: when the profile is installed with
link:, if the plugin directory’s ACL is too permissive, local users may modify the executed patch and source code. - License: MIT (see the repository’s
LICENSE). Thepackage.jsonversion is 0.2.1,engines.nodeis>=20, andosis onlywin32.
Compatibility
- The subclass depends on the internal API of
@deepseek-ai/dsh-sandbox-local@0.2.0-rc.2; after a Harness upgrade, re-evaluation is required. The README requires: uninstall this bundle before verifying upstream upgrades, otherwise thedisabledpatch may silently discard upstream changes to the shippedsandboxline.
Conclusion¶
dsh-sandbox-console-fix documents a community workaround for 0xC0000142 under workspace-write with the Windows desktop ACL sandbox: using a preload shim to align the Default DACL or supplement the runner console, intended to restore restricted Shell without changing the file sandbox policy. The repository is archived, and non-elevated hosts typically do not need to install it; if you still encounter the same exit code, you may first compare elevation and Harness versions, then decide whether to install from the directory or GitHub and review the code yourself.
- SkillHub directory page: https://www.skillhub.cn/plugins/TJZF-4j97/dsh-sandbox-console-fix
- GitHub: https://github.com/TJZF-4j97/dsh-sandbox-console-fix