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.yaml were 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.
Bug Description
The OpenClaw plugin's
register()function inexamples/openclaw-plugin/index.jspasses config tocreateContextEnginevia the factory callback argument (pluginConfig), but OpenClaw's gateway does not pass plugin config through the factory callback. Instead, it makes config available onapi.pluginConfig.Current Code (broken)
The
pluginConfigparameter in the factory callback isundefinedat runtime because OpenClaw's gateway places config onapi.pluginConfig, not as a factory argument.Result
createContextEnginereceivesundefinedas its config, causing it to fall back to defaults (or fail) regardless of what the user configured inconfig.yaml.Fix
Capture
api.pluginConfigin the outer scope and fall back to it:Environment
config.yamlwere silently ignoredNotes
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.