Skip to content

fix(plugins): read mixed-case plugin policy from canonical lowercase entries - #180789

Merged
steipete merged 1 commit into
openclaw:mainfrom
anmol0b:fix/plugin-install-mixed-case-policy
Oct 23, 2026
Merged

steipete merged 1 commit into
openclaw:mainfrom
anmol0b:fix/plugin-install-mixed-case-policy

Conversation

@anmol0b

@anmol0b anmol0b commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #180071

What Problem This Solves

Reinstalling or updating a plugin whose manifest id is mixed case (for example MyPlug) ignored the settings stored under its canonical lowercase policy key (plugins.entries.myplug). The install printed "requires configuration first", wrote a second raw-case entry (MyPlug: { enabled: false }), and the loader, which resolves the lowercase key, then treated the plugin as disabled. A configured, enabled plugin ended up disabled after a reinstall.

Why This Change Was Made

#164683 moved the loader, config validation, and plugins enable/disable onto the normalized plugin id, but install persistence still looked up policy by the raw manifest id in four places. They now use the same normalizePluginId / normalizePluginsConfig identity:

  • plugin-config-enablement.ts: the required-settings check reads config from the canonical entry.
  • enable.ts prepareConfigForDisabledInstall: stages the disabled install through setPluginEnabledInConfig, the helper plugins disable uses. The entry lands on the canonical key and folds any aliases, keeping existing policy minus config.
  • install-persistence.ts: the denylist removal and the explicit-disable check compare canonical ids.

Lowercase ids are unaffected, because normalizePluginId returns them unchanged. This follows the approach in @yetval's closed #177672.

Accepted edge case (unchanged, as the issue proposes): configs already damaged by an affected build still carry a raw-case MyPlug: { enabled: false } alias. Nothing deletes it automatically, since it can't be told apart from a disable an operator wrote. openclaw plugins enable MyPlug collapses it.

User Impact

Reinstalling or updating a mixed-case plugin keeps its settings and enabled/disabled state, shows no false "requires configuration" warning, and writes no duplicate keys.

Evidence

Contributor-supplied regression and CLI evidence:

Regression tests: two new tests in src/plugins/install-persistence.test.ts. Both fail on main and pass with the fix:

  • A configured mixed-case reinstall stays enabled, an explicit lowercase enabled: false is preserved, and no duplicate key is written.
  • A mixed-case install with missing settings is staged disabled under the lowercase key, and its lowercase deny entry is cleared.

Tests and checks:

  • pnpm test src/plugins/install-persistence.test.ts src/plugins/enable.test.ts src/plugins/management-service.workspace-inventory.test.ts: passed.
  • src/auto-reply/reply/commands-plugins.install.test.ts: 18/18 passed.
  • Changed-file lint (oxlint), format, every core typecheck shard, and git diff --check pass.
  • The core test shard root budget check fails, but it fails on main too.

Real CLI (pnpm openclaw, isolated OPENCLAW_STATE_DIR/OPENCLAW_CONFIG_PATH). Two local plugins, MyPlug and OtherPlug, each with a configSchema requiring token. Settings are under the lowercase keys; MyPlug is enabled and OtherPlug disabled. Then both are reinstalled:

# BEFORE (main)
Installed plugin "MyPlug" without enabling it because it requires configuration first. ...
Installed plugin "OtherPlug" without enabling it because it requires configuration first. ...
plugins.entries: {"myplug":{"enabled":true,"config":{"token":"abc"}},"otherplug":{"enabled":false,"config":{"token":"xyz"}},"MyPlug":{"enabled":false},"OtherPlug":{"enabled":false}}
  MyPlug: disabled
  OtherPlug: disabled

# AFTER (this branch)
Installed plugin: MyPlug
Installed plugin: OtherPlug
plugins.entries: {"otherplug":{"enabled":false,"config":{"token":"xyz"}},"myplug":{"enabled":true,"config":{"token":"abc"}}}
  MyPlug: enabled
  OtherPlug: disabled

Upgrade from current stable [email protected], plus existing-data compatibility. Each scenario starts from a fresh isolated state seeded only with the published 2026.10.6 CLI:

  • MyPlug: installed, config set plugins.entries.myplug.config.token abc, then plugins enable MyPlug.
  • OtherPlug: installed, config set plugins.entries.otherplug.config.token xyz, then plugins disable OtherPlug.

