The Windows platform layer previously kept fs path-rule confinement (sandbox-policy + fs-sandbox) next to the unconfined pwsh shell. Windows has no OS sandbox runner (landlock/bwrap/seatbelt are POSIX-only), so the shell can bypass fs-only path rules with one command — the policy was theater. The layer now removes the whole sandbox stack (sandbox, sandbox-policy, fs-sandbox disabled), mounts the unconfined dsh-fs-local, and degrades to danger-full-access: permission/ui-permission leave the roster and the approval policy is 'never'. dsh-base declares dsh-fs-local so the profile module fallback links it for cold starts; base.spec.ts pins the shipped Windows roster (disables, inserts, approval policy); the Agent Note records the rejected fs-only confinement alternative.
6.2 KiB
Agent Note: Windows defaults to pwsh
Status: implemented
English | 中文
Problem
The harness's shipped execution profile is bash-first on every platform. Windows hosts must install a bash shim (WSL or Git-Bash) or fall back to the POSIX-only dsh-bash-local behavior (hardcoded bash -c argv, process-group semantics); the model-facing bash tool teaches the bash dialect. The Windows-native foundation shipped in the pwsh executor and tool decision — a PowerShell implementation of the ctx.bash seam and a parity pwsh tool — but shipped compositions still mounted the bash stack on Windows, so a Windows host without a shim could not run the shipped shell.
Decision
Windows hosts booting a shipped profile (dsh web, dsh --profile headless, one-shot tasks) get the PowerShell stack by default; POSIX hosts are unchanged.
- The platform layer is a data file, not a roster rewrite.
@deepseek-ai/dsh-baseshipswindows.cordis.patch.ymlalongside its universalcordis.patch.yml: it disablesbash-sandbox/tool-bash(the POSIX-only executor and its dialect tool) and insertspwsh-local/tool-pwsh. Windows has no OS sandbox runner (landlock/bwrap/seatbelt are POSIX-only), so the layer drops the sandbox stack entirely —sandbox,sandbox-policy, andfs-sandboxare disabled and the unconfineddsh-fs-localprovidesctx.fs— and degrades to danger-full-access:permission/ui-permissionleave the roster (dsh-permission requires a confining executor — presets bundle a sandbox mode the unconfined executor cannot honor; see its constructor guard — and the client knob would advertise a boundary that does not exist), and theapprovalpolicy isnever. Keeping fs-only path rules would be theater: the unconfined shell can bypass them with one command, so the honest Windows posture is full access rather than a boundary only the fs tools pretend to enforce. - The launcher injects the layer by platform.
apps/cli/src/windows-shell.tsresolves it from the base bundle layer'spackageDirbetween the bundle layers and the user layers onwin32hosts, in every composition path (boot, config-only HMR recomposition, config dumps). Overriding the shipped default is a composition decision: a Windows host that prefers the bash stack — or confinement — re-enables the bash rows through its profile or homecordis.patch.yml. Custom profiles without the base bundle are skipped (they own their shell stack); a base bundle that ships no Windows shell patch fails loud. - Module resolution is restored for cold starts. The profiles-rework CLI dropped the pwsh packages from
apps/cli's dependency closure, sohealProfilesModuleFallbacknever linked them into$DSH_HOME/profiles/node_modulesand a fresh Windows host could not resolve the inserted rows.apps/clianddsh-basere-declaredsh-pwsh-local/dsh-tool-pwsh, anddsh-basealso declaresdsh-fs-local; the base bundle lists every row plugin as a dependency by house style.
The pwsh GUI rendering stage (stage 2 of the original roadmap) shipped earlier with the pwsh UI presentation matches bash decision; the pwsh tool bash parity decision ships the tool's surface. Nothing in this decision changes POSIX behavior.
Alternatives considered
Default Windows to pwsh inside dsh-bash-local (one executor, dialect switch). Rejected for the same reason the executor decision rejected a mode switch: the executor's identity is the shell it spawns, and platform-gated composition is a deployment choice, not an executor config.
Ship the platform layer from apps/cli code instead of a bundle data file. Rejected: the patch belongs next to the rows it replaces, in the bundle that owns them, so the shipped roster stays visible as composition data and dumps carry its provenance; the launcher contributes only the win32 gate.
Keep permission/ui-permission on Windows. Rejected: dsh-permission hard-requires ctx.bash.sandboxMode and fails loud at load over an unconfined executor; making it tolerate an unconfined shell would advertise presets the shell cannot honor.
Keep fs path-rule confinement on Windows (sandbox-policy + fs-sandbox without OS runners). Rejected: the shell is the model's primary tool and unconfined on Windows, so fs-only path rules are trivially bypassable and would overstate the boundary; the honest posture is full degradation to danger-full-access.
Ship a DSH_WINDOWS_SHELL environment escape hatch. Rejected: decisive behavior changes belong in composition config, which already overrides the platform layer row by id; a second override channel would split the single source of truth for roster decisions.
Consequences
- A Windows host running a shipped
dshsurface getspwshas its shell tool and PowerShell as thectx.bashexecutor without configuration;bashis absent from the model-visible roster there (its tool row is disabled). - Windows has no sandbox at all: the fs tools run unconfined (
dsh-fs-local), the approval policy isnever, and the permission switcher is gone. The model-visible posture is honest full access rather than a boundary the shell can bypass. - POSIX hosts are unchanged: the platform layer never applies, and the bash stack remains the universal
cordis.patch.ymlrows. - Windows hosts that prefer the bash stack (e.g. with WSL/Git-Bash on PATH) override the shipped default through their profile or home
cordis.patch.yml— composition config is the one override channel.
Verification
- Unit:
apps/cli/tests/windows-shell.spec.tspins the win32 default, the custom-profile skip, and the missing-patch failure, with the platform injected;packages/bundle/base/tests/base.spec.tspins the shipped Windows roster (disables, inserts, and theneverapproval policy). - Keyless: a win32
dsh --profile <name> --dump-configshows the pwsh rows withwindows.cordis.patch.ymlprovenance and the bash rows disabled; the POSIX dump (CI Linux) is unchanged. - The real-composition smoke boots the web profile on win32 with the pwsh stack mounted (the exact roster this note describes).