Skip to content

fix: preserve listener settings when plugins update - #160682

Merged
steipete merged 2 commits into
mainfrom
codex/plugin-update-doctor-migrations
Sep 28, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/plugin-update-doctor-migrations

Conversation

@steipete

@steipete steipete commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Related: #160455

What Problem This Solves

Fixes plugin updates that install a new package but leave its settings migration pending, causing the next Gateway generation to use defaults instead of the operator’s existing listener settings.

User Impact

plugins update and replacement installs finish supported plugin-owned config repairs before applying the new generation. An unchanged package can also finish a pending repair. Disabled plugins and unrelated or failed updates retain their pending inputs. Data migrations still require openclaw doctor --fix; unresolved active migrations fail before config publication or refresh.

The already-published updater remains immutable: an older driver that rejects config before reaching candidate code still requires the supported core-update-first sequence. If config publication cannot be confirmed rolled back, the matching package remains installed and the command reports the failure instead of claiming activation succeeded.

Why This Change Was Made

The update lifecycle recorded package changes without invoking the selected plugin’s Doctor config contract. This change reuses that contract and the existing lifecycle, publication, and compensation owners. Pending obligations complete with synchronous file publication and return with an actual file rollback. Generation checks protect newer pending facts and package records. Partial updates still apply successfully committed siblings before reporting another update’s failure.

Evidence

The real-command regression fails on the original source with the legacy listener setting still present. The repaired entry-point suite covers 36 cases, including changed and unchanged packages, replacement installs, includes, environment references, disabled owners, partial success, broken or unrelated Doctor surfaces, state work, publication failures, revoked authority, and newer generations. Package transport and Gateway RPC are fixtures; config files, installed records, pending SQLite state, and selected Doctor artifacts use the real owners. Separate failing controls demonstrated lost rollback obligations and package/config divergence after accepted publication errors before those repairs.

The full integrated build passed in 19m 30.4s on 8e9972a57269, including plugin Doctor closures, 158 public SDK subpaths, CLI bootstrap and package checks. Production and affected test typechecks, selected formatting/lint, import-cycle checks, and independent supplied-context review passed. The 36 sequential cases took 62.67s in the isolated single-file test run, or 110.72s including worker preparation. Five Windows-specific sibling cases were skipped on macOS.

The first CI run exposed three warning-audience tests whose mocked fresh config read did not match their supplied snapshot hash. The six-line test-only correction passes all five warning-audience cases and their type/lint/review checks. Head 1dc0415bc9bd differs from the built revision only in that test fixture; production source is identical. The current-head CI run was cancelled after an independently attributed main-branch shell-fixture failure (first_hop_timing was omitted from an extracted-function fixture). The owner repaired it on main in e5fae567e3ba, with 57 tests passing. The explicitly authorized native pre-existing-failure path retains the cancelled run: 37 jobs succeeded, 20 were skipped, 97 were cancelled, and the fixture job plus downstream CI gate failed. Cancelled jobs are not passing coverage; required security and review gates remain enforced.

The after-fix installed upgrade passed with #160455: the unmodified published 2026.9.6 driver upgraded the validated 8e9972a57269 core artifact, then an explicit candidate Feishu update automatically preserved 127.0.0.1:57597 and every other Feishu setting. The real historical migration row changed from pending to completed with its report preserved. A normal Gateway returned signed 200, unsigned 401, and wrong-path 404, then shut down cleanly; all owned processes joined and ports were reusable. No manual Doctor ran. The core upgrade took 950.423s and the listener proof took 53.847s.

This used the maintained packer and a metadata-only 2026.9.99-first-hop.0 cohort: 13,386 core and 49 plugin members retain their runtime bytes, modes, and symlinks. It is an installed local-provider-fixture test, not live Feishu provider traffic or model inference. Validation-window/disposal warnings, the unavailable synthetic future Codex cohort, and a separate Codex catalog startup timeout remain recorded; no catalog-health claim is made. The receiving assessment is SHA-256 4b105d4452b80e44e770c00c0ee10202b7f9372da60ab4365f9295345821ebe2; all 49 bound evidence files were independently rehashed.

