{"record":{"id":"3740b3efbf388eb8","repo":"deepseek-ai/deepseek-harness","slug":"sandbox-escalation-to-mode-requires-approval-3740b3","errorCode":null,"errorMessage":"sandbox escalation to \"${mode}\" requires approval, but the call has no agent to route it through","messagePattern":"sandbox escalation to \"(.+?)\" requires approval, but the call has no agent to route it through","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/sandbox/sandbox/src/escalation.ts","lineNumber":169,"sourceCode":" * the throw into the call's isError result, and nothing has run. A\n * non-widening request never prompts a human.\n * @param request - the escalation to judge (see {@link EscalationRequest}).\n * @param approval - the approval ingredients the tool holds (see {@link EscalationApproval}).\n * @returns the granted mode, consumed by the one call that asked.\n */\nexport async function approveEscalation<A, C>(request: EscalationRequest, approval: EscalationApproval<A, C>): Promise<SandboxMode> {\n  const { requestedMode: mode, effectiveMode, justification, subject } = request\n  // Strict widening is an EXECUTION check against the call's effective mode —\n  // deliberately not a schema constraint (the enum is the closed target\n  // vocabulary; the effective mode is per-call truth).\n  if (!(WIDER_MODES[effectiveMode] ?? []).includes(mode as SandboxMode)) {\n    throw new Error(`sandbox escalation to \"${mode}\" is not strictly wider than this call's current \"${effectiveMode}\" mode`)\n  }\n  if (approval.approver === undefined) {\n    throw new Error(`sandbox escalation to \"${mode}\" requires approval, but no approval service is composed`)\n  }\n  if (approval.agent === undefined) {\n    throw new Error(`sandbox escalation to \"${mode}\" requires approval, but the call has no agent to route it through`)\n  }\n  // Self-contained for the audit trail: approval/asked stores this reason,\n  // and the target mode is part of the grant's identity.\n  const outcome = await approval.approver.request({\n    agent: approval.agent,\n    toolName: approval.toolName,\n    callId: approval.callId,\n    reason: `escalate sandbox to ${mode}: ${justification}`,\n    ...approval.signal ? { signal: approval.signal } : {},\n  })\n  switch (outcome) {\n    // The schema enum already pinned `mode` to the closed target vocabulary;\n    // the check above proved it is strictly wider.\n    case 'allowed-once': return mode as SandboxMode\n    case 'rejected': throw new Error(`the user rejected escalating this ${subject} to \"${mode}\"`)\n    case 'cancelled': throw new Error(`approval for escalating to \"${mode}\" was cancelled`)\n    case 'unavailable': throw new Error(`sandbox escalation to \"${mode}\" requires approval, but no approval channel is available`)\n    default: return assertNever(outcome, 'EscalationOutcome')","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/sandbox/sandbox/src/escalation.ts#L151-L187","documentation":"Error \"sandbox escalation to \"${mode}\" requires approval, but the call has no agent to route it through\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/sandbox/sandbox/src/escalation.ts:169 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Route the call through an agent that carries an approval channel, or start the session in the required mode."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}