Repository navigation
Same-mode sandbox_permissions requests hard-error and send agents into a retry loop #2914
novozhenets
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
一句话说明错误结果 / Summary
Same-mode
sandbox_permissionsrequests (requesting the mode the call already runs in) hard-error before executing, and the error text does not tell the model to drop the fields, so agents retry the same invalid call in a loop.复现、预期与验收 / Reproduction, expected, acceptance
复现步骤 / Repro steps:
dsh webon Linux with the confining stack (dsh-bash-sandbox+dsh-fs-sandbox), a session inworkspace-writemode.git status(bash) or write a file inside the workspace (fswrite).sandbox_permissions: "workspace-write"— occasionally with an emptyjustification— even though the session already runs inworkspace-write.实际结果 / Actual:
The call never executes; the model retries with
workspace-write, thendanger-full-access, with/without justification, in a loop.预期结果 / Expected: A
sandbox_permissionsrequest that is not strictly wider than the call's effective mode (same-mode or narrower) is a no-op — the call runs under the standing policy. Pairing validation (justificationrequired, non-empty) applies only to a genuine strictly-wider escalation ask.环境 / Environment: Linux,
dshpackages0.1.0-rc.x, sandboxed bash + fs executors, delegated-subagent (workflow) agents.验收条件 / Acceptance criteria:
sandbox_permissions(even with an emptyjustification) executes successfully under the standing mode.read-only→workspace-write) still prompts and grants.sandbox_permissions.Root cause
The effective sandbox mode is per-session/per-call (
session override ?? deployment default), so it cannot be baked into a static tool schema; the schemas advertise the full escalation vocabulary whenever a confining executor is mounted. Two problems compound:validateEscalationArgs) runs in the tool layers before the effective mode is known, so an emptyjustificationerrors even when the requested mode equals the standing mode (nothing is being widened).approveEscalationrejects a same-mode request as "not strictly wider" without actionable guidance, so the model keeps retrying.Proposed fix (patch ready)
Treat a same-mode request as a no-op and enforce pairing validation only for genuine wider escalations:
packages/sandbox/sandbox/src/escalation.ts—approveEscalation:mode === effectiveMode→ returneffectiveMode(no prompt, no pairing requirement); thenvalidateEscalationArgs; then the strictly-wider check with an actionable message (…retry this <subject> WITHOUT sandbox_permissions).packages/shell/tool-bash/src/index.ts,packages/shell/tool-pwsh/src/index.ts,packages/fs/tool-fs/src/sandbox.ts— stop validating the pairing before the effective mode is known (it now lives insideapproveEscalation).Prepared on branch
fix/escalation-same-mode-noop(commit7117ff8).Verification (local, real harness)
Applying the same change to the running packages:
git statuswith same-modesandbox_permissions→ executes successfully.writewith same-modesandbox_permissions+ emptyjustification→ executes successfully.read-only→workspace-write) → prompts and grants.The repo's vitest suite should be run in CI (full monorepo install was not performed here).
Suggested follow-up (model-facing, out of scope)
Consider suppressing the escalation fields for delegated subagents (approval pinned to
never), which can never escalate — advertising the fields invites the speculative misuse above. That requires per-scope tool schemas.All reactions