openclaw - ✅(Solved) Fix [Bug]: Agents fabricate tool capabilities when the `message` tool is missing from their allowlist; `doctor` does not detect channel/tool-policy mismatch [3 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#80128Fetched 2026-05-11 03:18:29
View on GitHub
Comments
1
Participants
2
Timeline
13
Reactions
2
Timeline (top)
referenced ×9cross-referenced ×3commented ×1

When an agent is bound to a messaging channel (Discord in this report) but its tool allowlist does not include the message tool, the agent cannot send attachments or use message-tool actions. Instead of reporting "I don't have access to the message tool", multiple models confidently fabricate a different reason — e.g. "the message tool doesn't support Discord file attachments" — even though the tool and the Discord plugin both support attachments end-to-end. openclaw doctor does not catch the mismatch.

Root Cause

When an agent is bound to a messaging channel (Discord in this report) but its tool allowlist does not include the message tool, the agent cannot send attachments or use message-tool actions. Instead of reporting "I don't have access to the message tool", multiple models confidently fabricate a different reason — e.g. "the message tool doesn't support Discord file attachments" — even though the tool and the Discord plugin both support attachments end-to-end. openclaw doctor does not catch the mismatch.

Fix Action

Workaround

Switch the agent to a profile that includes message:

"tools": { "profile": "full" }

(or "messaging" for a narrower allowlist). This restores sendAttachment and other message-tool actions immediately.

PR fix notes

PR #80157: fix(doctor): warn when a channel-bound agent is missing the message tool

Description (problem / solution / changelog)

Closes #80128

Summary

When an agent has an explicit tools.allow list that omits "message" but is bound to a messaging channel via cfg.bindings, channel explicit actions (sendAttachment, reply, thread-reply) silently fail and the agent confabulates capability limitations.

This PR adds a collectAgentChannelMessageToolWarnings check to openclaw doctor that detects the mismatch and emits an actionable warning.

Fix:

  • Add collectAgentChannelMessageToolWarnings in src/doctor/checks/agent-channel-message-tool.ts
  • Wire the new check into the doctor report
  • 6 tests covering: explicit-allow without message, profile-based allow (no warning), allow includes message (no warning), no explicit tools (no warning)

Real behavior proof

  • Behavior or issue addressed: openclaw doctor silently skipped channel-bound agents with an explicit tools.allow that excluded "message", causing agents to silently fail or confabulate instead of surfacing an actionable configuration error.
  • Real environment tested: Local OpenClaw Gateway 2026.5.10, Node.js v24.x, macOS, agent commander bound to Discord channel with tools.allow: ["search"].
  • Exact steps or command run after this patch:
    1. Configure an agent with tools.allow: ["search"] and a binding to a Discord channel (omitting "message").
    2. Run openclaw doctor.
    3. Observe warning in doctor output.
  • Evidence after fix:
    ⚠ agent "commander" is bound to channel "discord" but the message tool is not in its resolved tool policy — add "message" to tools.allow
    Before this patch, openclaw doctor produced no warning for this misconfiguration. After the patch, the doctor check surfaces the mismatch with an actionable message.
  • Observed result after fix: openclaw doctor emits a warning for every channel-bound agent whose resolved tool policy excludes "message", enabling operators to catch and fix the misconfiguration before deployment.
  • What was not tested: Profile-based allow configurations with inherited message tool; Windows paths; agents bound to multiple channels simultaneously.

Changed files

  • src/agents/pi-embedded-runner/runs.ts (modified, +63/-5)
  • src/commands/doctor/shared/preview-warnings.test.ts (modified, +144/-0)
  • src/commands/doctor/shared/preview-warnings.ts (modified, +37/-0)
  • src/plugin-sdk/agent-harness-runtime.ts (modified, +20/-6)
  • ui/src/i18n/.i18n/raw-copy-baseline.json (modified, +7/-0)
  • ui/src/ui/chat/grouped-render.test.ts (modified, +1/-1)
  • ui/src/ui/chat/grouped-render.ts (modified, +21/-9)

PR #80183: fix(doctor): warn when channel-bound agent's explicit allow list omits the message tool

Description (problem / solution / changelog)

Summary

Partial fix for #80128 — addresses the doctor check half of the issue.

When an agent is bound to a messaging channel via cfg.bindings but has an explicit tools.allow list that does not include the message tool, the agent cannot use message-tool actions (sendAttachment, reply, thread-reply, upload-file). Rather than surfacing a clear error, affected agents confabulate false capability reasons:

"the message tool doesn't support Discord file attachments"

...even though the Discord plugin and the message tool both fully support attachments.

Root cause

Agents with hand-curated tools.allow lists have no reliable way to know their own allowlist at runtime, so when asked to do something that requires a missing tool, capable models fall back to confabulation. openclaw doctor did not detect this mismatch.

Changes

src/commands/doctor-security.ts

  • Add collectAgentChannelToolBindingWarnings(cfg) that checks every agent in agents.list that is channel-bound via cfg.bindings.
  • The check skips agents with no explicit tools.allow (default policy allows message), agents using a profile that already includes message (messaging, full), and agents where message appears in allow or alsoAllow.
  • Emits an actionable warning naming the agent, bound channels, and the exact config fix.
  • Called from noteSecurityWarnings alongside existing checks.

src/commands/doctor-security.agent-channel-tool-binding.test.ts

  • 10 unit tests covering: no bindings, agent not bound, no tools config, no explicit allow, allow includes message, alsoAllow includes message, messaging/full profiles, multi-channel warning, multi-agent independent warnings.

Example warning output

Security
- Agent `commander` is bound to channel(s) [discord] but the `message` tool is not in its tool policy.
  Channel auto-replies work, but explicit message actions (sendAttachment, reply, thread-reply,
  upload-file) will fail and the agent may confabulate capability reasons.
  Fix: add `"message"` to agents.list.commander.tools.allow, or switch to a profile that
  includes it (e.g. `"profile": "messaging"` or `"profile": "full"`).

Not addressed in this PR

The tool introspection half of #80128 (injecting the agent's resolved tool list into its system context so it can self-report missing tools) is a larger runtime change and should be tracked as a follow-up.

Real behavior proof

Verified by running the new check logic against a config that reproduces the issue scenario from #80128:

Input config (reproduces the exact agent from the bug report):

{
  "agents": {
    "list": [{
      "id": "commander",
      "tools": {
        "allow": ["read","write","edit","exec","bash","agents_list","sessions_list","session_status","subagents","llm-task","thinking","reactions","skills"],
        "deny": ["clawhub","cron","gateway","nodes"]
      }
    }]
  },
  "bindings": [{"agentId": "commander", "match": {"channel": "discord"}}]
}

Before this fix: openclaw doctor reported no warnings about the commander agent's tool policy.

After this fix: openclaw doctor emits the actionable warning shown above — message is not in the expanded allow list (bash normalizes to exec, none of the other tools expand to message), agent is bound to discord, warning fires.

Regression cases verified:

  • Agent with "profile": "messaging" → no warning (messaging profile includes message)
  • Agent with "profile": "full" → no warning (full profile = empty policy = all tools allowed)
  • Agent with allow: ["read", "write", "message"] → no warning (message present)
  • Agent with alsoAllow: ["message"] → no warning (alsoAllow merges correctly)
  • Agent not referenced in cfg.bindings → no warning (not channel-bound)

Changed files

  • src/commands/doctor-security.agent-channel-tool-binding.test.ts (added, +279/-0)
  • src/commands/doctor-security.ts (modified, +96/-0)

PR #80250: fix(doctor): warn routed agents missing message tool

Description (problem / solution / changelog)

Summary

  • add prompt guidance so agents report policy-filtered missing tools instead of inventing channel/provider limitations
  • warn in doctor preview when route-bound or default channel agents cannot call the message tool
  • add regression coverage for routed agents and configured channels without explicit routes

Fixes #80128

Real behavior proof

Behavior or issue addressed: agents with channel routes but no message tool could claim Discord/Telegram/etc. lacked an attachment or thread-reply capability, while the real problem was the selected agent tool policy. Doctor also did not warn on explicit channel actions that require the message tool.

Real environment tested: local OpenClaw CLI on this branch, using a temporary config with channels.discord.enabled=true, agent commander routed from discord, and commander.tools.allow=["read","write"] without message.

Exact steps or command run after this patch:

env OPENCLAW_CONFIG_PATH=/private/tmp/openclaw-80128-proof-config.json OPENCLAW_STATE_DIR=/private/tmp/openclaw-80128-proof-state pnpm openclaw --no-color doctor --non-interactive --no-workspace-suggestions

Evidence after fix:

- Agent "commander" is routed from channel "discord", but the message tool is unavailable for that agent; explicit channel actions such as sendAttachment, upload-file, thread-reply, or reply can fail. Add "message" to the agent tool allowlist, add "group:messaging", or switch the agent to a profile that includes messaging tools.

Observed result after fix: doctor emits the new message-tool policy warning for the route-bound Discord agent. The same run also showed the existing visible-reply fallback warning for message_tool, confirming this warning is additive and covers explicit channel actions such as attachments/thread replies.

What was not tested: no live Discord send/upload was performed; this PR only changes prompt guidance and doctor preview diagnostics.

Validation

  • pnpm test src/agents/system-prompt.test.ts src/commands/doctor/shared/preview-warnings.test.ts
  • pnpm exec oxfmt --check --threads=1 CHANGELOG.md src/agents/system-prompt.ts src/agents/system-prompt.test.ts src/commands/doctor/shared/preview-warnings.ts src/commands/doctor/shared/preview-warnings.test.ts
  • git diff --check
  • pnpm check:changed --staged

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • src/agents/system-prompt.test.ts (modified, +3/-0)
  • src/agents/system-prompt.ts (modified, +1/-0)
  • src/commands/doctor/shared/preview-warnings.test.ts (modified, +281/-0)
  • src/commands/doctor/shared/preview-warnings.ts (modified, +166/-0)

Code Example

{
     "id": "commander",
     "tools": {
       "allow": [
         "read", "write", "edit", "exec", "bash",
         "agents_list", "sessions_list", "session_status",
         "subagents", "llm-task", "thinking", "reactions", "skills"
       ],
       "deny": ["clawhub", "cron", "gateway", "nodes"]
     }
   }

---

"tools": { "profile": "full" }
RAW_BUFFERClick to expand / collapse

Summary

When an agent is bound to a messaging channel (Discord in this report) but its tool allowlist does not include the message tool, the agent cannot send attachments or use message-tool actions. Instead of reporting "I don't have access to the message tool", multiple models confidently fabricate a different reason — e.g. "the message tool doesn't support Discord file attachments" — even though the tool and the Discord plugin both support attachments end-to-end. openclaw doctor does not catch the mismatch.

Reproduction

  1. Start with an agent that has an explicit tools.allow array (no tools.profile), and no "message" entry in allow. Example (commander agent, slimmed):

    {
      "id": "commander",
      "tools": {
        "allow": [
          "read", "write", "edit", "exec", "bash",
          "agents_list", "sessions_list", "session_status",
          "subagents", "llm-task", "thinking", "reactions", "skills"
        ],
        "deny": ["clawhub", "cron", "gateway", "nodes"]
      }
    }
  2. Bind the agent to a Discord channel (Discord plugin installed, channel ON/OK).

  3. From Discord, ask the agent to attach a file it just produced, e.g.: Attach /home/me/.openclaw/workspace/self_status_report.md and post it here.

Observed

The agent invents a capability limitation rather than reporting the missing tool. Reproduced with two different models on the same agent:

  • ollama/granite4.1:8b:

    "Unfortunately, I cannot attach this file directly to the Discord channel from within OpenClaw. The message tool does not support file attachments for Discord messages."

  • ollama/qwen3.6:latest:

    "I don't have access to the message tool for Discord file attachments in this environment. … Cannot attach files to Discord from this session. The message tool doesn't support Discord file attachments."

openclaw doctor reports no warnings about commander's tool policy. openclaw plugins inspect discord shows the plugin loaded with channel: discord, and the discord provider supports file uploads end-to-end (see provider-*.js deliverDiscordInteractionReplyfiles: files.map(...)). The message tool itself exposes a sendAttachment action with media, filename, and buffer parameters.

Expected

Two distinct improvements:

1. Tool-introspection in agent runtime context

When an agent is asked to do something that requires a tool it doesn't have, it should be able to truthfully report "the message tool is not in my allowed tool list; ask the operator to add it or switch profile." Today the agent has no reliable way to know its own allowlist, so even capable models (qwen3.6:latest) fall back to confabulation.

Concretely, either:

  • Inject the agent's resolved tool list into its system context at session start, or
  • Provide a tools.list_self / whoami introspection tool that's always available to every agent.

2. doctor check for channel-bound agents missing the message tool

doctor already correlates many config surfaces. Add a check:

For each agent in agents.list, if the agent's resolved channel bindings include any channel with a non-noop replyMode, and the agent's resolved tool policy does not include message, emit a warning:

"Agent <id> is bound to channel <channel> but the message tool is not in its tool policy. Channel auto-replies will work, but explicit actions (sendAttachment, reply, sendWithEffect, upload-file, thread-reply) will fail. Add message to agents.list[].tools.allow or switch the agent to a profile that includes it (e.g. messaging, full)."

Suggested fix

  • Tool introspection: include the resolved allow/deny tool list (names only, no descriptions) in the agent's system prompt context, behind the same flag/section that exposes other agent metadata. Even small models then have a factual answer to "what tools do I have?"
  • doctor: add checkAgentChannelToolBindings(config) to the doctor pipeline. Should be cheap — the config already resolves channels-per-agent and tool policies.

Workaround

Switch the agent to a profile that includes message:

"tools": { "profile": "full" }

(or "messaging" for a narrower allowlist). This restores sendAttachment and other message-tool actions immediately.

Environment

  • OpenClaw 2026.5.7 (eeef486)
  • Ubuntu 26.04 (kernel 6.17.0-20-generic), node 22.22.2
  • Discord channel ON/OK; @openclaw/discord plugin 2026.5.7 installed
  • Affected agent: commander with hand-curated tools.allow (no message)
  • Reproduced on ollama/granite4.1:8b and ollama/qwen3.6:latest

Related

  • #78066 — doctor --fix and the message tool: the same tool surface, but a different defect (doctor recommending a setting that depends on a tool not present in the active policy).
  • #66781 — Agent tool permissions defaults; tangentially related to the broader question of how an agent learns its own tool surface.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING