openclaw - ✅(Solved) Fix [Bug]: `command-dispatch: tool` skill slash commands bypass effective tool policy [2 pull requests, 2 comments, 3 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#75124Fetched 2026-05-01 05:37:54
View on GitHub
Comments
2
Participants
3
Timeline
6
Reactions
2
Timeline (top)
commented ×2cross-referenced ×2labeled ×2

Root Cause

This is an important security / policy issue, not a cosmetic one.

OpenClaw documents that tool availability should be constrained by:

  • tool profiles
  • group / channel policy
  • sandbox policy
  • subagent depth policy

In particular, the docs explicitly say leaf subagents should have no session tools by default.

But the inline skill-command path for command-dispatch: tool does not use the normal tool-policy pipeline. It creates the raw OpenClaw tool set and only applies owner-only filtering before invoking the requested tool.

That means a user-invocable skill slash command can expose tools that the current session should not have, depending on which tool a skill or plugin targets.

Fix Action

Fix / Workaround

But the inline skill-command path for command-dispatch: tool does not use the normal tool-policy pipeline. It creates the raw OpenClaw tool set and only applies owner-only filtering before invoking the requested tool.

The skill slash-command dispatch path does not.

  1. load user-invocable skill commands
  2. if a skill uses command-dispatch: tool, call createOpenClawTools(...)
  3. apply only applyOwnerOnlyToolPolicy(...)
  4. execute the matched tool

PR fix notes

PR #75125: fix(skills): route inline tool-dispatch slash commands through effective tool policy

Description (problem / solution / changelog)

Summary

  • Problem: inline skill slash commands using command-dispatch: tool built tools from raw createOpenClawTools(...) instead of the normal filtered session tool surface.
  • Why it matters: this could let the inline dispatch path diverge from the session's real effective tool policy, including profile, group/channel, sandbox, and subagent restrictions.
  • What changed: the inline dispatch path now resolves the canonical runtime policy session key and builds tools through createOpenClawCodingTools(...), forwarding the same session/group/sender/model context used by the shared command flow.
  • What did NOT change (scope boundary): this does not change normal agent-turn tool policy behavior, add new tools, or widen any permissions; it only makes the inline tool-dispatch path honor the existing policy pipeline.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #75124
  • Related #
  • This PR fixes a bug or regression

Root Cause (if applicable)

  • Root cause: the command-dispatch: tool inline slash-command path constructed raw OpenClaw tools directly and only applied owner-only filtering, instead of using the shared effective tool policy pipeline.
  • Missing detection / guardrail: there was no regression test asserting that inline tool-dispatch commands use the same filtered tool surface as normal session turns.
  • Contributing context (if known): the normal command/system-prompt flow already resolved canonical runtime-policy session context and target-session metadata, but the inline dispatch path duplicated tool setup logic instead of reusing that shared path.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: src/auto-reply/reply/get-reply-inline-actions.skip-when-config-empty.test.ts
  • Scenario the test should lock in: a user-invocable skill slash command with command-dispatch: tool must build tools through createOpenClawCodingTools(...) using the canonical runtime policy session key plus target-session group/subagent metadata.
  • Why this is the smallest reliable guardrail: the bug lives entirely inside the inline dispatch branch, and a focused unit test can directly assert that this branch uses the same filtered tool-construction path without needing full end-to-end channel setup.
  • Existing test that already covers this (if any): none that covered the policy-pipeline parity for inline tool dispatch.
  • If no new test is added, why not: N/A

User-visible / Behavior Changes

  • Inline skill slash commands that dispatch directly to tools now respect the same effective session tool policy as normal agent turns.
  • In restricted sessions, tool-dispatch skills may now correctly report a tool as unavailable instead of bypassing policy filters.

Diagram (if applicable)

Before:
/skill-command -> command-dispatch: tool -> createOpenClawTools(...) -> owner-only filter -> tool executes

After:
/skill-command -> command-dispatch: tool -> resolve canonical policy session -> createOpenClawCodingTools(...) -> shared policy pipeline -> tool executes or is unavailable

Security Impact (required)

  • New permissions/capabilities? (Yes/No) No
  • Secrets/tokens handling changed? (Yes/No) No
  • New/changed network calls? (Yes/No) No
  • Command/tool execution surface changed? (Yes/No) Yes
  • Data access scope changed? (Yes/No) No
  • If any Yes, explain risk + mitigation: the reachable inline tool-dispatch surface is narrower in restricted sessions because it now honors existing policy filters. This is a hardening change, not an expansion; mitigation is reuse of the existing shared createOpenClawCodingTools(...) pipeline and added regression coverage.

Repro + Verification

Environment

  • OS: Windows
  • Runtime/container: local workspace shell
  • Model/provider: N/A
  • Integration/channel (if any): inline skill slash-command path
  • Relevant config (redacted): restricted effective tool policy session or leaf subagent session with a user-invocable command-dispatch: tool skill

Steps

  1. Create or use a restricted session where some tools should be unavailable through the normal effective tool policy.
  2. Add a user-invocable skill command using command-dispatch: tool for one of those restricted tools.
  3. Invoke the skill slash command from that session.

Expected

  • The inline dispatcher should only see tools allowed by the same effective policy used by normal session turns.

Actual

  • Before the fix, the inline dispatcher could build from raw tools and diverge from the session's effective tool surface.

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios: reviewed and updated the inline dispatch code path to use createOpenClawCodingTools(...); verified the forwarded context includes canonical runtime policy session key, target session group metadata, sender ownership, and model identifiers; added regression assertions for that path.
  • Edge cases checked: target-session entry preferred over wrapper session entry; sender ownership still forwarded; named agent context still forwarded into the shared tool builder.
  • What you did not verify: I did not run the Vitest file locally in this environment because package-manager execution was blocked here (pnpm not on PATH, and corepack pnpm failed with an EPERM creating its local cache directory).

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.

Compatibility / Migration

  • Backward compatible? (Yes/No) Yes
  • Config/env changes? (Yes/No) No
  • Migration needed? (Yes/No) No
  • If yes, exact upgrade steps:

Risks and Mitigations

  • Risk: the inline dispatch path now depends on the shared coding-tool builder and canonical runtime policy session resolution, so mismatched assumptions could hide a tool that was previously reachable through the buggy path.
    • Mitigation: that behavior is intentional and aligns inline dispatch with the documented effective tool policy; regression tests assert the forwarded policy context.

Changed files

  • src/agents/openclaw-tools.runtime.ts (removed, +0/-1)
  • src/auto-reply/reply/get-reply-inline-actions.skip-when-config-empty.test.ts (modified, +147/-21)
  • src/auto-reply/reply/get-reply-inline-actions.ts (modified, +34/-21)

PR #40238: Respect skill tool policy in inline command dispatch

Description (problem / solution / changelog)

Summary

  • ensure inline command-dispatch: tool uses the same coding-tool policy filtering as normal coding sessions
  • remove the owner-only fallback tool filter in inline dispatch to avoid bypassing permission profiles
  • add regression coverage for non-owner users to confirm command-exec style tools are blocked when policy disallows them

Testing

  • pnpm -s vitest run src/auto-reply/reply/get-reply-inline-actions.skill-dispatch-policy.test.ts

Changed files

  • src/auto-reply/reply/get-reply-inline-actions.skill-dispatch-policy.test.ts (added, +173/-0)
  • src/auto-reply/reply/get-reply-inline-actions.ts (modified, +18/-12)

Code Example

---
name: spawn-subagent
description: Spawn subagent
command-dispatch: tool
command-tool: sessions_spawn
---

---
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Why this matters

This is an important security / policy issue, not a cosmetic one.

OpenClaw documents that tool availability should be constrained by:

  • tool profiles
  • group / channel policy
  • sandbox policy
  • subagent depth policy

In particular, the docs explicitly say leaf subagents should have no session tools by default.

But the inline skill-command path for command-dispatch: tool does not use the normal tool-policy pipeline. It creates the raw OpenClaw tool set and only applies owner-only filtering before invoking the requested tool.

That means a user-invocable skill slash command can expose tools that the current session should not have, depending on which tool a skill or plugin targets.

The problem

Normal agent turns build tools through createOpenClawCodingTools(...), which applies:

  • profile policy
  • agent / provider policy
  • group policy
  • sandbox policy
  • subagent policy

The skill slash-command dispatch path does not.

Instead it does:

  1. load user-invocable skill commands
  2. if a skill uses command-dispatch: tool, call createOpenClawTools(...)
  3. apply only applyOwnerOnlyToolPolicy(...)
  4. execute the matched tool

So the command-dispatch path can diverge from the session's real effective tool set.

Impact

This breaks the expectation that "if /tools or the active profile says a tool is unavailable, the session cannot use it".

Examples of policy that can be bypassed by a tool-dispatch skill:

  • messaging-profile sessions that should not have orchestration / coding tools
  • subagent leaf sessions that should not have sessions_* control tools
  • sandbox-aware tool gating, because this path does not thread the normal sandboxed filtering path
  • runtime flags like intentionally omitting a tool from the current effective surface

Even if some core tools are awkward to drive through raw slash-command args, the policy mismatch itself is the bug: a supported user-facing feature is skipping the central authorization/filtering pipeline.

Steps to reproduce

  1. Configure an agent with a restrictive tool profile, or use a leaf subagent where session tools should be denied.
  2. Add a user-invocable skill with frontmatter like:
---
name: spawn-subagent
description: Spawn subagent
command-dispatch: tool
command-tool: sessions_spawn
---
  1. Invoke the skill slash command from that restricted session.
  2. Observe that the inline dispatcher resolves tools via createOpenClawTools(...) instead of the normal filtered tool surface.

Expected behavior

Skill slash commands that dispatch directly to tools should use the same effective tool set as the current session.

At minimum, this path should honor the same filtering used by normal agent turns:

  • profile policy
  • group/channel policy
  • sandbox policy
  • subagent policy

Actual behavior

command-dispatch: tool currently skips that policy pipeline and can see tools that should have been removed from the session's effective surface.

OpenClaw version

2026.4.27

Operating system

Any

Install method

Any

Model

N/A (model-independent)

Provider / routing chain

N/A (local tool-policy issue, reproducible before provider dispatch)

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

The command-dispatch: tool path in skill slash commands should be modified to use the normal tool-policy pipeline, applying profile, group, sandbox, and subagent policies.

Guidance

  • Review the createOpenClawTools function to understand how it differs from createOpenClawCodingTools, which applies the necessary policies.
  • Modify the command-dispatch: tool path to use createOpenClawCodingTools instead of createOpenClawTools, ensuring that the same policies are applied.
  • Verify that the updated path honors the expected filtering by testing with a restrictive tool profile or a leaf subagent session.
  • Consider adding additional logging or debugging to ensure that the policy pipeline is being correctly applied in the command-dispatch: tool path.

Example

---
name: spawn-subagent
description: Spawn subagent
command-dispatch: tool
command-tool: sessions_spawn
---

This example frontmatter should be updated to use the modified command-dispatch: tool path that applies the necessary policies.

Notes

The fix may require additional changes to ensure that the command-dispatch: tool path correctly handles errors and edge cases. Thorough testing should be performed to verify that the updated path works as expected.

Recommendation

Apply the workaround by modifying the command-dispatch: tool path to use the normal tool-policy pipeline, as this will ensure that the expected policies are applied and the security issue is addressed.

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…

FAQ

Expected behavior

Skill slash commands that dispatch directly to tools should use the same effective tool set as the current session.

At minimum, this path should honor the same filtering used by normal agent turns:

  • profile policy
  • group/channel policy
  • sandbox policy
  • subagent policy

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Bug]: `command-dispatch: tool` skill slash commands bypass effective tool policy [2 pull requests, 2 comments, 3 participants]