Summary
Plugin-registered tools are unavailable in sub-agent sessions because createOpenClawTools() runs before loadOpenClawPlugins() completes for the sub-agent's execution context. Tools work correctly in the initial gateway session and after a gateway restart.
Reproduction
- Configure a plugin that registers tools via
api.registerTool() in its register() function (e.g., @honcho-ai/openclaw-honcho)
- Add the plugin's tool names to an agent profile's
tools.allow or tools.profile allowlist
- Start the gateway — tools work in the primary session
- Spawn a sub-agent session — tools are reported as unknown
Log Evidence
# Primary session — tools register correctly:
05:26:22 info gateway — Honcho memory plugin loaded
05:26:25 info gateway — Honcho memory ready
# Sub-agent session — tool resolver runs BEFORE plugin loads:
05:30:27 warn tools — tools.profile (coding) allowlist contains unknown entries
(honcho_search_conclusions, honcho_search_messages, honcho_ask, honcho_context, honcho_session)
05:30:27 warn tools — tools.allow allowlist contains unknown entries
(honcho_search_conclusions, honcho_search_messages, honcho_ask, honcho_context, honcho_session)
# Plugin loads 23 seconds AFTER tool resolution:
05:30:50 info plugins — Honcho memory plugin loaded
Root Cause
In the sub-agent initialization path, createOpenClawTools() (which calls resolvePluginTools() → buildPluginToolGroups() → stripPluginOnlyAllowlist()) executes before loadOpenClawPlugins() has called the plugin's register() function. The fresh plugin registry is empty when tool resolution happens.
Code Path (pi-embedded-BaSvmUpW.js)
- Tool resolution (line ~115963):
applyToolPolicyPipeline() validates allowlist entries against pluginGroups built from currently instantiated tools
- Plugin loading (line ~147194):
loadOpenClawPlugins() creates registry, calls register() on each plugin
- The gap: Step 1 happens before step 2 for sub-agent sessions
Plugin SDK Limitation
The plugin SDK has no static tool declaration mechanism:
openclaw.plugin.json manifest has no tools or toolNames field
definePluginEntry() only supports register() for tool registration
registerTool() options (name, names, optional) don't include a scope or global flag
Expected Behavior
Plugin tools registered during register() should be available to all sessions, including sub-agents spawned after initial gateway startup.
Workaround
Gateway restart makes all tools available. No plugin-side workaround exists.
Suggested Fix
Ensure loadOpenClawPlugins() completes before createOpenClawTools() for sub-agent execution contexts. Alternatively, add a static tool declaration mechanism to the plugin manifest so tool names can be pre-registered before register() runs.
Environment
- OpenClaw: >=2026.3.22
- Plugin: @honcho-ai/openclaw-honcho v1.2.1
- Plugin kind: memory
Summary
Plugin-registered tools are unavailable in sub-agent sessions because
createOpenClawTools()runs beforeloadOpenClawPlugins()completes for the sub-agent's execution context. Tools work correctly in the initial gateway session and after a gateway restart.Reproduction
api.registerTool()in itsregister()function (e.g.,@honcho-ai/openclaw-honcho)tools.allowortools.profileallowlistLog Evidence
Root Cause
In the sub-agent initialization path,
createOpenClawTools()(which callsresolvePluginTools()→buildPluginToolGroups()→stripPluginOnlyAllowlist()) executes beforeloadOpenClawPlugins()has called the plugin'sregister()function. The fresh plugin registry is empty when tool resolution happens.Code Path (pi-embedded-BaSvmUpW.js)
applyToolPolicyPipeline()validates allowlist entries againstpluginGroupsbuilt from currently instantiated toolsloadOpenClawPlugins()creates registry, callsregister()on each pluginPlugin SDK Limitation
The plugin SDK has no static tool declaration mechanism:
openclaw.plugin.jsonmanifest has notoolsortoolNamesfielddefinePluginEntry()only supportsregister()for tool registrationregisterTool()options (name,names,optional) don't include ascopeorglobalflagExpected Behavior
Plugin tools registered during
register()should be available to all sessions, including sub-agents spawned after initial gateway startup.Workaround
Gateway restart makes all tools available. No plugin-side workaround exists.
Suggested Fix
Ensure
loadOpenClawPlugins()completes beforecreateOpenClawTools()for sub-agent execution contexts. Alternatively, add a static tool declaration mechanism to the plugin manifest so tool names can be pre-registered beforeregister()runs.Environment