Skip to content

Commit 298a0cd

Browse files
fix(claude-cli): disable unsupported background tools (#95008) (thanks @anagnorisis2peripeteia)
Disable Claude CLI native background Bash and Monitor in OpenClaw-managed print runs, matching the existing fail-closed scheduler-tool behavior. This keeps deferred work on OpenClaw-owned wake paths instead of native Claude callbacks OpenClaw cannot deliver. Thanks @anagnorisis2peripeteia!
1 parent c578608 commit 298a0cd

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

‎extensions/anthropic/cli-backend.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export function buildAnthropicCliBackend(): CliBackendPlugin {
4949
"--allowedTools",
5050
"mcp__openclaw__*",
5151
"--disallowedTools",
52-
"ScheduleWakeup,CronCreate",
52+
"ScheduleWakeup,CronCreate,Bash(run_in_background:true),Monitor",
5353
],
5454
resumeArgs: [
5555
"-p",
@@ -62,7 +62,7 @@ export function buildAnthropicCliBackend(): CliBackendPlugin {
6262
"--allowedTools",
6363
"mcp__openclaw__*",
6464
"--disallowedTools",
65-
"ScheduleWakeup,CronCreate",
65+
"ScheduleWakeup,CronCreate,Bash(run_in_background:true),Monitor",
6666
"--resume",
6767
"{sessionId}",
6868
],

‎extensions/anthropic/cli-shared.test.ts‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ import {
1010
resolveClaudeCliExecutionArgs,
1111
} from "./cli-shared.js";
1212

13+
const CLAUDE_CLI_DISALLOWED_TOOLS =
14+
"ScheduleWakeup,CronCreate,Bash(run_in_background:true),Monitor";
15+
1316
function expectDefaultDisallowedTools(args: readonly string[] | undefined) {
1417
const disallowedIndex = args?.indexOf("--disallowedTools") ?? -1;
1518
expect(disallowedIndex).toBeGreaterThanOrEqual(0);
16-
expect(args?.[disallowedIndex + 1]).toBe("ScheduleWakeup,CronCreate");
19+
expect(args?.[disallowedIndex + 1]).toBe(CLAUDE_CLI_DISALLOWED_TOOLS);
1720
}
1821

1922
describe("normalizeClaudePermissionArgs", () => {
@@ -382,4 +385,11 @@ describe("normalizeClaudeBackendConfig", () => {
382385
expect(backend.config.clearEnv).toContain("OTEL_EXPORTER_OTLP_PROTOCOL");
383386
expect(backend.config.clearEnv).toContain("OTEL_SDK_DISABLED");
384387
});
388+
389+
it("disables native background Bash and Monitor tools in args and resumeArgs", () => {
390+
const backend = buildAnthropicCliBackend();
391+
392+
expectDefaultDisallowedTools(backend.config.args);
393+
expectDefaultDisallowedTools(backend.config.resumeArgs);
394+
});
385395
});

0 commit comments

Comments
 (0)