-
Notifications
You must be signed in to change notification settings - Fork 359
Description
Bug Description
The OpenClaw plugin's register() function in examples/openclaw-plugin/index.js passes config to createContextEngine via the factory callback argument (pluginConfig), but OpenClaw's gateway does not pass plugin config through the factory callback. Instead, it makes config available on api.pluginConfig.
Current Code (broken)
export default function register(api) {
api.registerContextEngine(pluginMeta.id, (pluginConfig) => {
return createContextEngine(pluginMeta, pluginConfig, api.logger);
});
}The pluginConfig parameter in the factory callback is undefined at runtime because OpenClaw's gateway places config on api.pluginConfig, not as a factory argument.
Result
createContextEngine receives undefined as its config, causing it to fall back to defaults (or fail) regardless of what the user configured in config.yaml.
Fix
Capture api.pluginConfig in the outer scope and fall back to it:
export default function register(api) {
const config = api.pluginConfig || {};
api.registerContextEngine(pluginMeta.id, (factoryConfig) => {
return createContextEngine(pluginMeta, factoryConfig || config, api.logger);
});
}Environment
- OpenClaw v2026.3.24 (npm)
- Plugin v1.4.0
- Discovered during initial setup — config values (baseUrl, userId, etc.) from
config.yamlwere silently ignored
Notes
This may also be an OpenClaw-side issue (gateway should arguably pass config to the factory callback). But the plugin can be made resilient either way with the fallback pattern above.