Replies: 1 comment
|
Nice write-up — the structural contradiction is real, and I traced it through the current source to sharpen the diagnosis. One nuance worth flagging (it changes the fix surface slightly). Three confirmed facts
The nuance your numbers implyThe quoted error So there are really two distinct failure shapes depending on what
Both are the same root bug (schema advertises a lever the composition can't honor), but they surface differently and the model-facing text is misleading in both. Why this is a real model-facing contradiction
Yet the schema still lists Fix directions (for anyone picking this up)
The — argszero |
Uh oh!
There was an error while loading. Please reload this page.
TL;DR
When
DSH_PERMISSION_MODE=danger-full-accessis set:@deepseek-ai/dsh-base/cordis.patch.ymlline 191 forces theapprovalservice topolicy: "never"(the JS expression(DSH_PERMISSION_MODE ?? 'workspace-write') === 'danger-full-access' ? 'never' : 'ask').ctx.fs.sandboxModeis"danger-full-access"(notundefined), soFsSandboxControllerin@deepseek-ai/dsh-tool-fs/lib/index.js:1111still treats the backend as confining and advertises the escalation fieldssandbox_permissionsandjustificationon thewrite/edit(and onbash/pwshfor the shell families).sandbox_permissionsset,@deepseek-ai/dsh-sandbox/lib/index.js:106(approveEscalation) hands the request to@deepseek-ai/dsh-user-approval/lib/index.js:175-179, which short-circuits oneffectivePolicy === "never"and returns"rejected"."the user rejected escalating this <command|operation> to \"<mode>\""— verbatim, hard-coded. The model interprets this as a real user refusal and on the next turn retries the same call, looping indefinitely.escalationHintMarkerin@deepseek-ai/dsh-sandbox/lib/index.js:75-77) tells the model "the approval prompt asks the user", which reinforces the loop.This is a structural contradiction: the file policy says "no confinement, anything goes", but the tool schema + approval pipeline still pretend the model is in a narrower mode and need to ask the user to widen it — except the user has explicitly forbidden being asked.
Reproduction
Set
DSH_PERMISSION_MODE=danger-full-access(or setpermission: { sandbox: danger-full-access, approval: never }).Start a session and ask the model to perform a write or a shell command.
If the model happens to emit
sandbox_permissions/justificationon the call (the schema still lists them as valid values; the model frequently does so in non-trivial contexts, including when the prior turn emitted a sandbox-denial marker from another session), the call fails with:The model retries with the same
sandbox_permissionsparameter; the rejection repeats.The same loop happens for
bash/pwsh(Windows) calls.Why this is a bug, not a UX nit
effectivePolicy === "never". The wording is misleading to both the model and the human reading the transcript.danger-full-access, the whole point of the mode is "no confinement, no questions asked". Yet the schema still advertises the escalation enum, and the runtime still attempts to escalate, just to fail in a misleading way.escalationHintMarkeris returned after every sandbox denial — including denials produced underdanger-full-access(where the only reason a denial could fire would be a bug infs-sandbox.checkedTargetorbash-sandboxreturning an EPERM that didn't actually require widening). Telling the model to "retry withsandbox_permissions" inpolicy=nevercontexts is a self-referential dead end.bash/pwsh(in@deepseek-ai/dsh-tool-bash/lib/index.js:129and@deepseek-ai/dsh-tool-pwsh/lib/index.js:144) actively tells the model to do exactly that on a denial.Affected versions
Reproducible on the current
deepseek-harnessdistribution as shipped; line numbers above are fromnode_modules/@deepseek-ai/dsh-base/cordis.patch.ymland@deepseek-ai/dsh-tool-fs,@deepseek-ai/dsh-tool-bash,@deepseek-ai/dsh-tool-pwsh,@deepseek-ai/dsh-sandbox,@deepseek-ai/dsh-user-approvalin a fresh install.Suggested fixes (any one would resolve it)
I think the cleanest fix is at the schema/advertisement boundary, not at the approval outcome:
Suppress escalation advertisement when the effective mode is already at the top of the
WIDER_MODESladder. InFsSandboxController(and the bash/pwsh equivalents), do not injectsandbox_permissions/justificationinto the tool schema whendefaultMode === "danger-full-access"— there is nothing wider to escalate to.ESCALATION_TARGETSis intentionally a fixed closed list at@deepseek-ai/dsh-sandbox/lib/index.js:41, but theescalationModesslice in each tool plugin currently still advertises all of them under any confining backend.Make
escalationHintMarkerpolicy-aware. WheneffectivePolicy === "never", return a neutral marker like[sandbox: file access denied under <mode> mode — approval prompts are disabled; no escalation available]instead of instructing the model to retry withsandbox_permissions.Make the
neveroutcome wording honest. Replace"the user rejected escalating this <X> to "<mode>"(inapproveEscalation,@deepseek-ai/dsh-sandbox/lib/index.js:106) with something like"approval prompts are disabled in this session; sandbox_permissions cannot widen to "<mode>" — retry without it". This stops the model from thinking a human actively refused.(Optional) Allow
dsh-base/cordis.patch.ymlto be configured so thatpolicy: neveris paired withsandbox: danger-full-access(which already is — see line 203-205), but skip advertising escalation fields under that combination. The shipping default already pairs them; the missing piece is the advertisement-side filter.Any single one of (1), (2), (3) is enough to break the loop. (1) is the most user-facing; (3) is the lowest-risk.
Workaround we currently use
A small dynamic Cordis plugin that registers a
tools/pre-executelistener and denies anywrite/edit/bash/pwshcall that carriessandbox_permissionsorjustification. It works, but it's per-session and per-deployment; the structural fix belongs upstream. I can share the plugin source if useful.Happy to open a PR for any of (1)-(3) — just let me know which direction the maintainers prefer.
References (paths in a fresh install)
node_modules/@deepseek-ai/dsh-base/cordis.patch.ymllines 169-205 — sandbox / approval wiring, and theneverpolicy hard-coded fordanger-full-access.node_modules/@deepseek-ai/dsh-fs-sandbox/lib/index.jslines 107-170 —SandboxedFileSystem,checkedTarget, the source ofctx.fs.sandboxMode.node_modules/@deepseek-ai/dsh-tool-fs/lib/index.jslines 1102-1188 —FsSandboxController,resolvePolicy,mapError.node_modules/@deepseek-ai/dsh-tool-fs/lib/index.jslines 617, 771 —sandbox_permissionsinjection intowrite/editschema whenescalationModes.length > 0.node_modules/@deepseek-ai/dsh-tool-bash/lib/index.jsline 129 — tool description string instructing the model to escalate.node_modules/@deepseek-ai/dsh-tool-pwsh/lib/index.jsline 144 — same for PowerShell.node_modules/@deepseek-ai/dsh-sandbox/lib/index.jslines 41, 75-77, 92-110 —ESCALATION_TARGETS,escalationHintMarker,approveEscalation.node_modules/@deepseek-ai/dsh-user-approval/lib/index.jslines 38-39, 155-179 —NEVER_SENTENCE,effectivePolicy, the hard-coded"rejected"short-circuit.All reactions