The branch then runs doctor --fix --non-interactive and plugins install --force for both plugins. Effective status comes from plugins list --json.

# A. BEFORE: reinstall on 2026.10.6
Installed plugin "MyPlug" without enabling it because it requires configuration first. ...
Installed plugin "OtherPlug" without enabling it because it requires configuration first. ...
plugins.entries: {"myplug":{"enabled":true,"config":{"token":"abc"}},"otherplug":{"enabled":false,"config":{"token":"xyz"}},"MyPlug":{"enabled":false},"OtherPlug":{"enabled":false}}
status: MyPlug: disabled, OtherPlug: disabled

# B. UPGRADE: 2026.10.6 state -> this branch
existing data, read by the branch before any write:
plugins.entries: {"myplug":{"enabled":true,"config":{"token":"abc"}},"otherplug":{"enabled":false,"config":{"token":"xyz"}}}
Installed plugin: MyPlug
Installed plugin: OtherPlug
plugins.entries: {"otherplug":{"enabled":false,"config":{"token":"xyz"}},"myplug":{"enabled":true,"config":{"token":"abc"}}}
status: MyPlug: loaded, OtherPlug: disabled

# C. EXISTING DAMAGED DATA: state already reinstalled on 2026.10.6 (raw-case aliases) -> this branch
plugins.entries before: {"myplug":{"enabled":true,"config":{"token":"abc"}},"otherplug":{"enabled":false,"config":{"token":"xyz"}},"MyPlug":{"enabled":false},"OtherPlug":{"enabled":false}}
Installed plugin: MyPlug
Installed plugin: OtherPlug
plugins.entries after reinstall: unchanged (settings intact, no new keys)
$ openclaw plugins enable MyPlug   # documented recovery, collapses the alias
Installed plugin: MyPlug
Installed plugin: OtherPlug
plugins.entries: {"otherplug":{"enabled":false,"config":{"token":"xyz"}},"OtherPlug":{"enabled":false},"myplug":{"enabled":true,"config":{"token":"abc"}}}
status: MyPlug: loaded, OtherPlug: disabled

Both settings and both preferences survive the upgrade (B). Data already damaged by 2026.10.6 still loads, and reinstalls neither lose settings nor add keys (C). The leftover OtherPlug: {enabled:false} alias matches the canonical disabled preference and is left in place by design (see the accepted edge case above).

Doctor on 2026.10.6 state (pre-existing, unchanged by this PR). doctor --fix --non-interactive on this seeded state reports Plugin "myplug" data/settings upgrade is unfinished: The migration owner is unavailable, and plugins.entries.otherplug.config.token: invalid config: must have required property 'token' ("config fixes were not applied"). The branch parent f5a4d6157d, without this change, prints the identical output on the same seed. Current main (d85f1a04b5) prints the same migration warning. Doctor's migration code does not import any file this PR changes. Doctor keeps the data in every case, and the reinstalls above run after it.

Gaps:

  • The contributor reported an isolated review authentication failure; the maintainer review result is recorded below.
  • No credentials, IPs or endpoints appear above; tokens are placeholders.

Maintainer review

VERDICT: LAND-AS-IS at 1a9024b57c2a8e45897ebc501dcfcd026d533c6c. The contributor's patch and commit by @anmol0b are retained unchanged, including the credit to @yetval above. The simplification review found that the existing canonical policy and toggle owners provide the complete fix without new helpers or a migration.

Confirmed against fresh main b389baf8895b209dbc5252487bc672c0e0c45aba: the defect remains at plugin-config-enablement.ts:20, where MyPlug misses myplug.config, followed by raw-case disabled staging at enable.ts:29 and raw deny/disable checks at install-persistence.ts:63 and :346. The four changed files and their normalization/toggle owners match the PR parent. No conflict or material drift in this behavior requires a merge from main.

