Skip to content

fix: plugins update rewrites config for install-record-only updates - #98422

Merged
steipete merged 6 commits into
openclaw:mainfrom
ooiuuii:fix/plugin-update-config-sizedrop
Jul 17, 2026
Merged

steipete merged 6 commits into
openclaw:mainfrom
ooiuuii:fix/plugin-update-config-sizedrop

Conversation

@ooiuuii

@ooiuuii ooiuuii commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #98419

What Problem This Solves

After a core upgrade, openclaw plugins update <exact official npm spec> could reject an update at the config-write step even when the only durable change was an installed-plugin index record. On Windows 11 with OpenClaw 2026.6.11, updating Brave from the beta package to the matching stable package downloaded successfully, then tried to replace a larger user-authored openclaw.json with a smaller projected config. The size-drop guard correctly rejected that unrelated rewrite and left plugin drift unresolved.

This PR is limited to install-record-only plugin updates. Legacy plugins.installs cleanup, hook updates, and plugin-id migrations still use the existing config-writing path when they genuinely change authored config.

Why This Change Was Made

plugins update compares the projected source config, after stripping persisted install records, with the mutation-start source config. When those shapes are equal, it commits only the SQLite installed-plugin index and leaves openclaw.json byte-identical.

The records-only commit keeps the existing safety barriers:

  • reread and verify the root config hash and owned config path;
  • verify included-file targets and hashes;
  • run plugin-aware config validation while the new record is visible;
  • restore the previous installed-plugin index on any failure;
  • skip registry and Gateway refresh after rollback.

A successful records-only update sends an authenticated internal plugins.refresh RPC to the configured local Gateway. The Gateway clears the installed-index cache and same-config echo tokens, rereads the unchanged config plus fresh SQLite metadata, then uses the existing reload planner. This replaces the earlier artificial config mtime touch: there is no config rewrite, no config utimes, and no watcher on the shared SQLite database.

If no Gateway is running, or the running Gateway predates plugins.refresh, the durable update still succeeds and the existing restart instruction remains the recovery path.

User Impact

Operators can repair official plugin version drift without rewriting or shrinking unrelated config. Size-drop protection remains intact. Concurrent root/include edits and newly invalid plugin config still fail closed and roll back the index. A running current Gateway receives the metadata change even though config bytes and hash remain unchanged.

Evidence

Real Windows 11 before evidence from an upgrade to [email protected]:

$ openclaw gateway status --deep
Connectivity probe: ok
Plugin version drift: 4 active official plugins not on gateway 2026.6.11
- brave: 2026.6.11-beta.2 (npm) -> expected 2026.6.11

$ openclaw plugins update @openclaw/[email protected]
Installed @openclaw/[email protected] into <managed npm project>
Config write rejected: C:\Users\Administrator\.openclaw\openclaw.json (size-drop:40696->14568).

Real after-fix CLI proof from this branch, using an isolated temporary Windows home/state/config:

$ node --import tsx src/entry.ts plugins update @openclaw/[email protected]
Updated brave: 2026.6.11-beta.2 -> 2026.6.11.
Restart the gateway to load plugins and hooks.

config before: SHA-256 ED9A9930DD5B22E1E0AC549C57DF76DB0F8DDF1C6F88EA392B0206EC73825ED1, 199 bytes
config after:  SHA-256 ED9A9930DD5B22E1E0AC549C57DF76DB0F8DDF1C6F88EA392B0206EC73825ED1, 199 bytes
installed index: brave resolvedVersion 2026.6.11
exit status: 0

Regression coverage now proves:

  • records-only success updates the persisted index without config write/replace;
  • split source/runtime config uses resolved local Gateway port/auth for the refresh signal;
  • root-config, include-target/hash, and plugin-validation races roll back the index;
  • plugins.refresh is an operator.admin control-plane method with strict empty params;
  • explicit metadata refresh bypasses identical-config hash dedupe, rereads install records, and plans restart for plugins.installs.<id>;
  • offline/older Gateway signaling remains best-effort after durable commit.