Complete selected plugin-owned config repairs through the existing update and replacement-install lifecycle before activation. Preserve pending obligations with actual config rollback, retain published package generations when rollback is unconfirmed, and refuse unresolved active inputs without suppressing committed partial updates.
@clawsweeper

clawsweeper Bot commented Sep 28, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes commands Command implementations size: XL labels Sep 28, 2026
@steipete
steipete marked this pull request as ready for review September 28, 2026 19:57
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 28, 2026
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 28, 2026, 4:45 PM ET / 20:45 UTC (Revision 2).

ClawSweeper review

What this changes

The branch runs selected plugin Doctor config repairs during plugin updates and replacement installs, then coordinates config writes, install records, pending migration state, rollback, documentation, and integration coverage.

Merge readiness

⛔ Blocked before merge - 4 items remain

Current main still lacks the plugin update repair path, so this PR remains useful. Review found one case where it can complete a pending migration without repairing its retained config input. The required installed-updater upgrade proof is also outstanding.

Priority: P1
Reviewed head: 1dc0415bc9bd9c9ffb4abeda066d6020bf587083

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The owner-boundary tests give useful signal, but a fixable pending-row defect and missing installed-upgrade proof prevent merge readiness.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Evidence reviewed 10 items Current main still needs the repair: The fetched main update command only enters persistence when a plugin or hook package changes and has no selected Doctor config-migration preparation.
Introduced completion guard: For pending config paths, the new guard checks whether the inspection map contains an entry, while the Doctor registry can record an entry with value false when its module has no config-repair surface.
Doctor inspection value: The registry passes false to the inspection callback when a loaded Doctor module has neither legacy config rules nor a config normalizer.
Findings 1 actionable finding [P1] Require a config repair before clearing retained inputs
Security None None.

How this fits together

The plugin CLI selects package updates and uses plugin-provided Doctor contracts to repair saved settings. It publishes config and install records before the Gateway refreshes the plugin and serves its configured webhook listener.

flowchart LR
  A[Installed plugin and saved settings] --> B[Plugin update command]
  B --> C[Selected Doctor repair]
  C --> D{Repair and state ready?}
  D -->|Yes| E[Publish config and install records]
  D -->|No| F[Retain settings and pending work]
  E --> G[Gateway refresh and webhook listener]
Loading

Before merge

  • Require a config repair before clearing retained inputs (P1) - Late discovery: an undeclared Doctor module can load successfully for an unrelated surface and set inspected to false, but this condition accepts mere map presence. For an active plugin with pending configPaths, no config repair, and a permissive candidate schema, publication can complete the pending row while leaving the legacy setting untouched; the new runtime may then use defaults. Require an actual repair surface or prove the retained input is gone before completing that row.
  • Resolve merge risk (P1) - The published 2026.9.6 updater can reject legacy listener settings before candidate code runs. The supported core-first upgrade through this head, pending-state settlement, and actual listener delivery have not yet been observed; operators may otherwise encounter an update refusal or an endpoint using defaults.
  • Complete next step (P2) - Repair the pending-row completion guard and obtain the published-driver-to-candidate listener proof before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.

Findings

  • [P1] Require a config repair before clearing retained inputs — src/commands/doctor/shared/plugin-update-config-migration.ts:162
Agent review details

Security

None.

PR surface

Source +519, Tests +775, Docs +14. Total +1308 across 18 files.

View PR surface stats
Area Files Added Removed Net
Source 12 681 162 +519
Tests 5 777 2 +775
Docs 1 14 0 +14
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 18 1472 164 +1308

Review metrics

Metric Value Why it matters
Production and test growth production +521 net lines; tests +775 net lines; docs +14 lines The added coordination spans config, install records, and SQLite rollback; its substantial production growth has a stated ownership and recovery purpose.
New integration suite cost 36 cases; 62.67 s single-worker test time The PR now reports the prior review's requested wall time, which exceeds the repository's 30-second explanation threshold.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor/shared/plugin-update-config-migration.ts, migration/backfill/repair: src/plugins/doctor-contract-registry.ts, unknown-data-model-change: src/commands/doctor/shared/plugin-update-config-migration.ts, unknown-data-model-change: src/plugins/doctor-contract-registry.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Repair and prove the upgrade (recommended)
    Keep pending rows until their retained settings are resolved, then show the published-updater core-first sequence preserving the configured endpoint and receiving a callback.

