mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-29 01:52:04 +00:00
fix(agents): remove unconditional "Tools are disabled" prompt injection in CLI runner
`runCliAgent()` unconditionally appended "Tools are disabled in this session. Do not call tools." to `extraSystemPrompt` for every CLI backend session. The intent was to prevent the LLM from calling OpenClaw's embedded API tools (since CLI backends manage their own tools natively). However, CLI agents like Claude Code interpret this text as a blanket prohibition on ALL tools, including their own native Bash, Read, and Write tools. This caused silent failures across cron jobs, group chats, and DM sessions when using any CLI backend: the agent would see the injected text in the system prompt and refuse to execute tools, returning text responses instead. Cron jobs reported `lastStatus: "ok"` despite the agent failing to run scripts. The fix removes the hardcoded string entirely. CLI backends already receive `tools: []` (no OpenClaw embedded tools in the API call), so the text was redundant at best. Closes #44135 Co-Authored-By: Dhiman's Agentic Suite <dhiman.seal@hotmail.com>
This commit is contained in:
committed by
Peter Steinberger
parent
16565020a1
commit
99f0ea8d43
@@ -128,12 +128,7 @@ export async function runCliAgent(params: {
|
||||
const normalizedModel = normalizeCliModel(modelId, backend);
|
||||
const modelDisplay = `${params.provider}/${modelId}`;
|
||||
|
||||
const extraSystemPrompt = [
|
||||
params.extraSystemPrompt?.trim(),
|
||||
"Tools are disabled in this session. Do not call tools.",
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join("\n");
|
||||
const extraSystemPrompt = params.extraSystemPrompt?.trim() ?? "";
|
||||
|
||||
const sessionLabel = params.sessionKey ?? params.sessionId;
|
||||
const { bootstrapFiles, contextFiles } = await resolveBootstrapContextForRun({
|
||||
|
||||
Reference in New Issue
Block a user