Skip to content

fix(openclaw): forward plugin config via api.pluginConfig (closes #150)#243

Open
Fearvox wants to merge 1 commit into
EverMind-AI:mainfrom
Fearvox:fix/issue-150-pluginconfig-forwarding
Open

fix(openclaw): forward plugin config via api.pluginConfig (closes #150)#243
Fearvox wants to merge 1 commit into
EverMind-AI:mainfrom
Fearvox:fix/issue-150-pluginconfig-forwarding

Conversation

@Fearvox
Copy link
Copy Markdown
Collaborator

@Fearvox Fearvox commented Jun 3, 2026

What

The OpenClaw plugin's register() read plugin config only from the
factory-callback argument:

api.registerContextEngine(pluginMeta.id, (pluginConfig) => {
  return createContextEngine(pluginMeta, pluginConfig, api.logger);
});

Current OpenClaw hosts deliver plugin config via api.pluginConfig, not the
callback argument. On those hosts the callback arg is undefined, so the engine
booted with no config at all — exactly the bug reported in #150
("factory callback receives no config — api.pluginConfig not forwarded"), whose
repro shows this same register().

This PR makes register() prefer the host-provided config and fall back to the
callback arg so config forwarding works on both host generations:

const resolvedConfig = api.pluginConfig ?? pluginConfig ?? {};
return createContextEngine(pluginMeta, resolvedConfig, api.logger);

Why

A passive context engine that boots with empty config silently uses defaults
(default serverUrl, default userId) instead of the host's configured values
— memories get written under the wrong identity / endpoint with no error. The
?? {} tail also keeps resolveConfig() from throwing when both sources are
absent.

Tests

Adds test/register-config.test.js (runs with node --test, fully offline — a
stubbed fetch makes the resolved serverUrl observable via the engine's
/health bootstrap call):

  • register() prefers api.pluginConfig over the callback arg — host config wins.
  • register() falls back to the callback arg when api.pluginConfig is absent.
  • register() tolerates both config sources being empty — defaults, no throw.
cd methods/EverCore/examples/openclaw-plugin
node --test test/register-config.test.js

Result: 3 passed.

Scope

Surgical: two files only — examples/openclaw-plugin/index.js and its new
regression test. Deliberately does not bundle the separate saveMemories
PersonalAddRequest envelope fix (issue #237) — that ships as its own PR so each
change stays reviewable in isolation.

Closes #150.

Credit

Original fix. Thanks to @keylimesoda for the precise #150 repro that pinpointed
the api.pluginConfig forwarding gap.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

🤖 Generated with Claude Code

…rMind-AI#150)

register() read plugin config only from the factory-callback argument, but
current OpenClaw hosts deliver config via api.pluginConfig (see EverMind-AI#150's repro).
On those hosts the engine booted with empty config and silently fell back to
default serverUrl / userId. Prefer the host-provided api.pluginConfig and fall
back to the callback arg so config forwarding works on both host generations;
the `?? {}` tail keeps resolveConfig() from throwing when both sources are
absent.

Adds test/register-config.test.js (node --test, offline) proving api.pluginConfig
wins over the callback arg, the callback path is used when api.pluginConfig is
absent, and empty/undefined config falls back to defaults without throwing.

Scope: index.js + its regression test only. Does not bundle the separate
saveMemories PersonalAddRequest envelope fix (EverMind-AI#237), which ships as its own PR.

Closes EverMind-AI#150.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 3, 2026 05:54
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] OpenClaw plugin: factory callback receives no config — api.pluginConfig not forwarded

2 participants