Maintainer validation:

node scripts/run-vitest.mjs <six focused plugin/protocol/reloader test files>
# 196 passed

node scripts/run-vitest.mjs <CLI signal/update and request-context test files>
# 47 passed

node scripts/check-changed.mjs -- <21 touched files>
# full core/coreTests gate passed on Testbox tbx_01kxpxcvjq71x2p7rb0pgsbm19
# https://github.com/openclaw/openclaw/actions/runs/29549258290

git diff --check
# passed

.agents/skills/autoreview/scripts/autoreview --mode uncommitted
# clean; no accepted/actionable findings

No CHANGELOG.md edit; contributor release-note context is preserved here and in the squash message.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: S labels Jul 1, 2026
@clawsweeper

clawsweeper Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 17, 2026, 12:30 AM ET / 04:30 UTC.

Summary
The PR adds an atomic install-record-only plugin update path that preserves authored config bytes, then notifies a running local Gateway through a new authenticated plugins.refresh method and shared reload planning.

PR surface: Source +198, Tests +431, Other +17. Total +646 across 25 files.

Reproducibility: no. current-main runtime reproduction was executed in this read-only review, but the source path and supplied Windows before transcript establish a high-confidence source reproduction of the unnecessary config replacement.

Review metrics: 3 noteworthy metrics.

  • Gateway API surface: 1 internal operator.admin method added. The new protocol method spans server registration, generated native clients, validation, authorization, and compatibility with older running Gateways.
  • Config/default surfaces: 0 user config keys or defaults added. The compatibility impact comes from persistence behavior rather than introducing another operator setting.
  • Persistence behavior: 1 records-only commit path added. The new path intentionally changes when plugin updates may replace user-authored config and therefore needs upgrade and rollback confidence.

Stored data model
Persistent data-model change detected: serialized state: src/gateway/server-methods/plugins.test.ts, vector/embedding metadata: packages/gateway-protocol/src/plugins-validators.test.ts, vector/embedding metadata: src/gateway/config-reload.test.ts, vector/embedding metadata: src/gateway/server-methods/plugins.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #98419
Summary: This PR is the active candidate fix for the canonical install-record-only config rewrite issue; the closed alternative PR is not a viable replacement landing path.

Members:

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

Merge readiness
Overall: 🦐 gold shrimp
Proof: 🦐 gold shrimp
Patch quality: 🐚 platinum hermit
Result: blocked until stronger real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add current-head live output from a running isolated Gateway showing plugins.refresh admission and the resulting plugin metadata restart plan.
  • Rebase or refresh the branch against current main and rerun the relevant protocol, plugin update, reload, and native-client checks.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The isolated Windows terminal proof convincingly shows config preservation and index advancement, but not the current-head running-Gateway plugins.refresh behavior. Add redacted terminal or Gateway logs showing that path—removing IPs, tokens, phone numbers, private endpoints, and similar details—then update the PR body to trigger review or ask a maintainer to comment @clawsweeper re-review.

Risk before merge

  • [P1] The current-head plugins.refresh route, local port/auth selection, method negotiation, cache invalidation, and restart planning have test coverage but no demonstrated after-fix run with a real running Gateway.
  • [P1] A defect in the source-config equality or freshness boundary could skip a required authored-config write or leave the SQLite install index inconsistent with config after an upgrade race.
  • [P1] The branch is behind current main; rebase or refreshed merge-result review could expose conflicts in the fast-moving Gateway protocol and reload surfaces.

Maintainer options:

  1. Prove the running-Gateway path (recommended)
    Add redacted current-head terminal or Gateway logs showing an update signals plugins.refresh, refreshes persisted metadata, and reaches the expected restart plan before merge.
  2. Accept tests as an explicit proof override
    A maintainer may intentionally accept the focused tests and CLI proof without live Gateway evidence, owning the remaining upgrade-path uncertainty.