The first regression would fail on the base because valid lowercase settings are treated as missing and raw-case disabled entries are appended. The second would fail because staging writes MyPlug rather than myplug and misses the lowercase deny entry. These are source-confirmed expectations; the CLI and local execution results above are contributor-supplied, not rerun during this maintainer pass.

  • Required independent Codex autoreview: scoped-clean, no actionable P0–P2 findings; static review only.
  • Exact-head CI run 39815912925: success, including lint and type checks. PR rollup: 52 passed, 60 skipped, none failed or pending. git diff --check also passed.
  • Trusted-main dependency installation was attempted once and refused Node 26.12.0 because the project requires >=26.12.1 on that release line. Local tests, lint, formatting, and typechecks were skipped per maintainer host policy; CI supplies that proof. Contributor code was not executed locally. No new local test timing is claimed.
  • Live Gateway/channel e2e and remote leases were skipped per maintainer policy. Existing contributor CLI/upgrade evidence is retained above.
  • Latest ClawSweeper review of this exact head has no findings and cleared the earlier proof hold. No code change or additional re-review request is needed.

Exact diff: production +20/-20 (net 0), tests +43/-0, docs +0/-0; total +63/-20 across four files. Existing ambiguous disabled aliases remain an explicit-enable recovery case, not an automatic repair. No product decision is needed for this scoped fix. This pass leaves the PR ready and unmerged.

@clawsweeper

clawsweeper Bot commented Oct 22, 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. clawsweeper:intake:needs-environment 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. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Plugin installation now reads and writes mixed-case plugin policy through the existing canonical lowercase identity.

Example: Reinstall MyPlug with plugins.entries.myplug enabled and configured with token abc.

  • Before: Installation misses the settings, creates MyPlug: {enabled:false}, and disables the plugin.
  • After: Installation preserves the settings and enabled preference without creating a duplicate entry.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused contract repair with shipped CLI evidence, latest-stable compatibility coverage, green exact-head checks, and no actionable findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The supplied isolated pnpm openclaw output exercises the changed persistence owner through real local-plugin installation and reinstall, preserving enabled and disabled preferences and settings; the updated 2026.10.6 upgrade and existing-damaged-state traces resolve the previous review's proof request.
Patch quality 🦞 diamond lobster (5/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 missing configuration.
Reason: The change restores documented canonical identity behavior and preserves operator preferences without a new API, setting, or automatic repair policy.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current plugin reinstall bug with a focused change; no actionable defects remain, and the updated upgrade evidence resolves the previous proof blocker.

Priority: P2
Reviewed head: 1a9024b57c2a8e45897ebc501dcfcd026d533c6c

Before merge

None.

Findings

None.

Agent review details

How this fits together

Plugin installation combines discovered manifests with existing configuration, validates required settings, and publishes installation records and plugin policy for runtime loading.

flowchart LR
  A[Plugin install request] --> B[Manifest discovery]
  B --> C[Install persistence]
  D[Existing plugin configuration] --> E[Canonical policy helpers]
  E --> C
  C --> F[Configuration and install records]
  F --> G[Plugin runtime]
Loading

Technical review

Best possible solution:

Merge the focused canonical-policy fix while retaining explicit enablement as recovery for existing duplicate disable markers.

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

Current-main source shows MyPlug missing settings stored under myplug and staging a second disabled entry; the supplied CLI before/after output exercises that failure, without reviewer execution.

Is this the best way to solve the issue?

The patch restores the established identity contract at the shared persistence boundary, preserves explicit disablement, and uses existing owners without adding machinery.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source 0, Tests +43. Total +43 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 20 20 0
Tests 1 43 0 +43
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 63 20 +43

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #180071
Summary: This PR addresses the canonical report's remaining raw-ID policy lookups during installation.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Reinstallation can disable configured mixed-case plugins; the failure is limited to this plugin identity case and has an existing recovery command.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • 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-22T16:59:13.493Z sha 1a9024b :: needs real behavior proof before merge. :: none

Reviewed October 23, 2026, 12:28 AM ET / 04:28 UTC (Revision 2).

@anmol0b

anmol0b commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor 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. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 23, 2026
@steipete
steipete merged commit 5f63460 into openclaw:main Oct 23, 2026
161 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

@anmol0b
anmol0b deleted the fix/plugin-install-mixed-case-policy branch October 24, 2026 00:10
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 24, 2026
RomneyDa added a commit that referenced this pull request Oct 28, 2026
…entries (#180789)

(cherry picked from commit 5f63460)
Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 4ea9fbc28dd6fd5fbe226ca5602d089d87e3add3)
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: 🦞 diamond lobster Very strong PR readiness with only minor 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.

plugins: reinstalling a mixed-case plugin id ignores its lowercase-keyed settings and leaves it disabled

2 participants