Repository navigation
fix(agents): remove unconditional "Tools are disabled" prompt injection in CLI runner - #46214
Conversation
…on 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 <[email protected]>
Greptile SummaryThis PR removes a hardcoded Key changes:
Confidence Score: 5/5
Last reviewed commit: 4f34200 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4f342009bc
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Previous run had a flaky Telegram extension test failure (429 rate limit in extensions/telegram/src/send.test.ts) unrelated to this change. Co-Authored-By: Dhiman's Agentic Suite <[email protected]>
|
CI note: The All checks relevant to the changed files pass:
|
codex-cli lacks systemPromptArg, so the system prompt is never
serialized into argv — making the not-toContain assertion pass
vacuously even on pre-fix code. Switch to claude-cli which defines
systemPromptArg ("--append-system-prompt") and add a positive
assertion that the user-supplied prompt IS present in argv.
Co-Authored-By: Dhiman's Agentic Suite <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ae6494467d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Happy to solve a problem for something that has solved so many problems for me. |
Summary
"Tools are disabled in this session. Do not call tools."text thatrunCliAgent()unconditionally appended to every CLI backend session'sextraSystemPromptProblem
runCliAgent()insrc/agents/cli-runner.tsbuildsextraSystemPromptas:This text was intended to prevent the LLM from calling OpenClaw's embedded API tools (since CLI backends manage their own tools natively, and
tools: []is already passed). However, CLI agents like Claude Code interpret the injected text as a blanket prohibition on all tools, including their own native Bash, Read, Write, etc.Impact: Silent failures across cron jobs, group chats, and DM sessions when using any CLI backend. The agent sees "Tools are disabled" in the system prompt and refuses to execute tools, returning text-only responses. Cron jobs report
lastStatus: "ok"despite failing to run scripts.Root cause analysis
Traced via reverse engineering the minified dist bundles (v2026.3.8 and v2026.3.13):
disableToolsparam is not set totruefor group/cron sessions anywhere in the codebasedisableTools: trueis inllm-task-tool.ts(LLM-only sub-agents)GroupToolPolicymechanismrunCliAgent()tools: []inbuildSystemPrompt(), so the LLM has no OpenClaw tools to call regardlessFix
Test plan
"does not inject hardcoded 'Tools are disabled' text into CLI arguments"cli-runner.test.tstests pass (CI)pnpm checkpasses (CI)AI disclosure
This PR was authored with AI assistance (Claude Code). The root cause was identified by reverse engineering the minified dist bundles, confirmed against the TypeScript source, and validated against real-world cron session transcripts showing the failure. The fix and test follow existing patterns in
cli-runner.test.ts.Closes #44135
Generated with Dhiman's Agentic Suite