Technical review

Best possible solution:

Complete pending config work only when the selected Doctor contract repairs its retained input or that input is demonstrably absent, then verify the preserved listener through an installed 2026.9.6 core-first upgrade.

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

Yes. Current-main source omits the update-time Doctor repair, and the related installed-upgrade report observed fallback to a default listener port; this review did not execute that path.

Is this the best way to solve the issue?

No, not yet. Reusing Doctor and the existing publication owners is appropriate, but inspection of an unrelated Doctor surface must not authorize completion of retained config inputs.

Full review comments:

  • [P1] Require a config repair before clearing retained inputs — src/commands/doctor/shared/plugin-update-config-migration.ts:162
    Late discovery: an undeclared Doctor module can load successfully for an unrelated surface and set inspected to false, but this condition accepts mere map presence. For an active plugin with pending configPaths, no config repair, and a permissive candidate schema, publication can complete the pending row while leaving the legacy setting untouched; the new runtime may then use defaults. Require an actual repair surface or prove the retained input is gone before completing that row.
    Confidence: 0.88
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.84

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add merge-risk: 🚨 message-delivery: Completing a pending row without moving retained listener settings can activate a plugin on the wrong webhook endpoint.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
  • remove status: 👀 ready for maintainer look: Current PR status label is status: ⏳ waiting on author.

Label justifications:

  • P1: An incorrect plugin update can make an existing webhook listener use defaults and interrupt channel delivery.
  • merge-risk: 🚨 compatibility: The patch rewrites existing plugin settings and changes when pending migration records are completed, while the published-driver upgrade remains unproven.
  • merge-risk: 🚨 message-delivery: Completing a pending row without moving retained listener settings can activate a plugin on the wrong webhook endpoint.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.

Evidence

Acceptance criteria:

  • [P1] pnpm test src/cli/plugins-update-command.migrations.integration.test.ts --maxWorkers=1.
  • [P1] git diff --check.

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Dallin Romney: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Jason (Json): Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add a regression with retained legacy config input and an undeclared Doctor artifact exposing only an unrelated surface; keep the pending row until repair is proven.
  • Provide a redacted installed 2026.9.6 to candidate core-first trace showing the configured listener receiving a callback and pending state settling correctly.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-28T20:05:31.291Z sha 8e9972a :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 28, 2026
steipete added a commit that referenced this pull request Sep 28, 2026
The first-hop timing added in f0280ee made reset_lane depend on
first_hop_timing, but the systemd fixture extracted only reset_lane. Load
the real helper and verify its reset timing output alongside the existing
service-unload assertions. Production scripts and budgets are unchanged.

The original test reproduces exit 127. The repaired fixture, first-hop
package sibling and original CI group pass all 57 tests; changed checks
and independent Codex P0-P2 review pass.

Related: #160682
@steipete
steipete merged commit 216798c into main Sep 28, 2026
143 of 243 checks passed
@steipete
steipete deleted the codex/plugin-update-doctor-migrations branch September 28, 2026 21:07
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 29, 2026
The first-hop timing added in 2f7d897 made reset_lane depend on
first_hop_timing, but the systemd fixture extracted only reset_lane. Load
the real helper and verify its reset timing output alongside the existing
service-unload assertions. Production scripts and budgets are unchanged.

The original test reproduces exit 127. The repaired fixture, first-hop
package sibling and original CI group pass all 57 tests; changed checks
and independent Codex P0-P2 review pass.

Related: openclaw#160682
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 29, 2026
* fix: migrate retained plugin settings before update activation

Complete selected plugin-owned config repairs through the existing update and replacement-install lifecycle before activation. Preserve pending obligations with actual config rollback, retain published package generations when rollback is unconfirmed, and refuse unresolved active inputs without suppressing committed partial updates.

* test: align replacement-install warning fixture snapshots
steipete added a commit that referenced this pull request Oct 13, 2026
…0230)

Move deferred plugin migration reads out of ordinary CLI and Gateway config loading. Doctor owns legacy plugin repairs, while update admission and config writes carry explicit migration facts, preserve unavailable-plugin inputs, and retain generation checks at repair publication.

