Skip to content

Commit 45febec

Browse files
committed
fix(exec): keep implicit sandbox default and restore no-alert baseline
1 parent f6c2e99 commit 45febec

File tree

4 files changed

+29
-8
lines changed

4 files changed

+29
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "openclaw",
3-
"version": "2026.2.22-1",
3+
"version": "2026.2.22-2",
44
"description": "Multi-channel AI gateway with extensible messaging integrations",
55
"keywords": [],
66
"homepage": "https://github.com/openclaw/openclaw#readme",

src/agents/pi-tools-agent-config.test.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,31 @@ describe("Agent-specific tool filtering", () => {
604604
expect(resultDetails?.status).toBe("completed");
605605
});
606606

607+
it("keeps sandbox as the implicit exec host default without forcing gateway approvals", async () => {
608+
const tools = createOpenClawCodingTools({
609+
config: {},
610+
sessionKey: "agent:main:main",
611+
workspaceDir: "/tmp/test-main-implicit-sandbox",
612+
agentDir: "/tmp/agent-main-implicit-sandbox",
613+
});
614+
const execTool = tools.find((tool) => tool.name === "exec");
615+
expect(execTool).toBeDefined();
616+
617+
const result = await execTool!.execute("call-implicit-sandbox-default", {
618+
command: "echo done",
619+
yieldMs: 10,
620+
});
621+
const details = result?.details as { status?: string } | undefined;
622+
expect(details?.status).toBe("completed");
623+
624+
await expect(
625+
execTool!.execute("call-implicit-sandbox-gateway", {
626+
command: "echo done",
627+
host: "gateway",
628+
}),
629+
).rejects.toThrow("exec host not allowed");
630+
});
631+
607632
it("fails closed when exec host=sandbox is requested without sandbox runtime", async () => {
608633
const tools = createOpenClawCodingTools({
609634
config: {},
@@ -618,7 +643,7 @@ describe("Agent-specific tool filtering", () => {
618643
command: "echo done",
619644
host: "sandbox",
620645
}),
621-
).rejects.toThrow("exec host not allowed");
646+
).rejects.toThrow("exec host=sandbox is configured");
622647
});
623648

624649
it("should apply agent-specific exec host defaults over global defaults", async () => {

src/agents/pi-tools.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -364,13 +364,9 @@ export function createOpenClawCodingTools(options?: {
364364
return [tool];
365365
});
366366
const { cleanupMs: cleanupMsOverride, ...execDefaults } = options?.exec ?? {};
367-
// Fail-closed baseline: when no sandbox context exists, default exec to gateway
368-
// so we never silently treat "sandbox" as host execution.
369-
const resolvedExecHost =
370-
options?.exec?.host ?? execConfig.host ?? (sandbox ? "sandbox" : "gateway");
371367
const execTool = createExecTool({
372368
...execDefaults,
373-
host: resolvedExecHost,
369+
host: options?.exec?.host ?? execConfig.host,
374370
security: options?.exec?.security ?? execConfig.security,
375371
ask: options?.exec?.ask ?? execConfig.ask,
376372
node: options?.exec?.node ?? execConfig.node,

src/config/types.tools.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ export function parseToolsBySenderTypedKey(
215215
export type GroupToolPolicyBySenderConfig = Record<string, GroupToolPolicyConfig>;
216216

217217
export type ExecToolConfig = {
218-
/** Exec host routing (default: sandbox with sandbox runtime, otherwise gateway). */
218+
/** Exec host routing (default: sandbox). */
219219
host?: "sandbox" | "gateway" | "node";
220220
/** Exec security mode (default: deny). */
221221
security?: "deny" | "allowlist" | "full";

0 commit comments

Comments
 (0)