mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-09 00:01:17 +00:00
fix: stabilize exec approval approver routing
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
import path from "node:path";
|
||||
import type { AgentToolResult } from "@mariozechner/pi-agent-core";
|
||||
import { Type } from "@sinclair/typebox";
|
||||
import { type ExecHost, type ExecTarget } from "../infra/exec-approvals.js";
|
||||
import {
|
||||
DEFAULT_EXEC_APPROVAL_TIMEOUT_MS,
|
||||
type ExecHost,
|
||||
type ExecTarget,
|
||||
} from "../infra/exec-approvals.js";
|
||||
import { requestHeartbeatNow } from "../infra/heartbeat-wake.js";
|
||||
import { isDangerousHostEnvVarName } from "../infra/host-env-security.js";
|
||||
import { findPathKey, mergePathPrepend } from "../infra/path-prepend.js";
|
||||
@@ -111,8 +115,8 @@ export const DEFAULT_PATH =
|
||||
process.env.PATH ?? "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin";
|
||||
export const DEFAULT_NOTIFY_TAIL_CHARS = 400;
|
||||
const DEFAULT_NOTIFY_SNIPPET_CHARS = 180;
|
||||
export const DEFAULT_APPROVAL_TIMEOUT_MS = 120_000;
|
||||
export const DEFAULT_APPROVAL_REQUEST_TIMEOUT_MS = 130_000;
|
||||
export const DEFAULT_APPROVAL_TIMEOUT_MS = DEFAULT_EXEC_APPROVAL_TIMEOUT_MS;
|
||||
export const DEFAULT_APPROVAL_REQUEST_TIMEOUT_MS = DEFAULT_APPROVAL_TIMEOUT_MS + 10_000;
|
||||
const DEFAULT_APPROVAL_RUNNING_NOTICE_MS = 10_000;
|
||||
const APPROVAL_SLUG_LENGTH = 8;
|
||||
|
||||
@@ -254,11 +258,7 @@ export function resolveExecTarget(params: {
|
||||
}
|
||||
const selectedTarget = requestedTarget ?? configuredTarget;
|
||||
const effectiveHost =
|
||||
selectedTarget === "auto"
|
||||
? params.sandboxAvailable
|
||||
? "sandbox"
|
||||
: "gateway"
|
||||
: selectedTarget;
|
||||
selectedTarget === "auto" ? (params.sandboxAvailable ? "sandbox" : "gateway") : selectedTarget;
|
||||
return {
|
||||
configuredTarget,
|
||||
requestedTarget,
|
||||
|
||||
Reference in New Issue
Block a user