fix(openclaw): forward plugin config via api.pluginConfig (closes #150)#243
Open
Fearvox wants to merge 1 commit into
Open
fix(openclaw): forward plugin config via api.pluginConfig (closes #150)#243Fearvox wants to merge 1 commit into
Fearvox wants to merge 1 commit into
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The OpenClaw plugin's
register()read plugin config only from thefactory-callback argument:
Current OpenClaw hosts deliver plugin config via
api.pluginConfig, not thecallback argument. On those hosts the callback arg is
undefined, so the enginebooted 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 thecallback arg so config forwarding works on both host generations:
Why
A passive context engine that boots with empty config silently uses defaults
(default
serverUrl, defaultuserId) instead of the host's configured values— memories get written under the wrong identity / endpoint with no error. The
?? {}tail also keepsresolveConfig()from throwing when both sources areabsent.
Tests
Adds
test/register-config.test.js(runs withnode --test, fully offline — astubbed
fetchmakes the resolvedserverUrlobservable via the engine's/healthbootstrap 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.jsResult: 3 passed.
Scope
Surgical: two files only —
examples/openclaw-plugin/index.jsand its newregression test. Deliberately does not bundle the separate
saveMemoriesPersonalAddRequest 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.pluginConfigforwarding gap.Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
🤖 Generated with Claude Code