From a333cbad13082e030c4f6d6b16a5229bf9cfbc9a Mon Sep 17 00:00:00 2001 From: Minervaowl7 <127482476+Minervaowl7@users.noreply.github.com> Date: Wed, 18 Nov 2026 11:08:10 +0800 Subject: [PATCH] fix(runner): support DSH 0.2.2-rc.3 on Windows --- .../poteto-mode/references/model-catalog.md | 6 ++--- .../scripts/runner/providers/dsh.test.ts | 23 ++++++++++++++----- .../scripts/runner/providers/dsh.ts | 12 ++++++---- .../poteto-mode/scripts/runner/run.test.ts | 4 ++-- 4 files changed, 29 insertions(+), 16 deletions(-) diff --git a/plugins/pstack/skills/poteto-mode/references/model-catalog.md b/plugins/pstack/skills/poteto-mode/references/model-catalog.md index 5857bcaf..255f9d8c 100644 --- a/plugins/pstack/skills/poteto-mode/references/model-catalog.md +++ b/plugins/pstack/skills/poteto-mode/references/model-catalog.md @@ -70,7 +70,7 @@ Rolling aliases: | grok | external runner | external runner | explicit descriptor: external runner; `inherit-parent`, `auto`: native `spawn_subagent` | `read-only`, `isolated-write` | file | provider report | allowlist | Linux: Landlock and `bwrap`; macOS: any `/var/run/docker.sock` symlink points inside Grok's runtime-socket list | | devin | external runner | external runner | external runner | `read-only`, `isolated-write`, `isolated-write-full-access` | file | provider report | allowlist | - | | opencode | external runner | external runner | external runner | `read-only`, `isolated-write-full-access` | stdin | pinned argv | allowlist | - | -| dsh | external runner | external runner | external runner | `read-only`, `isolated-write` | stdin | pinned argv | allowlist | dsh 0.2.1-rc.2 exactly | +| dsh | external runner | external runner | external runner | `read-only`, `isolated-write` | stdin | pinned argv | allowlist | dsh 0.2.1-rc.2 on all hosts or 0.2.2-rc.3 on Windows | | amp | external runner | external runner | external runner | `read-only`, `isolated-write-full-access` | stdin | pinned argv | allowlist | - | | agy | external runner | external runner | external runner | `read-only`, `isolated-write-full-access` | stdin | pinned argv | allowlist | - | | cursor | external runner | external runner | external runner | `read-only`, `isolated-write-full-access` | stdin | pinned argv | allowlist | - | @@ -143,10 +143,10 @@ The runner refuses an access mode outside a provider's Access modes cell before ### dsh: DeepSeek Harness - Executable: `dsh`. -- Host prerequisites: dsh 0.2.1-rc.2 exactly. +- Host prerequisites: dsh 0.2.1-rc.2 on all hosts or 0.2.2-rc.3 on Windows. - State paths: `.provider/`, the lane's own `DSH_HOME`: the sessions (`sessions///`), projection cache (`storages/session_projcache/`), `profiles/headless/` and `.anonymous-user-id` that dsh writes on every run; The stored key `/.credentials.yaml`, which the lane reads in place and does not copy. - Child environment: only `PATH` `HOME` `USER` `LOGNAME` `SHELL` `TMPDIR` `LANG` `TERM` `COLORTERM` `TZ` `HTTP_PROXY` `HTTPS_PROXY` `NO_PROXY` `ALL_PROXY` `http_proxy` `https_proxy` `no_proxy` `all_proxy` `SSL_CERT_FILE` `SSL_CERT_DIR` `NODE_EXTRA_CA_CERTS` `DEEPSEEK_API_KEY`, and variables starting with `LC_`, `XDG_`; sets `DSH_HOME=.provider`. -- Measured with dsh 0.2.0-rc.2, a developer preview, and rechecked on 0.2.1-rc.2 for the patch rows, the stored-login preflight and the writer. The runner checks `dsh --version` before the preflight and refuses any version but 0.2.1-rc.2 as `unavailable-cli`/69. Recheck on an upgrade: the config row IDs the patch names (dsh silently ignores a patch row it does not have, so a renamed row would drop that part of the lockdown), the SIGTERM exit 0 with a partial `final`, the hardcoded `/tmp` writable root, the session-log upload being on by default, that dsh reads only the cwd's `.env` and skips a directory there, the transport retry row, and the `credentials` row's `path` config. dsh 0.2.1-rc.2 ships the `credentials` row disabled, so the patch enables it. +- Measured with dsh 0.2.0-rc.2, a developer preview, and rechecked on 0.2.1-rc.2 for the patch rows, the stored-login preflight and the writer. The runner checks `dsh --version` before the preflight and refuses versions outside the host-specific list as `unavailable-cli`/69. On Windows, dsh 0.2.2-rc.3 passed headless patch, stored-login, read-only and bounded-writer checks. Its headless profile has no `tool-subagent-list-agents` row. Recheck on an upgrade: the config row IDs the patch names (dsh silently ignores a patch row it does not have, so a renamed row would drop that part of the lockdown), the SIGTERM exit 0 with a partial `final`, the hardcoded `/tmp` writable root, the session-log upload being on by default, that dsh reads only the cwd's `.env` and skips a directory there, the transport retry row, and the `credentials` row's `path` config. dsh 0.2.1-rc.2 ships the `credentials` row disabled, so the patch enables it. - Model and effort are config, not flags. Each lane gets a run-owned `--patch` file at `.provider/patch.yml` (directory 0700, file 0600) that pins `agent-default-model` to provider `deepseek-official`, the lane's model and, unless the effort is `default`, its `reasoningEffort`. dsh offers efforts `off`, `low`, `high` and `max`, and fails `medium` locally. - Each lane runs with `DSH_HOME` set to its `.provider/` directory, and the allowlist drops every inherited `DSH_*` name. dsh creates the `headless` profile there on first use with no network or `pnpm` install (about 70 ms), so no user layer (`profiles/headless/cordis.patch.yml`) and no home `.env` from the operator's dsh home loads. Measured with `--dump-config`: a planted user layer that redirected `llm-deepseek.config.baseURL`, moved `fs-sandbox.config.cwd`, picked another `agent-default-model` provider and disabled `bash-sandbox` changed nothing, and the composed tree was the default rows plus the lane's patch. The patch's `credentials` row points the credential store at `/.credentials.yaml`, read in place. A key kept only in the operator's `/.env` no longer authenticates; store it or export `DEEPSEEK_API_KEY`. - The patch pins `sandbox-policy` to `read-only` for a read-only lane and `workspace-write` for an `isolated-write` lane, with the lane's cwd as the workspace root, and `approval` to `ask`, which overrides `DSH_PERMISSION_MODE`. The other sandbox rows keep dsh's defaults, including the bash tool's own timeout; the runner adds no deadline. Seatbelt enforces it on macOS for bash and the file tools. Headless has no approval channel, so an escalation request fails closed. Bash keeps network access, and the `read` tool is not confined to the cwd. diff --git a/plugins/pstack/skills/poteto-mode/scripts/runner/providers/dsh.test.ts b/plugins/pstack/skills/poteto-mode/scripts/runner/providers/dsh.test.ts index afbccfe3..bfb613d9 100644 --- a/plugins/pstack/skills/poteto-mode/scripts/runner/providers/dsh.test.ts +++ b/plugins/pstack/skills/poteto-mode/scripts/runner/providers/dsh.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "bun:test"; import { readFileSync } from "node:fs"; import { homedir } from "node:os"; -import { join } from "node:path"; +import { join, resolve } from "node:path"; import type { ModelRun } from "../registry/contract.ts"; import type { LaneRequest } from "../registry/index.ts"; import { modelFailureStatus } from "../types.ts"; @@ -27,7 +27,8 @@ describe("dsh launch", () => { it("pins read-only mode, the stored login in place, the model and effort, and turns off the lockdown rows", () => { const saved = process.env.DSH_HOME; - process.env.DSH_HOME = "/srv/dsh"; + const credentialHome = resolve("/srv/dsh"); + process.env.DSH_HOME = credentialHome; const patch = dsh.launch.sidecar!.config!.content(lane({ model: "deepseek-v4-pro", effort: "low", cwd: "/tmp/a dir: #x" })); if (saved === undefined) delete process.env.DSH_HOME; else process.env.DSH_HOME = saved; @@ -42,7 +43,7 @@ describe("dsh launch", () => { "- id: credentials", " disabled: false", " config:", - " path: \"/srv/dsh/.credentials.yaml\"", + ` path: ${JSON.stringify(join(credentialHome, ".credentials.yaml"))}`, "- id: agent-default-model", " config:", " provider: deepseek-official", @@ -63,8 +64,9 @@ describe("dsh launch", () => { it("reads the stored login from the parent's DSH_HOME, resolved as dsh resolves it, else ~/.dsh", () => { const saved = process.env.DSH_HOME; try { - process.env.DSH_HOME = "/srv/dsh home"; - expect(dsh.launch.sidecar!.config!.content(lane())).toContain("- id: credentials\n disabled: false\n config:\n path: \"/srv/dsh home/.credentials.yaml\"\n"); + const credentialHome = resolve("/srv/dsh home"); + process.env.DSH_HOME = credentialHome; + expect(dsh.launch.sidecar!.config!.content(lane())).toContain(`- id: credentials\n disabled: false\n config:\n path: ${JSON.stringify(join(credentialHome, ".credentials.yaml"))}\n`); for (const [value, home] of [ [undefined, join(homedir(), ".dsh")], [" \t", join(homedir(), ".dsh")], @@ -101,13 +103,22 @@ describe("dsh launch", () => { }); describe("dsh preflight", () => { + it("accepts rc.3 only on Windows and preserves the baseline version", () => { + const check = (stdout: string) => dsh.preflight.guard!.check({ exitCode: 0, stdout, stderr: "" }); + expect(check("0.2.1-rc.2\n")).toBeNull(); + const windowsRelease = check("0.2.2-rc.3\r\n"); + if (process.platform === "win32") expect(windowsRelease).toBeNull(); + else expect(windowsRelease).toMatchObject({ status: "unavailable-cli" }); + expect(check("0.2.2-rc.4")).toMatchObject({ status: "unavailable-cli" }); + }); + it("runs a positional task with the lane's patch, then the shipped preflight patch", () => { const argv = dsh.preflight.argv(lane(), testFacts(dsh).providerSidecar); expect(argv).toEqual([ "--profile", "headless", "--patch", "/tmp/receipt.json.provider/patch.yml", "--patch", join(import.meta.dir, "dsh-preflight.yml"), "--json", "preflight", ]); - expect(readFileSync(argv[5]!, "utf8")).toContain("baseURL: http://127.0.0.1:1\n- id: llm-retry\n disabled: true\n"); + expect(readFileSync(argv[5]!, "utf8").replace(/\r\n/g, "\n")).toContain("baseURL: http://127.0.0.1:1\n- id: llm-retry\n disabled: true\n"); }); it("passes TRANSPORT with fixed evidence that the key is not validated", () => { diff --git a/plugins/pstack/skills/poteto-mode/scripts/runner/providers/dsh.ts b/plugins/pstack/skills/poteto-mode/scripts/runner/providers/dsh.ts index 75ae228a..63fa504d 100644 --- a/plugins/pstack/skills/poteto-mode/scripts/runner/providers/dsh.ts +++ b/plugins/pstack/skills/poteto-mode/scripts/runner/providers/dsh.ts @@ -149,7 +149,9 @@ function parse(run: ModelRun): ParseResult { return { kind: "complete", text, metadata }; } -const VERSION = "0.2.1-rc.2"; +const BASELINE_VERSION = "0.2.1-rc.2"; +const WINDOWS_VERSION = "0.2.2-rc.3"; +const supportedVersions = process.platform === "win32" ? [BASELINE_VERSION, WINDOWS_VERSION] : [BASELINE_VERSION]; // dsh has no status command. The preflight turn's error code says only whether a key is stored or exported. function classify(run: ChildRun) { @@ -172,9 +174,9 @@ export const dsh = adapter({ // dsh ignores a patch row it does not have, so another version could drop the lockdown silently. guard: { argv: ["--version"], - check: (run) => run.stdout.trim() === VERSION ? null : { + check: (run) => supportedVersions.includes(run.stdout.trim()) ? null : { status: "unavailable-cli", - message: `dsh ${run.stdout.trim()} is not the measured ${VERSION}; the adapter must be re-measured before it runs this version`, + message: `dsh ${run.stdout.trim()} is outside the measured versions for ${process.platform} (${supportedVersions.join(", ")}); the adapter must be re-measured before it runs this version`, }, }, }, @@ -198,13 +200,13 @@ export const dsh = adapter({ }, docs: { name: "DeepSeek Harness", - hostPrerequisites: ["dsh 0.2.1-rc.2 exactly"], + hostPrerequisites: [`dsh ${BASELINE_VERSION} on all hosts or ${WINDOWS_VERSION} on Windows`], statePaths: [ "`.provider/`, the lane's own `DSH_HOME`: the sessions (`sessions///`), projection cache (`storages/session_projcache/`), `profiles/headless/` and `.anonymous-user-id` that dsh writes on every run", "The stored key `/.credentials.yaml`, which the lane reads in place and does not copy", ], notes: [ - "Measured with dsh 0.2.0-rc.2, a developer preview, and rechecked on 0.2.1-rc.2 for the patch rows, the stored-login preflight and the writer. The runner checks `dsh --version` before the preflight and refuses any version but 0.2.1-rc.2 as `unavailable-cli`/69. Recheck on an upgrade: the config row IDs the patch names (dsh silently ignores a patch row it does not have, so a renamed row would drop that part of the lockdown), the SIGTERM exit 0 with a partial `final`, the hardcoded `/tmp` writable root, the session-log upload being on by default, that dsh reads only the cwd's `.env` and skips a directory there, the transport retry row, and the `credentials` row's `path` config. dsh 0.2.1-rc.2 ships the `credentials` row disabled, so the patch enables it.", + "Measured with dsh 0.2.0-rc.2, a developer preview, and rechecked on 0.2.1-rc.2 for the patch rows, the stored-login preflight and the writer. The runner checks `dsh --version` before the preflight and refuses versions outside the host-specific list as `unavailable-cli`/69. On Windows, dsh 0.2.2-rc.3 passed headless patch, stored-login, read-only and bounded-writer checks. Its headless profile has no `tool-subagent-list-agents` row. Recheck on an upgrade: the config row IDs the patch names (dsh silently ignores a patch row it does not have, so a renamed row would drop that part of the lockdown), the SIGTERM exit 0 with a partial `final`, the hardcoded `/tmp` writable root, the session-log upload being on by default, that dsh reads only the cwd's `.env` and skips a directory there, the transport retry row, and the `credentials` row's `path` config. dsh 0.2.1-rc.2 ships the `credentials` row disabled, so the patch enables it.", "Model and effort are config, not flags. Each lane gets a run-owned `--patch` file at `.provider/patch.yml` (directory 0700, file 0600) that pins `agent-default-model` to provider `deepseek-official`, the lane's model and, unless the effort is `default`, its `reasoningEffort`. dsh offers efforts `off`, `low`, `high` and `max`, and fails `medium` locally.", "Each lane runs with `DSH_HOME` set to its `.provider/` directory, and the allowlist drops every inherited `DSH_*` name. dsh creates the `headless` profile there on first use with no network or `pnpm` install (about 70 ms), so no user layer (`profiles/headless/cordis.patch.yml`) and no home `.env` from the operator's dsh home loads. Measured with `--dump-config`: a planted user layer that redirected `llm-deepseek.config.baseURL`, moved `fs-sandbox.config.cwd`, picked another `agent-default-model` provider and disabled `bash-sandbox` changed nothing, and the composed tree was the default rows plus the lane's patch. The patch's `credentials` row points the credential store at `/.credentials.yaml`, read in place. A key kept only in the operator's `/.env` no longer authenticates; store it or export `DEEPSEEK_API_KEY`.", "The patch pins `sandbox-policy` to `read-only` for a read-only lane and `workspace-write` for an `isolated-write` lane, with the lane's cwd as the workspace root, and `approval` to `ask`, which overrides `DSH_PERMISSION_MODE`. The other sandbox rows keep dsh's defaults, including the bash tool's own timeout; the runner adds no deadline. Seatbelt enforces it on macOS for bash and the file tools. Headless has no approval channel, so an escalation request fails closed. Bash keeps network access, and the `read` tool is not confined to the cwd.", diff --git a/plugins/pstack/skills/poteto-mode/scripts/runner/run.test.ts b/plugins/pstack/skills/poteto-mode/scripts/runner/run.test.ts index 0cf0b7a1..fac1d04e 100644 --- a/plugins/pstack/skills/poteto-mode/scripts/runner/run.test.ts +++ b/plugins/pstack/skills/poteto-mode/scripts/runner/run.test.ts @@ -2494,7 +2494,7 @@ process.exit(130);`); expect(existsSync(interrupted.outputPath)).toBe(false); }); - it("refuses a dsh other than the measured version before the preflight", async () => { + it("refuses an unmeasured dsh version before the preflight", async () => { fakeDsh(TRANSPORT, OBSERVE, "0.3.0"); const input = dshOptions("dsh-version"); const result = await runLane(laneOf(input)); @@ -2503,7 +2503,7 @@ process.exit(130);`); status: "unavailable-cli", preflight: { status: "not-run" }, error: { - message: "dsh 0.3.0 is not the measured 0.2.1-rc.2; the adapter must be re-measured before it runs this version", + message: expect.stringContaining(`dsh 0.3.0 is outside the measured versions for ${process.platform}`), evidence: "0.3.0", }, });