mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-10 16:51:13 +00:00
fix(exec): resolve remote approval regressions (#58792)
* fix(exec): restore remote approval policy defaults * fix(exec): handle headless cron approval conflicts * fix(exec): make allow-always durable * fix(exec): persist exact-command shell trust * fix(doctor): match host exec fallback * fix(exec): preserve blocked and inline approval state * Doctor: surface allow-always ask bypass * Doctor: match effective exec policy * Exec: match node durable command text * Exec: tighten durable approval security * Exec: restore owner approver fallback * Config: refresh Slack approval metadata --------- Co-authored-by: scoootscooob <zhentongfan@gmail.com>
This commit is contained in:
@@ -65,6 +65,10 @@ export type ExecApprovalUnavailableReason =
|
||||
| "initiating-platform-disabled"
|
||||
| "initiating-platform-unsupported";
|
||||
|
||||
function isHeadlessExecTrigger(trigger?: string): boolean {
|
||||
return trigger === "cron";
|
||||
}
|
||||
|
||||
export type RegisteredExecApprovalRequestContext = {
|
||||
approvalId: string;
|
||||
approvalSlug: string;
|
||||
@@ -340,6 +344,38 @@ export function createExecApprovalDecisionState(params: {
|
||||
};
|
||||
}
|
||||
|
||||
export function shouldResolveExecApprovalUnavailableInline(params: {
|
||||
trigger?: string;
|
||||
unavailableReason: ExecApprovalUnavailableReason | null;
|
||||
preResolvedDecision: string | null | undefined;
|
||||
}): boolean {
|
||||
return (
|
||||
isHeadlessExecTrigger(params.trigger) &&
|
||||
params.unavailableReason === "no-approval-route" &&
|
||||
params.preResolvedDecision === null
|
||||
);
|
||||
}
|
||||
|
||||
export function buildHeadlessExecApprovalDeniedMessage(params: {
|
||||
trigger?: string;
|
||||
host: "gateway" | "node";
|
||||
security: ExecSecurity;
|
||||
ask: ExecAsk;
|
||||
askFallback: ResolvedExecApprovals["agent"]["askFallback"];
|
||||
}): string {
|
||||
const runLabel = params.trigger === "cron" ? "Cron runs" : "Headless runs";
|
||||
return [
|
||||
`exec denied: ${runLabel} cannot wait for interactive exec approval.`,
|
||||
`Effective host exec policy: security=${params.security} ask=${params.ask} askFallback=${params.askFallback}`,
|
||||
"Stricter values from tools.exec and ~/.openclaw/exec-approvals.json both apply.",
|
||||
"Fix one of these:",
|
||||
'- align both files to security="full" and ask="off" for trusted local automation',
|
||||
"- keep allowlist mode and add an explicit allowlist entry for this command",
|
||||
"- enable Web UI, terminal UI, or chat exec approvals and rerun interactively",
|
||||
'Tip: run "openclaw doctor" and "openclaw approvals get --gateway" to inspect the effective policy.',
|
||||
].join("\n");
|
||||
}
|
||||
|
||||
export async function sendExecApprovalFollowupResult(
|
||||
target: ExecApprovalFollowupTarget,
|
||||
resultText: string,
|
||||
|
||||
Reference in New Issue
Block a user