Normal config reads and writes now consume canonical config without a migration-ledger database query. `openclaw update status` exposes pending work; after a source or package-manager upgrade, run `openclaw doctor --fix` before restarting. Candidate validation keeps the previous Gateway running when canonical config remains invalid. Preserve the published 2026.10.1 Windows updater's state-worker contract.

Align ClawRouter's Solid dependencies to 2.0.0-rc.14 with Canvas, Workboard, and X, as explicitly approved, and regenerate its browser asset manifest and lockfile.

The reviewed product changes, focused tests, and package/update evidence are documented in the PR. Merge current main to incorporate its correction of the inherited idle-input durability test expectation; do not treat the historical failed run as current-head passing evidence.

Related: #147711, #158783, #160682.

Current-head CI run 38335235541: 91 passed, 23 skipped, 6 failed including aggregate. Native inherited-failure admin evidence binds five unchanged-owner shards, matching scheduled-main profile-authority failures, isolated archive-fixture noninteraction, exact tested merge, zero cancellations, and independent security clearance. Failed CI remains failed; details and limits are in the PR body.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 13, 2026
…nclaw#170230)

Move deferred plugin migration reads out of ordinary CLI and Gateway config loading. Doctor owns legacy plugin repairs, while update admission and config writes carry explicit migration facts, preserve unavailable-plugin inputs, and retain generation checks at repair publication.

Normal config reads and writes now consume canonical config without a migration-ledger database query. `openclaw update status` exposes pending work; after a source or package-manager upgrade, run `openclaw doctor --fix` before restarting. Candidate validation keeps the previous Gateway running when canonical config remains invalid. Preserve the published 2026.10.1 Windows updater's state-worker contract.

Align ClawRouter's Solid dependencies to 2.0.0-rc.14 with Canvas, Workboard, and X, as explicitly approved, and regenerate its browser asset manifest and lockfile.

The reviewed product changes, focused tests, and package/update evidence are documented in the PR. Merge current main to incorporate its correction of the inherited idle-input durability test expectation; do not treat the historical failed run as current-head passing evidence.

Related: openclaw#147711, openclaw#158783, openclaw#160682.

Current-head CI run 38335235541: 91 passed, 23 skipped, 6 failed including aggregate. Native inherited-failure admin evidence binds five unchanged-owner shards, matching scheduled-main profile-authority failures, isolated archive-fixture noninteraction, exact tested merge, zero cancellations, and independent security clearance. Failed CI remains failed; details and limits are in the PR body.
steipete added a commit that referenced this pull request Oct 13, 2026
)

A config write inside a deferred plugin migration completion scope (plugin
update or install finishing a pending migration) read the pending-migration
ledger twice before publication: once in replaceConfigFile and again in the
file write. Outside the Gateway each read was a synchronous SQLite snapshot
child on the main thread.

Before publication those reads could only return the scope's admitted
generation minus the resolved plugins, or throw. The publication write
transaction (withDeferredPluginMigrationsCurrent) already re-reads the rows
and asserts that exact generation for root and include-owned writes, so the
pre-publication path now returns the admitted facts directly. After
publication in the same scope the fresh read stays, moved to the async
state-worker read. Scope filtering is unchanged, and no write option or
plugin SDK surface is added.

Related: #160682, #170230.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 14, 2026
…claw#170695)

A config write inside a deferred plugin migration completion scope (plugin
update or install finishing a pending migration) read the pending-migration
ledger twice before publication: once in replaceConfigFile and again in the
file write. Outside the Gateway each read was a synchronous SQLite snapshot
child on the main thread.

Before publication those reads could only return the scope's admitted
generation minus the resolved plugins, or throw. The publication write
transaction (withDeferredPluginMigrationsCurrent) already re-reads the rows
and asserts that exact generation for root and include-owned writes, so the
pre-publication path now returns the admitted facts directly. After
publication in the same scope the fresh read stays, moved to the async
state-worker read. Scope filtering is unchanged, and no write option or
plugin SDK surface is added.

Related: openclaw#160682, openclaw#170230.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations docs Improvements or additions to documentation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant