Skip to content

Commit 72f1579

Browse files
stainluclaude
andcommitted
fix(permissions): add tool name aliases + approval bridge in always_ask
Two fixes for the always_ask flow: 1. Tool name alias: OpenClaw normalizes "bash" to "exec" internally. The confirm-tools plugin now expands common aliases so both the user-facing name and the internal name are matched. 2. WS approval bridge: executeInBackground now subscribes to plugin.approval.requested on the container's WS client when the agent has always_ask policy. Pending approvals are stored in a per-session Map and emitted as agent.tool_confirmation_request SSE events on each poll tick and heartbeat. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ebad767 commit 72f1579

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

docker/confirm-tools-plugin/index.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,18 @@ import { definePluginEntry } from "openclaw/plugin-sdk/core";
1313

1414
const raw = (process.env.OPENCLAW_CONFIRM_TOOLS || "").trim();
1515
const confirmAll = raw === "__ALL__";
16-
const confirmTools = confirmAll
16+
17+
// OpenClaw normalizes tool names internally: "bash" becomes "exec",
18+
// "apply-patch" becomes "apply_patch", etc. The hook receives the
19+
// normalized name, so we expand common aliases to match both forms.
20+
const ALIASES = { bash: "exec", "apply-patch": "apply_patch" };
21+
const rawTools = confirmAll
1722
? []
1823
: raw.split(",").map((t) => t.trim()).filter(Boolean);
24+
const confirmTools = [
25+
...rawTools,
26+
...rawTools.map((t) => ALIASES[t]).filter(Boolean),
27+
];
1928

2029
export default definePluginEntry({
2130
id: "confirm-tools",

0 commit comments

Comments
 (0)