Next step before merge

  • [P1] Request or independently verify current-head running-Gateway proof, then refresh the review after bringing the branch up to current main; no narrow automated code repair is identified.

Security
Cleared: The diff adds no dependency or supply-chain surface, and the new strict-empty refresh method remains behind authenticated operator.admin authorization.

Review details

Best possible solution:

Land a rebased version that keeps authored config byte-identical for true install-record-only updates, preserves atomic validation and rollback, and demonstrates the authenticated current-head Gateway refresh and restart-planning path in a real isolated setup.

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

No current-main runtime reproduction was executed in this read-only review, but the source path and supplied Windows before transcript establish a high-confidence source reproduction of the unnecessary config replacement.

Is this the best way to solve the issue?

Yes, the records-only commit boundary is the narrowest maintainable fix because it preserves existing config writes for real authored-config changes; the remaining deficiency is proof of the newly added live Gateway refresh path, not an identified alternative design.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against a0fac37f141e.

Label changes

Label justifications:

  • P2: This fixes a bounded plugin drift-repair failure with preserved config data and no evidence of a core outage or emergency.
  • merge-risk: 🚨 compatibility: The PR changes upgrade-time plugin persistence and Gateway refresh behavior, where an incorrect boundary could break existing config or leave plugin metadata stale.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The isolated Windows terminal proof convincingly shows config preservation and index advancement, but not the current-head running-Gateway plugins.refresh behavior. Add redacted terminal or Gateway logs showing that path—removing IPs, tokens, phone numbers, private endpoints, and similar details—then update the PR body to trigger review or ask a maintainer to comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +198, Tests +431, Other +17. Total +646 across 25 files.

View PR surface stats
Area Files Added Removed Net
Source 16 215 17 +198
Tests 7 442 11 +431
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 17 0 +17
Total 25 674 28 +646

What I checked:

  • Records-only persistence: The branch adds a dedicated install-record commit helper that reuses the existing rollback writer without replacing the user-authored config. (src/plugins/install-record-commit.ts:350, a8e065e825f1)
  • Update boundary: The update command compares projected and mutation-start source config, retains normal config writes for actual authored-config changes, and uses the records-only path only when those source shapes are equal. (src/cli/plugins-update-command.ts:416, a8e065e825f1)
  • New Gateway signal: The branch sends a local-only plugins.refresh call with strict empty parameters, operator.admin scope, configured local port resolution, and best-effort fallback for offline or older Gateways. (src/cli/plugins-update-gateway-signal.ts:12, a8e065e825f1)
  • Gateway reload integration: The new handler schedules the existing config-reload planner after clearing plugin-index and same-config echo caches, allowing unchanged config bytes to be compared against fresh SQLite metadata. (src/gateway/config-reload.ts:973, a8e065e825f1)
  • Protocol boundary: The new method is registered as an authenticated operator.admin control-plane write with closed empty parameters and a literal successful result. (src/gateway/methods/core-descriptors.ts:308, a8e065e825f1)
  • Regression coverage: Tests cover config preservation, root/include freshness conflicts, plugin-aware validation rollback, local Gateway routing, strict protocol validation, and restart planning from refreshed install records. (src/cli/plugins-cli.update.test.ts, a8e065e825f1)

