Bug: same-mode sandbox_permissions is rejected as an invalid escalation #5588
Replies: 2 comments
|
Reproduced and confirmed — the bug sits exactly at Why it throws on a same-mode request: const { requestedMode: mode, effectiveMode, justification, subject } = request
if (!(WIDER_MODES[effectiveMode] ?? []).includes(mode as SandboxMode)) {
throw new Error(`sandbox escalation to "${mode}" is not strictly wider than this call's current "${effectiveMode}" mode`)
}
export const WIDER_MODES: Record<string, readonly SandboxMode[]> = {
'read-only': ['workspace-write', 'danger-full-access'],
'workspace-write': ['danger-full-access'],
}So when Your minimal fix is the right shape and matches the design intent in the JSDoc ("a non-widening request never prompts a human" — and a truly non-widening request here is the equal one, which should simply proceed under the standing policy): if (mode === effectiveMode) return effectiveModeI'd add one guard so the equality branch doesn't silently accept a malformed same-mode ask: keep Regarding the regression tests you listed, they map cleanly onto the existing spec at
One design note worth flagging for whoever merges this: the same-mode grant should be advertisement-independent. The schema |
|
@argszero — agree on the diagnosis. Implemented it, with one refinement to keep if (mode === effectiveMode && (ESCALATION_TARGETS as readonly string[]).includes(mode)) {
return effectiveMode
}So
|
Uh oh!
There was an error while loading. Please reload this page.
Summary
A tool invocation can fail before execution when its adapter serializes
sandbox_permissionsequal to the call's effective sandbox mode.This makes normal Bash and filesystem calls fail in a session already running at
danger-full-access.Expected behavior
When
requestedMode === effectiveMode, treat the request as use of the standing policy and execute without an approval prompt. Actual upward escalations must continue to require approval; narrower or invalid modes must remain rejected.Minimal fix
In
approveEscalation, before the strict-widening check:Then retain the existing strict-widening check.
Regression tests requested
sandbox_permissionsexecutes under the standing policy.sandbox_permissions === effectiveModeexecutes without approval.read-only -> workspace-writeandworkspace-write -> danger-full-accessstill request approval.Impact
This can block normal plugin development and routine tool calls. It can also prevent a running DSH process from repairing itself because the same validation rejects the Bash or file-edit operation needed to apply a fix.
All reactions