Replies: 2 comments 4 replies
|
看了一下当前 master 的 sandbox / bash 实现,这个报错的原因应该不是
export const WIDER_MODES = {
'read-only': ['workspace-write', 'danger-full-access'],
'workspace-write': ['danger-full-access'],
}也就是说 而 {
"sandbox_permissions": "danger-full-access",
"justification": "..."
}就会在真正执行操作之前进入 因此当前权限已经是 sandbox escalation to "danger-full-access" is not strictly wider than this call's current "danger-full-access" mode传 所以这里可以先试一下:调用 bash / edit / write 时完全不要传 例如已经是 {
"command": "pnpm lint",
"description": "Run project lint"
}而不是再附带 另外当前 建议看一下失败调用的 raw tool arguments:
如果方便的话可以贴一个失败的 bash 或 write 的完整 tool call 参数,这样应该能进一步确定是哪一层出了问题。 |
|
修复方案: 修复 Bash/Edit/Write 在完全权限下无法执行问题当会话已经是 {
"sandbox_permissions": "danger-full-access",
"justification": "..."
}会被错误当成一次新的权限升级,并报错: 修复方法修改: 在 if (mode === effectiveMode || (WIDER_MODES[mode] ?? []).includes(effectiveMode)) {
return effectiveMode
}完整位置如下: export async function approveEscalation<A, C>(
request: EscalationRequest,
approval: EscalationApproval<A, C>,
): Promise<SandboxMode> {
const { requestedMode: mode, effectiveMode, justification, subject } = request
if (mode === effectiveMode || (WIDER_MODES[mode] ?? []).includes(effectiveMode)) {
return effectiveMode
}
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`,
)
}
// 原有审批逻辑保持不变
}修复后的行为
建议同步修改提示在 Bash、PowerShell 和文件工具的 schema 描述中加入: 涉及文件: 验证运行: pnpm exec vitest run \
packages/sandbox/sandbox/tests/escalation.spec.ts \
packages/shell/tool-bash/tests/tools.spec.ts \
packages/shell/tool-pwsh/tests/tools.spec.ts \
packages/fs/tool-fs/tests/tools.spec.ts预期结果: 修改后需要重启正在运行的 Harness Web/Host 服务,使新的 bundle 生效。 |
Uh oh!
There was an error while loading. Please reload this page.
Harness 当前存在权限校验问题:在会话已经处于 danger-full-access、且 Approval prompts 为 Disabled 的情况下,调用 bash、edit 或 write 工具仍会重复触发 sandbox escalation。传入 danger-full-access 会报 sandbox escalation to "danger-full-access" is not strictly wider than this call's current "danger-full-access" mode,传入 workspace-write 也会报 sandbox escalation to "workspace-write" is not strictly wider than this call's current "danger-full-access" mode。因此读取文件正常,但无法修改或创建文件,也无法运行 lint、测试和构建。预期是在当前权限已经满足请求时直接执行工具,或跳过重复的权限升级校验。初步判断是 Harness Runtime 的会话权限状态与 bash/edit/write 工具的 sandbox 权限校验逻辑不一致。
All reactions