Skip to content

fix(plugins): keep mixed-case plugin ids enabled on reinstall when settings use the lowercase policy key - #177672

Closed
yetval wants to merge 1 commit into
openclaw:mainfrom
yetval:fix/plugin-install-mixed-case-entry
Closed

yetval wants to merge 1 commit into
openclaw:mainfrom
yetval:fix/plugin-install-mixed-case-entry

Conversation

@yetval

@yetval yetval commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Reinstalling a plugin whose manifest id is mixed case (for example MyPlug) ignores settings stored under the documented lowercase policy key plugins.entries.myplug. openclaw plugins install reports that the plugin "requires configuration first", writes a second plugins.entries.MyPlug entry with enabled: false, and the loader (which resolves the lowercase key) then sees the plugin as disabled. A plugin that was enabled and configured ends up disabled after a reinstall or update.

Root cause

#164683 moved the loader, validation and enable/disable paths to the normalized (lowercase) plugin id, but install persistence still reads policy by the raw manifest id.

src/plugins/plugin-config-enablement.ts, before:

const entry = params.config.plugins?.entries?.[params.pluginId];
const hasConfig = isRecord(entry) && Object.hasOwn(entry, "config");

src/plugins/install-persistence.ts, before:

if (!Array.isArray(deny) || !deny.includes(pluginId)) {
...
const explicitlyDisabled = reconciledConfig.plugins?.entries?.[pluginId]?.enabled === false;

src/plugins/enable.ts prepareConfigForDisabledInstall, before:

const entry = config.plugins?.entries?.[pluginId];
...
[pluginId]: { ...policy, enabled: false },

With manifest id MyPlug and settings under myplug, the required-config check sees no config, so the install is staged disabled under a new MyPlug key, and the deny/explicit-disable lookups also miss the canonical entry.

Fix

Resolve every install-persistence policy lookup through the same normalized id the loader uses.

after:

const config = normalizePluginsConfig(params.config.plugins).entries[
  normalizePluginId(params.pluginId)
]?.config;
const policyId = normalizePluginId(pluginId);
if (!Array.isArray(deny) || !deny.some((id) => normalizePluginId(id) === policyId)) {
const resolvedId = normalizePluginId(normalizeChatChannelId(pluginId) ?? pluginId);
const next = setPluginEnabledInConfig(config, resolvedId, false, { updateChannelConfig: false });

prepareConfigForDisabledInstall now goes through setPluginEnabledInConfig, the same helper openclaw plugins disable uses, so a staged disabled install lands on the canonical lowercase key and keeps its existing policy (minus config).

Why this is the right boundary

Install persistence is the only remaining reader of plugins.entries that keys by the raw manifest id; the loader, config validation, and enable/disable already normalize. Fixing it here aligns install with the canonical identity rather than adding a second lookup. Lowercase ids are unaffected because normalizePluginId is the identity for them, and all existing install-persistence cases keep their behavior.

Verification

  • Added two regression cases in src/plugins/install-persistence.test.ts: a mixed-case id with settings under the lowercase key is enabled without a "requires configuration" warning and without a duplicate entry, and a mixed-case id with missing settings is staged disabled under the lowercase key with its deny entry cleared. Both fail on pristine main and pass with this patch.
  • Local lint, format, typecheck and test gates were not run on this machine; GitHub Actions runs them on this PR.

Upgrade and existing-data compatibility

The review asked for an upgrade from the current stable release with an existing mixed-case plugin, settings, and an explicit disabled preference. The proof below seeds state with the published [email protected] npm package only (install, config set, plugins enable, plugins disable), then points the built CLI from this branch at that same state directory with no edits in between.

  • No config migration is introduced. The patch only changes which key install persistence reads (normalizePluginId, the same normalizer the loader and plugins enable/disable already use since fix(plugins): resolve mixed-case plugin IDs through canonical identity #164683), so a config written by 2026.10.5 loads unchanged; plugins list on this branch reads it before any write.
  • Lowercase-keyed settings and an explicit enabled: false both survive a reinstall on this branch, and no extra key is written.
  • State already damaged by 2026.10.5 (a reinstall there writes a duplicate MyPlug: {enabled:false} next to the configured myplug entry) still loads on this branch with every setting intact. This branch deliberately does not auto-delete that raw-case enabled:false key on reinstall, because it is indistinguishable from an operator-authored disable; the existing openclaw plugins enable MyPlug collapses the alias and the plugin then stays enabled across reinstalls (shown below). If maintainers prefer an automatic repair, that is a policy call I would rather take as a follow-up than fold into this fix.

Real behavior proof

Behavior addressed: Reinstalling or updating a plugin whose manifest id is mixed case (MyPlug) ignored its settings stored under the canonical lowercase key, staged it disabled, and wrote a duplicate raw-case {enabled:false} entry. The review asked specifically for an upgrade from 2026.10.5 with existing settings and an explicit disabled preference.
Real environment tested: macOS, Node 26.9.0. BEFORE: the published [email protected] npm package (OpenClaw 2026.10.5 (1b58cb9)). AFTER: this PR head b0531df rebased on origin/main 34f6f1b, built to dist and run through the shipped node openclaw.mjs entry point (OpenClaw 2026.10.5 (b0531df)). Isolated OPENCLAW_STATE_DIR / OPENCLAW_CONFIG_PATH; two real local plugin directories with manifest ids MyPlug and OtherPlug, each with a configSchema requiring token. Placeholder tokens only, no credentials or endpoints.
Exact steps or command run after this patch: (1) With 2026.10.5 only: plugins install --force --accept-capabilities $TMP/src/myplug, config set plugins.entries.myplug.config.token abc, plugins enable MyPlug; same for OtherPlug with token xyz, then plugins disable OtherPlug. Archive that state dir. (2) BEFORE: restore it, reinstall both plugins with 2026.10.5. (3) AFTER (upgrade): restore the same archived 2026.10.5 state, run plugins list, reinstall both plugins with this branch, print plugins.entries, run plugins list. (4) Existing-damaged-data: restore the state left by step (2), run the same commands on this branch, then plugins enable MyPlug and one more reinstall.
Evidence after fix:

# (1) state written by openclaw 2026.10.5
{"myplug":{"enabled":true,"config":{"token":"abc"}},"otherplug":{"enabled":false,"config":{"token":"xyz"}}}
│ MyPlug                        │                   │ openclaw │ enabled  │ global:MyPlug/index.js         │ 1.0.0     │
│ OtherPlug                     │                   │ openclaw │ disabled │ global:OtherPlug/index.js      │ 1.0.0     │

# (2) BEFORE: reinstall on 2026.10.5
$ openclaw --version
OpenClaw 2026.10.5 (1b58cb9)
$ openclaw plugins install --force --accept-capabilities $TMP/src/myplug
Plugin manifest id "MyPlug" differs from npm package name "myplug"; using manifest id as the config key.
Installing to $TMP/stable-state/extensions/MyPlug…
Config warnings: plugins.entries.myplug: plugin disabled (disabled in config) but config is present; plugins.entries.otherplug: plugin disabled (disabled in config) but config is present
Installed plugin "MyPlug" without enabling it because it requires configuration first. Configure it, then run `openclaw plugins enable MyPlug`.
Installed plugin: MyPlug
$ openclaw plugins install --force --accept-capabilities $TMP/src/otherplug
Installed plugin "OtherPlug" without enabling it because it requires configuration first. Configure it, then run `openclaw plugins enable OtherPlug`.
Installed plugin: OtherPlug
# plugins.entries in $TMP/stable-state/openclaw.json
{"myplug":{"enabled":true,"config":{"token":"abc"}},"otherplug":{"enabled":false,"config":{"token":"xyz"}},"MyPlug":{"enabled":false},"OtherPlug":{"enabled":false}}
$ openclaw plugins list
│ MyPlug                        │                   │ openclaw │ disabled │ global:MyPlug/index.js         │ 1.0.0     │
│ OtherPlug                     │                   │ openclaw │ disabled │ global:OtherPlug/index.js      │ 1.0.0     │

# (3) AFTER: same 2026.10.5 state, upgraded to this branch
$ openclaw --version
OpenClaw 2026.10.5 (b0531df)
$ openclaw plugins list
│ MyPlug                      │                        │ openclaw │ enabled  │ global:MyPlug/index.js      │ 1.0.0     │
│ OtherPlug                   │                        │ openclaw │ disabled │ global:OtherPlug/index.js   │ 1.0.0     │
$ openclaw plugins install --force --accept-capabilities $TMP/src/myplug
Plugin manifest id "MyPlug" differs from npm package name "myplug"; using manifest id as the config key.
Installing to $TMP/stable-state/extensions/MyPlug…
Config warnings: plugins.entries.otherplug: plugin disabled (disabled in config) but config is present
Installed plugin: MyPlug
Saved for the next Gateway start.
$ openclaw plugins install --force --accept-capabilities $TMP/src/otherplug
Plugin manifest id "OtherPlug" differs from npm package name "otherplug"; using manifest id as the config key.
Installing to $TMP/stable-state/extensions/OtherPlug…
Config warnings: plugins.entries.otherplug: plugin disabled (disabled in config) but config is present
Installed plugin: OtherPlug
Saved for the next Gateway start.
# plugins.entries in $TMP/stable-state/openclaw.json
{"otherplug":{"enabled":false,"config":{"token":"xyz"}},"myplug":{"enabled":true,"config":{"token":"abc"}}}
$ openclaw plugins list
│ MyPlug                      │                        │ openclaw │ enabled  │ global:MyPlug/index.js      │ 1.0.0     │
│ OtherPlug                   │                        │ openclaw │ disabled │ global:OtherPlug/index.js   │ 1.0.0     │

# (4) state already damaged by 2026.10.5, loaded on this branch
# plugins.entries before
{"myplug":{"enabled":true,"config":{"token":"abc"}},"otherplug":{"enabled":false,"config":{"token":"xyz"}},"MyPlug":{"enabled":false},"OtherPlug":{"enabled":false}}
$ openclaw plugins install --force --accept-capabilities $TMP/src/myplug
Installed plugin: MyPlug
$ openclaw plugins install --force --accept-capabilities $TMP/src/otherplug
Installed plugin: OtherPlug
# plugins.entries after (unchanged, no further duplicates, settings intact)
{"myplug":{"enabled":true,"config":{"token":"abc"}},"otherplug":{"enabled":false,"config":{"token":"xyz"}},"MyPlug":{"enabled":false},"OtherPlug":{"enabled":false}}
$ openclaw plugins enable MyPlug
Enabled plugin "MyPlug". Saved for the next Gateway start.
# plugins.entries
{"otherplug":{"enabled":false,"config":{"token":"xyz"}},"OtherPlug":{"enabled":false},"myplug":{"enabled":true,"config":{"token":"abc"}}}
$ openclaw plugins install --force --accept-capabilities $TMP/src/myplug
Installed plugin: MyPlug
# plugins.entries
{"otherplug":{"enabled":false,"config":{"token":"xyz"}},"OtherPlug":{"enabled":false},"myplug":{"enabled":true,"config":{"token":"abc"}}}
$ openclaw plugins list
│ MyPlug                      │                        │ openclaw │ enabled  │ global:MyPlug/index.js      │ 1.0.0     │
│ OtherPlug                   │                        │ openclaw │ disabled │ global:OtherPlug/index.js   │ 1.0.0     │

Observed result after fix: Upgrading a 2026.10.5 state to this branch and reinstalling keeps MyPlug enabled with token: abc and keeps the operator-disabled OtherPlug disabled with token: xyz; no "requires configuration first" message and no duplicate raw-case entry is written. The same reinstall on 2026.10.5 disables both and writes MyPlug/OtherPlug {enabled:false} duplicates. State already damaged by 2026.10.5 loads on this branch with all settings intact, is not damaged further by reinstall, and plugins enable MyPlug restores it so it stays enabled across the next reinstall.
What was not tested: npm or ClawHub registry installs (same persistence path, different fetch source); a running Gateway picking up the plugins after restart.

@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 19, 2026
@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

The PR makes plugin install persistence use canonical lowercase policy keys for settings, disablement, and denylist handling.

Example: Reinstall MyPlug with plugins.entries.myplug containing enabled: true and config.token: abc.

  • Before: Installation reports missing configuration and writes MyPlug: {enabled:false}, disabling the configured plugin.
  • After: Installation preserves myplug's settings and enabled state without creating a duplicate entry.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused contract repair with relevant shipped-CLI upgrade proof and no actionable findings; broad exact-head validation is still pending.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The complete PR-body terminal trace exercises the built shipped CLI at b0531df on macOS with isolated local MyPlug and OtherPlug installations, using state created by published 2026.10.5 commands; reinstall preserves configured enablement and explicit disablement, and damaged duplicate-key state retains settings and recovers through the existing enable command.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Reinstalling a configured mixed-case plugin unexpectedly disables it and reports that configuration is missing.
Reason: The change restores the documented lowercase policy-key contract without adding options, public APIs, or automatic deletion of ambiguous disabled preferences.

Merge readiness

✅ Ready for maintainer review

Keep this PR: it fixes a source-confirmed plugin reinstall bug with a focused change and no actionable findings; exact-head CI remains pending.

Priority: P2
Reviewed head: b0531dfe4e841ca7194d47007bb557a4abb14092

Before merge

None.

Findings

None.

Agent review details

How this fits together

Plugin installation combines discovered manifests with existing operator policy, then commits plugin records and configuration for inventory and runtime activation.

flowchart TD
  A[Plugin install request] --> B[Manifest discovery]
  B --> C[Install persistence]
  D[Existing plugin policy] --> E[Canonical policy helpers]
  E --> C
  C --> F[Config and install record commit]
  F --> G[Inventory and runtime activation]
Loading

Technical review

Best possible solution:

Use the existing canonical policy helpers throughout install persistence while preserving settings, explicit disablement, and setup-required staging.

Do we have a high-confidence way to reproduce the issue?

Main's raw-ID reads establish the failure path, and the contributor supplies matching before/after shipped-CLI output; no target code was executed during this review.

Is this the best way to solve the issue?

The patch is the smallest complete repair: canonicalize existing policy reads and reuse the toggle owner rather than introducing fallback lookups or another identity mechanism.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 34f6f1ba01ce.

Provenance checked

  • Required-configuration classification keeps the original intent (fix(plugins): serialize lifecycle mutations and preserve setup-required installs #112763: Install setup-required plugins disabled, distinguish absent settings from invalid authored settings, and preserve operator policy.)
  • Shared configuration enablement reader keeps the original intent (b988ce9: Share manifest-based setup classification with the Plugins workspace rather than maintaining separate decisions.)
  • Disabled-install preparation keeps the original intent (refactor(plugins): share disabled install preparation #141358: Use one preparation helper for bundled and persisted installs, removing config only when staging setup-required plugins while retaining other policy.)
  • Per-child explicit disablement keeps the original intent (5a643e3: Keep runtime children independently addressable for policy while the package remains the installation owner.)
  • Denylist reconciliation keeps the original intent (6bc5fe6: Reconcile installation policy within the existing plugin install transaction.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +5, Tests +32. Total +37 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 20 15 +5
Tests 1 32 0 +32
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 52 15 +37

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Reinstallation can disable configured mixed-case plugins; the affected workflow is bounded and has an existing enable-command recovery.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-19T20:10:03.450Z sha 05e3336a65c28f1c93c02b03d3137234fbd77f68 :: needs real behavior proof before merge. :: none

Reviewed October 19, 2026, 4:59 PM ET / 20:59 UTC (Revision 2).

…ttings use the lowercase policy key

Reinstalling a plugin whose manifest id is mixed case (for example MyPlug)
ignored settings stored under the documented lowercase policy key
(plugins.entries.myplug), reported that the plugin requires configuration
first, and wrote a second MyPlug entry with enabled false that disabled it.

Install persistence looked up plugins.entries, the explicit disable flag and
plugins.deny by the raw manifest id. Resolve them through the normalized
plugin id the loader and enable/disable already use, and stage disabled
installs under the canonical lowercase key.
@yetval
yetval force-pushed the fix/plugin-install-mixed-case-entry branch from 05e3336 to b0531df Compare October 19, 2026 20:53
@yetval

yetval commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main 34f6f1b; head is now b0531df (no code change beyond the rebase). Both Before-merge items addressed in the PR body:

  • Add real behavior proof (upgrade trace): state is now seeded only with the published [email protected] package (install, config set, plugins enable, plugins disable), then the built CLI from this head (node openclaw.mjs) runs against that same state dir. Reinstall keeps MyPlug enabled with its settings and keeps the operator-disabled OtherPlug disabled with its settings; the same reinstall on 2026.10.5 disables both and writes raw-case duplicates. Placeholder tokens only, paths redacted to $TMP.
  • Add data-model compatibility proof: no migration is introduced; the 2026.10.5 config loads unchanged (plugins list before any write). State already damaged by 2026.10.5 also loads with settings intact and is not damaged further. The leftover raw-case MyPlug: {enabled:false} is intentionally not auto-removed on reinstall because it cannot be told apart from an operator disable; openclaw plugins enable MyPlug collapses it and the plugin stays enabled across the next reinstall (shown). If maintainers want automatic repair, I would take that as a separate policy follow-up.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 19, 2026
@yetval

yetval commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favor of tracking this as an issue: #180071

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

Labels

P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant