{"record":{"id":"206947c43d12428f","repo":"deepseek-ai/deepseek-harness","slug":"sandbox-escalation-to-mode-requires-approval","errorCode":null,"errorMessage":"sandbox escalation to \"${mode}\" requires approval, but no approval service is composed","messagePattern":"sandbox escalation to \"(.+?)\" requires approval, but no approval service is composed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/sandbox/sandbox/src/escalation.ts","lineNumber":166,"sourceCode":" * this call; throws the distinct verbatim text for every other path (a\n * non-widening request, a missing approval service, an agent-less execution,\n * a rejection, a cancellation, an unanswerable ask) — the tool registry turns\n * 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}\"`)","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/sandbox/sandbox/src/escalation.ts#L148-L184","documentation":"Error \"sandbox escalation to \"${mode}\" requires approval, but no approval service is composed\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/sandbox/sandbox/src/escalation.ts:166 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Compose an approval service into the context so escalations can be approved, or run in a wider mode from the start."],"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"}