Repository navigation
fix(plugins): read mixed-case plugin policy from canonical lowercase entries - #180789
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesPlugin 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.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete 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 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherPlugin 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]
Technical reviewBest 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
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource 0, Tests +43. Total +43 across 4 files. Added test files: 0. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 23, 2026, 12:28 AM ET / 04:28 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…entries (#180789) (cherry picked from commit 5f63460) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 4ea9fbc28dd6fd5fbe226ca5602d089d87e3add3)
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/disableonto the normalized plugin id, but install persistence still looked up policy by the raw manifest id in four places. They now use the samenormalizePluginId/normalizePluginsConfigidentity:plugin-config-enablement.ts: the required-settings check readsconfigfrom the canonical entry.enable.tsprepareConfigForDisabledInstall: stages the disabled install throughsetPluginEnabledInConfig, the helperplugins disableuses. The entry lands on the canonical key and folds any aliases, keeping existing policy minusconfig.install-persistence.ts: the denylist removal and the explicit-disable check compare canonical ids.Lowercase ids are unaffected, because
normalizePluginIdreturns 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 MyPlugcollapses 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 onmainand pass with the fix:enabled: falseis preserved, and no duplicate key is written.denyentry 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.git diff --checkpass.maintoo.Real CLI (
pnpm openclaw, isolatedOPENCLAW_STATE_DIR/OPENCLAW_CONFIG_PATH). Two local plugins,MyPlugandOtherPlug, each with a configSchema requiringtoken. Settings are under the lowercase keys; MyPlug is enabled and OtherPlug disabled. Then both are reinstalled: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, thenplugins enable MyPlug.OtherPlug: installed,config set plugins.entries.otherplug.config.token xyz, thenplugins disable OtherPlug.The branch then runs
doctor --fix --non-interactiveandplugins install --forcefor both plugins. Effective status comes fromplugins list --json.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-interactiveon this seeded state reportsPlugin "myplug" data/settings upgrade is unfinished: The migration owner is unavailable, andplugins.entries.otherplug.config.token: invalid config: must have required property 'token'("config fixes were not applied"). The branch parentf5a4d6157d, without this change, prints the identical output on the same seed. Currentmain(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:
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 atplugin-config-enablement.ts:20, whereMyPlugmissesmyplug.config, followed by raw-case disabled staging atenable.ts:29and raw deny/disable checks atinstall-persistence.ts:63and: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
MyPlugrather thanmyplugand 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.git diff --checkalso passed.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.