fix: avoid config rewrites for plugin record updates#100005
fix: avoid config rewrites for plugin record updates#100005qingminglong wants to merge 6 commits into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 6, 2026, 2:28 PM ET / 18:28 UTC. Summary PR surface: Source +125, Tests +367. Total +492 across 5 files. Reproducibility: yes. at source level: current main routes changed plugin install records through Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Land this current-main-compatible fix or an equivalent consolidated branch after maintainer acceptance of the records-only persistence boundary, then close the linked issue and supersede the other candidate PR. Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main routes changed plugin install records through Is this the best way to solve the issue? Yes. The narrow maintainable fix is to skip AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f859d78b6126. Label changesLabel justifications:
Evidence reviewedPR surface: Source +125, Tests +367. Total +492 across 5 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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
Review history (4 earlier review cycles)
|
|
@clawsweeper re-review I updated the PR body Evidence for current head |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper automerge |
Fixes #98419
What Problem This Solves
Fixes an issue where users following
gateway status --deepplugin drift hints after a core upgrade could haveopenclaw plugins update <exact official npm spec>fail at the config write step even though the only durable change was an installed-plugin index record.The reported Windows upgrade path downloaded
@openclaw/brave-plugin@2026.6.11, then attempted to replace a larger user-authoredopenclaw.jsonwith a smaller projected config, triggering the size-drop guard and leaving official plugin drift unresolved.This branch carries the records-only update fix onto current
upstream/mainand keeps the scope to install-record-only plugin updates. It does not change legacyplugins.installscleanup, hook updates, or plugin id migration paths that genuinely mutate authored config.Why This Change Was Made
plugins updatenow compares the projected next source config with the mutation-start source config after plugin install records have been stripped. If the source config is unchanged, the command commits only the persisted plugin install index and skipsreplaceConfigFile(...)entirely. Existing config-writing behavior remains in place when legacy plugin install records need to be removed from config or when hook/config state actually changes.The records-only path preserves the safety barriers from the config-writing path: before the records-only commit is allowed to complete, it rereads the writable config snapshot and rejects stale root config hashes, config path changes, included-file target changes, included-file hash changes, and plugin-aware config validation failures after the new install record is visible. The check runs through the existing install-record commit rollback path, so a stale config race or incompatible plugin metadata restores the previous install index.
Because records-only updates intentionally preserve the authored config bytes, the command touches the config file mtime after a successful records-only commit so external running gateways still receive a watcher event. The gateway reload path clears the install-record cache before reload reads and does not discard same-hash watcher events until it has checked whether persisted plugin install records changed.
User Impact
Operators can repair official plugin version drift after upgrading OpenClaw without rewriting or shrinking their existing
openclaw.jsonwhen no config mutation is needed. Config size-drop protection still protects real risky writes, concurrent config edits fail closed, plugin updates that would make existing plugin config invalid roll back the install index, and running gateways see a restart-triggering plugin-index change instead of staying on the old plugin source.Evidence
Current head proved:
b1eedaa71a4a71647e903bd16de38c29f37f5c2a.Claim proved:
openclaw plugins update @openclaw/brave-plugin@2026.6.11.2026.6.11-beta.2to2026.6.11.Before evidence from the linked issue shows the Windows upgrade failure:
After-fix real CLI proof on this PR head, with local paths redacted:
Config preservation proof for that same update:
Persisted install-record proof after the update:
{ "source": "npm", "spec": "@openclaw/brave-plugin@2026.6.11", "version": "2026.6.11", "resolvedName": "@openclaw/brave-plugin", "resolvedVersion": "2026.6.11", "resolvedSpec": "@openclaw/brave-plugin@2026.6.11", "integrity": "sha512-FclcOH2g4E4Lt9fEViJgnjDRG4JVnG9yODjalj0/+qtMdCSKDWxlkrpS5kakDGzwhqy9+CiioczZQW0AtoWdOA==" }Source-level proof added here:
plugins update bravewhere only the persisted install record changes:replaceConfigFile(...)/writeConfigFile(...),plugins.installsmust be removed from authored config.Validation on this branch after merging current
upstream/main:Current PR checks at the same head include
Real behavior proof,check-lint, andcheck-test-typespassing.