Likely related people:

  • steipete: Self-assigned the PR, force-pushed its current head, authored the Gateway refresh and generated-client commits, and previously carried official plugin install-record work. (role: recent feature carrier and assignee; confidence: high; commits: f7ea11927b1b, 1b3e0f2ab381, a8e065e825f1; files: src/gateway/config-reload.ts, src/gateway/server-methods/plugins.ts, src/cli/plugins-update-command.ts)
  • ooiuuii: Authored the original records-only implementation and previously contributed merged managed-npm plugin update work, giving them relevant history beyond opening this PR. (role: plugin update feature contributor; confidence: high; commits: 1d36f2c196f9, 11d5e6ef7edc, 75bba12fd723; files: src/cli/plugins-update-command.ts, src/plugins/install-record-commit.ts, src/cli/plugins-cli.update.test.ts)
  • vincentkoc: Recent merged history connects them to managed npm generations and install-record commit rollback behavior used by this fix. (role: recent adjacent plugin update contributor; confidence: medium; commits: 12320908822d, fbf0b1b14766, cd731fb63eb4; files: src/plugins/install-record-commit.ts, src/plugins/managed-npm-retention.ts, src/plugins/update.ts)
  • zhuisDEV: Authored the merged exact official npm install-record work that established the behavior this PR now repairs. (role: original install-record feature contributor; confidence: medium; commits: eb2878070575, 9f63e5820ee2, e0773e18de66; files: src/plugins/update.ts, src/plugins/installs.ts, src/commands/doctor-state-migrations.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (2 earlier review cycles)
  • reviewed 2026-07-03T03:44:12.916Z sha d7d22cc :: needs maintainer review before merge. :: none
  • reviewed 2026-07-17T03:48:22.147Z sha a8e065e :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 1, 2026
@ooiuuii

ooiuuii commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Freshness rollback fix and after-fix isolated CLI proof were added in 24bdd18d73; the PR body now includes the real update output and validation commands.

@clawsweeper

clawsweeper Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@ooiuuii
ooiuuii force-pushed the fix/plugin-update-config-sizedrop branch from 24bdd18 to e007cb6 Compare July 1, 2026 07:00
@clawsweeper clawsweeper Bot removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 1, 2026
@steipete steipete self-assigned this Jul 1, 2026
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: L and removed size: M labels Jul 1, 2026
@ooiuuii

ooiuuii commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The branch is now at d7d22cc with the records-only update rollback fixes, gateway watcher/reload fixes, full after-fix proof in the PR body, passing local proof policy, and clean local autoreview recorded in the Evidence section.

@clawsweeper

clawsweeper Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@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: 🔁 re-review loop A fresh ClawSweeper review was explicitly requested after the latest review. 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: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 🔁 re-review loop A fresh ClawSweeper review was explicitly requested after the latest review. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Jul 1, 2026
@clawsweeper clawsweeper Bot added the status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. label Jul 3, 2026
@steipete
steipete force-pushed the fix/plugin-update-config-sizedrop branch from d7d22cc to 0c11206 Compare July 17, 2026 02:31
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui app: android App: android labels Jul 17, 2026
@steipete
steipete force-pushed the fix/plugin-update-config-sizedrop branch 5 times, most recently from 2b03942 to fa3792f Compare July 17, 2026 03:33
@steipete
steipete force-pushed the fix/plugin-update-config-sizedrop branch from fa3792f to a8e065e Compare July 17, 2026 03:42
@clawsweeper clawsweeper Bot added 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 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. labels Jul 17, 2026
@steipete
steipete merged commit 7641aa8 into openclaw:main Jul 17, 2026
143 of 155 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 17, 2026
…penclaw#98422)

* Avoid config rewrites for plugin index updates

* Preserve config freshness for records-only plugin updates

* Validate records-only plugin update config

* fix(plugins): reload index-only updates

Co-authored-by: luyifan <[email protected]>

* chore(protocol): refresh generated clients

Co-authored-by: luyifan <[email protected]>

* fix(gateway): wire plugin refresh handler

---------

Co-authored-by: Peter Steinberger <[email protected]>
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
…penclaw#98422)

* Avoid config rewrites for plugin index updates

* Preserve config freshness for records-only plugin updates

* Validate records-only plugin update config

* fix(plugins): reload index-only updates

Co-authored-by: luyifan <[email protected]>

* chore(protocol): refresh generated clients

Co-authored-by: luyifan <[email protected]>

* fix(gateway): wire plugin refresh handler

---------

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: android App: android app: web-ui App: web-ui cli CLI command changes gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

plugins update rewrites config for install-record-only updates

2 participants