Skip to content

fix: avoid deferring available linked plugins during updates - #168190

Merged
obviyus merged 2 commits into
mainfrom
fix/update-linked-plugin-migration
Oct 10, 2026
Merged

obviyus merged 2 commits into
mainfrom
fix/update-linked-plugin-migration

Conversation

@obviyus

@obviyus obviyus commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes: openclaw update defers Doctor work for an available, explicitly linked plugin until package convergence, although package convergence deliberately skips path installs.

User Impact

Available operator-managed linked plugins can complete their Doctor work in the activation phase instead of needlessly deferring it. Missing or stale packages and unrecorded configuration paths remain deferred. Other reasons for the post-plugin Doctor, including deferred model retirement, are unchanged.

Why This Change Was Made

The existing availability decision now recognizes a present source: "path" install as independent of package convergence. It continues to require the existing payload and descriptor checks to pass.

Update behavior: candidate-side only; it uses the existing update environment and needs no new marker. No new configuration option, schema, or persisted-state format.

Evidence

  • Final focused run: both linked/unrecorded state-migration cases passed. The affected Doctor test typecheck graph passed.
  • The regression drives Doctor preflight in the update environment with a real installed-plugin index and a plugin state-migration contract. It checks that linked installs migrate retained binding data, while the same unrecorded path keeps its migration obligation and original bytes.
  • Negative control: the linked-install case fails with the original availability implementation, while the unrecorded-path control passes.
  • The earlier full preflight suite passed all 13 tests. A later full-file run hit timeouts, an abort, and a lost lease (9 passed, 4 failed); the final focused run is the direct regression proof.
  • Driver: released v2026.9.8 (git-source install mode, same as the affected install) → exact candidate 08189f5bbe8cb82567587a3ed8edbba4e2cee65e. The real managed-Gateway update succeeded, with the linked plugin's state migration executed exactly once during activation and its data/settings preserved (inline evidence below).
  • npm-package mode is not exercised by that native run because the local Docker npm cell is blocked by OrbStack virtiofs: both this candidate and the exact merge base bc524d8903002ca70d07f9770b2f993e5e7aec59 fail the installed driver's retained-runtime inode check before candidate post-core work. The Linux release-check published-upgrade-survivor-2026.9.8 job passed on Ubuntu 24.04 and supplies the npm-mode evidence; this is a successful job, not a claim that its entire workflow passed.
  • Native managed-Gateway replay: control bbb82fd1e8a (tree identical to bc524d89030) versus combined 47c4c3641b6e (tree identical to f14888c058d, containing this change and fix: stop bundled plugin config churn during updates #168226). Both use an actual linked plugin and legacy bundled-path install records. Only commit metadata was advanced to avoid the already-current fast path. Both updates finished successfully and returned /readyz 200.
  • Control's activation Doctor deferred the linked plugin with “Package convergence must wait”. Combined's activation Doctor did not defer it; the linked-plugin path and records survived. The focused migration regression above separately verifies retained data bytes. Combined also eliminated bundled-alias write/revert churn; control retained it.
  • Readiness downtime, summing every last-200 → next-200 interval: control 420.642 s (one outage); combined 498.144 s (494.934 s + 3.210 s). The stopped-window activation Doctor step took 75.030 s versus 90.987 s. These loaded-host samples do not establish a speedup. Both still ran the post-plugin Doctor for deferred model retirement; that independent trigger is unchanged.
  • Native artifacts: runs/do-{ctl,f12}/evidence/legacy-index/{summary.json,update-result.json,readiness.jsonl,downtime-all-intervals.json}, plus native-legacy-evidence.json with config-audit and retirement records.
  • Maintainer decision: approve the healthy recorded-path exception while retaining the missing/stale/unrecorded/package-managed deferral.

Released-driver stateful upgrade

The fixture was installed through plugins install --link and declared a real Doctor state-migration contract. Its migration renames legacy-binding.json to migrated-binding.json without changing bytes and appends 1 followed by a newline to a counter. Backup resources use Doctor's supplied state directory, so candidate validation runs on the cloned state, not live state.

Sanitized update-result.json / persisted update-ledger excerpts:

{
  "status": "ok",
  "mode": "git",
  "before": {"sha": "fc23bc864e4553c2d215e479eeec47b67a0bf943", "version": "2026.9.8"},
  "after": {"sha": "08189f5bbe8cb82567587a3ed8edbba4e2cee65e", "version": "2026.9.9"},
  "activationDoctor": {
    "step": "openclaw doctor",
    "status": "completed",
    "startedAtMs": 1791628709879,
    "endedAtMs": 1791628789375,
    "exitCode": 0
  },
  "postUpdate.plugins.npm.outcomes": [
    {"pluginId": "harness-probe", "status": "skipped", "message": "Skipping \"harness-probe\" (source: path)."}
  ],
  "readyzAfter": 200
}

Live-state observations after the update:

migration-count.txt bytes: 31 0a                       # exactly "1" + newline
migration-count.txt mtime: 2026-10-10T10:39:18.433789Z
activation Doctor window: 2026-10-10T10:38:29.879Z–10:39:49.375Z
legacy-binding.json exists: false
migrated-binding.json: {"binding":"retained","data":"byte-preserved"} + trailing newline
plugin settings: {"binding":"settings-retained"}
package-convergence deferrals in update result + complete ledger: 0

The counter was written inside the activation Doctor window, before post-plugin convergence. The final live counter remains exactly one, including after the later Doctor. Data SHA-256 is over the original/migrated file bytes; settings SHA-256 compares the before/after JSON subtree serialized with the same two-space indentation and trailing newline:

Bytes Before SHA-256 After SHA-256
Plugin data adbf0252af99cc5ed2cd81923331a1a3f9aa5e0138bf771c9e9ed8981e5049fb adbf0252af99cc5ed2cd81923331a1a3f9aa5e0138bf771c9e9ed8981e5049fb
Plugin settings d3ba894374d916f631bf16386b64fc1e1b69cee66bf5ff227b039c5693c0c035 d3ba894374d916f631bf16386b64fc1e1b69cee66bf5ff227b039c5693c0c035

Read-only SQLite diagnostic_events config-audit rows (timestamps UTC; local paths/process identity omitted):

Timestamp Origin Changed paths
09:09:42.462 plugin-install plugins.installs
09:09:57.820 cli plugins.entries.harness-probe.config, plugins.installs
10:39:23.947 doctor meta.migrations.webhookListeners, plugins.installs, wizard
10:40:11.428 not recorded plugins.installs, plugins.load.paths[1], [2], [3]
10:40:40.654 doctor plugins.installs, plugins.load.paths[1], [2], [3], wizard.lastRunAt, wizard.lastRunCommit

No update-time row changed plugins.entries.harness-probe.config. The latter alias add/remove is expected here: this exact candidate contains fix 2 only, not the separate fix in #168226. Deferred model retirement still caused the later Doctor; it did not rerun the plugin migration.

Inspectable retained outputs and proof boundary

Native update-result excerpts (paths omitted; no output values changed):

{
  "control": {
    "status": "ok",
    "postUpdate.plugins.sync.changed": true,
    "activationDoctor.durationMs": 75030,
    "activationDoctor.stderr": "Plugin \"harness-probe\" data/settings upgrade is unfinished: Package convergence must wait until the updating parent releases its install records.",
    "finalReadyz": 200
  },
  "combined": {
    "status": "ok",
    "postUpdate.plugins.sync.changed": false,
    "activationDoctor.durationMs": 90987,
    "activationDoctor.packageConvergenceDeferralCount": 0,
    "finalReadyz": 200
  }
}

Both persisted installed indexes retained harness-probe with source: "path" and unchanged source/install paths. Both also retained the three bundled path records, including their original spec and installedAt values. The native probe does not declare a data-migration contract; this run proves the real updater's availability/deferral branch and retained existing state, not execution of a stateful migration.

Stateful migration coverage is the focused regression on this exact head:

node scripts/run-vitest.mjs run src/commands/doctor-config-preflight.plugin-deferral.test.ts -t 'package convergence skips it'
Test Files  1 passed (1)
     Tests  2 passed | 11 skipped (13)

Its linked case invokes the real migration contract and verifies {"binding":"retained"} plus a trailing newline in the migrated file; its unrecorded-path control verifies the original bytes remain and no destination exists.

Local Docker npm-mode output on both candidate and exact merge-base control (OrbStack virtiofs limitation, not the successful native git-source run above):

package-install: exitCode 0
package-update: exitCode 1
reason: unexpected-error
Retained runtime entry does not reference its inventoried file: <installed-root>/dist/a2ui-D3SkzOIh.mjs
postUpdate: null

Maintainer-intent check: no overlapping changes from the maintainers named in the repository review guide were found in the affected files.

Merge danger: two-way door; reverting restores the needless deferral. Blast radius is Doctor availability for explicitly recorded path plugins during updates.

@clawsweeper

clawsweeper Bot commented Oct 10, 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.

@obviyus
obviyus marked this pull request as ready for review October 10, 2026 04:24
@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: XS labels Oct 10, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 10, 2026
@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Allow healthy recorded path plugins to complete Doctor migrations during update activation without waiting for package convergence.

Example: Updating an installation with the linked plugin harness-probe and a legacy binding file.

  • Before: Activation Doctor defers the migration even though package convergence skips source: path installs.
  • After: Activation Doctor migrates the binding once while preserving its bytes and plugin settings.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused, approved repair with shipped-entry-point upgrade evidence, meaningful positive and negative regression cases, and no open findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): The redacted released v2026.9.8 git-source update transcript exercises the exact head through the managed updater, records one linked-plugin migration during activation, preserves data and settings hashes, and ends ready; this satisfies the earlier upgrade-evidence request without relying on the combined replay or different-head npm job.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Updates postpone an available linked plugin's migration for convergence that never updates that plugin.
Reason: The narrow repair has observable value, preserves unavailable-plugin safeguards, and has written direction approval from a verified repository maintainer.

Merge readiness

✅ Ready for maintainer review

This PR fixes a distinct update defect still present on main; the new exact-head upgrade evidence resolves the earlier proof blocker, and no actionable code defect remains.

Priority: P2
Reviewed head: 08189f5bbe8cb82567587a3ed8edbba4e2cee65e

Before merge

None.

Findings

None.

Agent review details

How this fits together

Doctor combines configured plugin metadata, installed records, and payload health to decide which migration contracts can run and which obligations remain deferred.

flowchart TD
  A[Released updater] --> B[Candidate Doctor]
  C[Plugin metadata and installed records] --> D[Migration availability]
  B --> D
  D --> E[Run available migration contracts]
  D --> F[Retain deferred obligations]
Loading

Technical review

Best possible solution:

Retain this narrow exception in the existing availability owner while preserving all existing health checks and other deferral cases.

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

Current-main source defers healthy recorded path plugins during activation while package updating skips their source type; the supplied control trace and reported baseline-failing regression corroborate that path.

Is this the best way to solve the issue?

The patch repairs the existing availability decision directly, adds no competing owner or configuration, and preserves the conditions that protect unavailable plugins.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Update-time plugin migration availability changes intended behavior with a stated reason (33bde5d: Permit private rehearsal copies while deferring ordinary config paths whose payloads could be stale.)
  • Discovery-blocked plugin protection keeps the original intent (e048d9d: Preserve installed plugin state while path-safety checks prevent execution.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Focused availability repair: The introduced hunk adds only healthy recorded source: path installs to the existing convergence exception; unavailable payloads, repairable packages, stale descriptors, and discovery blocking still feed the unchanged health decision. (src/commands/doctor/shared/plugin-migration-availability.ts:166, 08189f5bbe8c)
  • Current main still defers linked plugins: Fetched main retains only bundled and private-rehearsal exceptions, so the central repair remains necessary. (src/commands/doctor/shared/plugin-migration-availability.ts:162, efd06539cff0)
  • Production-path regression: The added paired cases drive real Doctor preflight and installed-index state, asserting migrated bytes for the linked plugin and retained original bytes plus a pending obligation for the unrecorded path; the body reports the intended baseline failure and passing focused replay. (src/commands/doctor-config-preflight.plugin-deferral.test.ts:209, 08189f5bbe8c)
  • Released-driver stateful upgrade: The full PR body supplies redacted v2026.9.8 git-source updater output targeting the exact head: successful activation, one live migration within activation, matching before/after data and settings hashes, zero linked-plugin convergence deferrals, and readiness 200. (08189f5bbe8c)
  • Verified direction approval: The written approval permits healthy recorded path installs while retaining missing, stale, unrecorded, and package-managed deferral; GitHub verifies obviyus has the maintain repository role despite the comment's CONTRIBUTOR association.
  • Original deferral intent: Merged fix(update): run copied config plugin Doctor contracts #150978 deliberately deferred ordinary config paths because their payloads might be stale; this PR documents and obtains approval for the narrower recorded-path exception. (src/commands/doctor/shared/plugin-migration-availability.ts:158, 33bde5dc2f9d)

Likely related people:

  • Peter Steinberger: Raw commit 9edc73f adds src/commands/doctor/shared/plugin-migration-availability.ts:128 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 9edc73fc2f9b; files: src/commands/doctor/shared/plugin-migration-availability.ts)
  • Dallin Romney: Raw commit 33bde5d adds src/commands/doctor/shared/plugin-migration-availability.ts:136 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 33bde5dc2f9d; files: src/commands/doctor/shared/plugin-migration-availability.ts)

PR surface

Source +3, Tests +51. Total +54 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 4 1 +3
Tests 1 52 1 +51
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 56 2 +54

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.

Label justifications:

  • P2: Repairs unnecessary migration deferral for explicitly linked plugins during updates without establishing an outage or data loss.
  • 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 need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (6 earlier review cycles)
  • reviewed 2026-10-10T04:37:53.367Z sha 1ac2d5b67a916a1351521835c2b5095b9ca3723d :: blocked before merge. :: none
  • reviewed 2026-10-10T05:16:24.617Z sha 7d9f413 :: blocked before merge. :: none
  • reviewed 2026-10-10T05:50:18.738Z sha 08189f5 :: blocked before merge. :: none
  • reviewed 2026-10-10T06:07:03.926Z sha 08189f5 :: blocked before merge. :: none
  • reviewed 2026-10-10T08:45:27.157Z sha 08189f5 :: blocked before merge. :: none
  • reviewed 2026-10-10T08:53:22.267Z sha 08189f5 :: blocked before merge. :: none

Reviewed October 10, 2026, 6:47 AM ET / 10:47 UTC (Revision 7).

@obviyus
obviyus force-pushed the fix/update-linked-plugin-migration branch from 1ac2d5b to 7d9f413 Compare October 10, 2026 05:10
@clawsweeper clawsweeper Bot removed the status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. label Oct 10, 2026
@obviyus

obviyus commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator Author

Approved: healthy, recorded source: path plugin installs are exempt from the update package-convergence deferral, since the updater never converges path installs. Missing, stale, unrecorded, and package-managed plugins keep the #150978 deferral unchanged.

@obviyus

obviyus commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

The body now links the maintainer approval and completed native control versus combined replay: linked-plugin deferral appears on control and is absent on the combined tree; persisted linked-plugin state survives. The focused actual-migration regression proves retained binding bytes. Published 2026.9.8 activation fails identically on plain-main merge base bc524d8, before either changed owner runs. No successful published cell or timing speedup is claimed. Please review exact head 08189f5.

@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Oct 10, 2026
obviyus added a commit that referenced this pull request Oct 10, 2026
## What Problem This Solves

Fixes: `openclaw update` repeatedly changes plugin configuration when the installed-plugin index records bundled plugins as linked `source: "path"` installs into `dist/extensions`, even though the installed plugins have not changed. Earlier development-channel updates could create this shape when switching an existing plugin to its bundled copy.

## User Impact

Updates retain the canonical bundled-plugin configuration instead of adding a redundant load path that Doctor immediately removes. Real plugin switches still count as changes. Other reasons for the post-plugin Doctor, including deferred model retirement, are unchanged.

## Why This Change Was Made

Plugin sync now uses the same packaged-path alias detection as Doctor before adding bundled load paths, for both development and release channels. Source-tree and external linked plugin paths keep their existing behavior.

Update behavior: candidate-side only; the installed updater needs no new marker. No new configuration option, schema, or persisted-state format.

## Evidence

- Three focused regressions cover unchanged development and stable bundled installs and a development npm-to-bundled switch. All pass on this change and all fail with the original sync implementation.
- Each regression passes the resulting configuration through Doctor's bundled-load-path repair and confirms that it has nothing left to remove.
- A retained real update confirms the trigger: the installed index contains bundled path records for `brave`, `codex`, and `diagnostics-otel`; post-update sync appends their `dist/extensions/<id>` paths, then Doctor removes the same three paths. The config-audit write hashes match the retained before/intermediate/after configurations. The operator's unrelated linked-plugin path remains throughout.

- Final candidate: all 89 plugin-update and bundled-load-path tests passed. Core and all 27 test typecheck graphs passed.
- Published-driver attempt (`[email protected]` → candidate, configured-plugin-installs): packaging and candidate package installation succeeded, but activation failed before candidate post-core work because the installed driver's retained-runtime inventory rejected an `a2ui-*.mjs` inode. The identical cell against this PR's exact merge base (`bc524d89030`, without this change) failed at the same check. Rollback retained 2026.9.8; post-failure configuration validation passed. This is an independently reproduced baseline blocker, not a passing upgrade or plugin-sync proof.
- Published artifacts: `published-fix1-serial/{summary.json,update.json}` and `published-base-serial/{summary.json,update.json}`. Both retain the failed activation and rollback result; this failure is not suppressed.
- Native managed-Gateway replay with the real legacy index shape: control `bbb82fd1e8a` (tree identical to `bc524d89030`) versus combined `47c4c3641b6e` (tree identical to `f14888c058d`, containing this change and #168190). Only commit metadata was advanced to avoid the already-current fast path. Both updates finished successfully and returned `/readyz` 200.
- Control: plugin sync reported `changed:true`; config audit at 08:13:19Z appended all three bundled aliases, and Doctor at 08:14:14Z removed them. Combined: `changed:false`, no config-audit writes, and the unrelated linked-plugin load path and installed records remained intact.
- Readiness downtime, summing every last-200 → next-200 interval: control **420.642 s** (one outage); combined **498.144 s** (494.934 s + 3.210 s). The stopped-window activation Doctor step took **75.030 s** versus **90.987 s**. These loaded-host samples do not establish a speedup. Both still ran the post-plugin Doctor for deferred model retirement; this PR does not remove that independent trigger.
- Native artifacts: `runs/do-{ctl,f12}/evidence/legacy-index/{summary.json,update-result.json,readiness.jsonl,downtime-all-intervals.json}`, plus `native-legacy-evidence.json` with config-audit and retirement records.

Maintainer-intent check: no overlapping changes from the maintainers named in the repository review guide were found in the affected files.

Merge danger: two-way door; reverting restores the redundant load-path churn. Blast radius is plugin synchronization for explicitly installed packaged bundled plugins during updates.

Co-authored-by: Ayaan Zaidi <[email protected]>
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Oct 10, 2026
@obviyus

obviyus commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

The body now includes the completed released v2026.9.8 git-source driver → exact head 08189f5 stateful upgrade: one live migration inside activation, matching before/after data and settings hashes, config-audit rows, no linked-plugin package-convergence deferral, and successful final readiness. The npm-mode boundary is explicit: the local Docker cell has the identical OrbStack virtiofs failure on the exact merge base; the successful Linux published-upgrade-survivor job is linked. No npm-mode success is claimed for the native run.

@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added 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. labels Oct 10, 2026
@obviyus
obviyus merged commit 468a57d into main Oct 10, 2026
180 of 182 checks passed
@obviyus
obviyus deleted the fix/update-linked-plugin-migration branch October 10, 2026 10:50
@obviyus

obviyus commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator Author

Landed as 468a57d. Healthy recorded path plugins now complete Doctor migration during activation instead of waiting for package convergence that skips them. The exact-head released v2026.9.8 git-source upgrade ran the stateful migration once and preserved data/settings hashes; focused regressions and exact-head CI passed. Thanks for reporting the update behavior.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 11, 2026
## What Problem This Solves

Fixes: `openclaw update` repeatedly changes plugin configuration when the installed-plugin index records bundled plugins as linked `source: "path"` installs into `dist/extensions`, even though the installed plugins have not changed. Earlier development-channel updates could create this shape when switching an existing plugin to its bundled copy.

## User Impact

Updates retain the canonical bundled-plugin configuration instead of adding a redundant load path that Doctor immediately removes. Real plugin switches still count as changes. Other reasons for the post-plugin Doctor, including deferred model retirement, are unchanged.

## Why This Change Was Made

Plugin sync now uses the same packaged-path alias detection as Doctor before adding bundled load paths, for both development and release channels. Source-tree and external linked plugin paths keep their existing behavior.

Update behavior: candidate-side only; the installed updater needs no new marker. No new configuration option, schema, or persisted-state format.

## Evidence

- Three focused regressions cover unchanged development and stable bundled installs and a development npm-to-bundled switch. All pass on this change and all fail with the original sync implementation.
- Each regression passes the resulting configuration through Doctor's bundled-load-path repair and confirms that it has nothing left to remove.
- A retained real update confirms the trigger: the installed index contains bundled path records for `brave`, `codex`, and `diagnostics-otel`; post-update sync appends their `dist/extensions/<id>` paths, then Doctor removes the same three paths. The config-audit write hashes match the retained before/intermediate/after configurations. The operator's unrelated linked-plugin path remains throughout.

- Final candidate: all 89 plugin-update and bundled-load-path tests passed. Core and all 27 test typecheck graphs passed.
- Published-driver attempt (`[email protected]` → candidate, configured-plugin-installs): packaging and candidate package installation succeeded, but activation failed before candidate post-core work because the installed driver's retained-runtime inventory rejected an `a2ui-*.mjs` inode. The identical cell against this PR's exact merge base (`5ce8485a701`, without this change) failed at the same check. Rollback retained 2026.9.8; post-failure configuration validation passed. This is an independently reproduced baseline blocker, not a passing upgrade or plugin-sync proof.
- Published artifacts: `published-fix1-serial/{summary.json,update.json}` and `published-base-serial/{summary.json,update.json}`. Both retain the failed activation and rollback result; this failure is not suppressed.
- Native managed-Gateway replay with the real legacy index shape: control `bbb82fd1e8a` (tree identical to `5ce8485a701`) versus combined `47c4c3641b6e` (tree identical to `f14888c058d`, containing this change and openclaw#168190). Only commit metadata was advanced to avoid the already-current fast path. Both updates finished successfully and returned `/readyz` 200.
- Control: plugin sync reported `changed:true`; config audit at 08:13:19Z appended all three bundled aliases, and Doctor at 08:14:14Z removed them. Combined: `changed:false`, no config-audit writes, and the unrelated linked-plugin load path and installed records remained intact.
- Readiness downtime, summing every last-200 → next-200 interval: control **420.642 s** (one outage); combined **498.144 s** (494.934 s + 3.210 s). The stopped-window activation Doctor step took **75.030 s** versus **90.987 s**. These loaded-host samples do not establish a speedup. Both still ran the post-plugin Doctor for deferred model retirement; this PR does not remove that independent trigger.
- Native artifacts: `runs/do-{ctl,f12}/evidence/legacy-index/{summary.json,update-result.json,readiness.jsonl,downtime-all-intervals.json}`, plus `native-legacy-evidence.json` with config-audit and retirement records.

Maintainer-intent check: no overlapping changes from the maintainers named in the repository review guide were found in the affected files.

Merge danger: two-way door; reverting restores the redundant load-path churn. Blast radius is plugin synchronization for explicitly installed packaged bundled plugins during updates.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 11, 2026
…w#168190)

## What Problem This Solves

Fixes: `openclaw update` defers Doctor work for an available, explicitly linked plugin until package convergence, although package convergence deliberately skips path installs.

## User Impact

Available operator-managed linked plugins can complete their Doctor work in the activation phase instead of needlessly deferring it. Missing or stale packages and unrecorded configuration paths remain deferred. Other reasons for the post-plugin Doctor, including deferred model retirement, are unchanged.

## Why This Change Was Made

The existing availability decision now recognizes a present `source: "path"` install as independent of package convergence. It continues to require the existing payload and descriptor checks to pass.

Update behavior: candidate-side only; it uses the existing update environment and needs no new marker. No new configuration option, schema, or persisted-state format.

## Evidence

- Final focused run: both linked/unrecorded state-migration cases passed. The affected Doctor test typecheck graph passed.
- The regression drives Doctor preflight in the update environment with a real installed-plugin index and a plugin state-migration contract. It checks that linked installs migrate retained binding data, while the same unrecorded path keeps its migration obligation and original bytes.
- Negative control: the linked-install case fails with the original availability implementation, while the unrecorded-path control passes.
- The earlier full preflight suite passed all 13 tests. A later full-file run hit timeouts, an abort, and a lost lease (9 passed, 4 failed); the final focused run is the direct regression proof.
- Driver: **released v2026.9.8 (git-source install mode, same as the affected install)** → exact candidate `08189f5bbe8cb82567587a3ed8edbba4e2cee65e`. The real managed-Gateway update succeeded, with the linked plugin's state migration executed exactly once during activation and its data/settings preserved (inline evidence below).
- npm-package mode is not exercised by that native run because the local Docker npm cell is blocked by **OrbStack virtiofs**: both this candidate and the exact merge base `5ce8485a7014e4be60dd3e50efc6fac3e3613cb2` fail the installed driver's retained-runtime inode check before candidate post-core work. The [Linux release-check published-upgrade-survivor-2026.9.8 job](https://github.com/openclaw/openclaw/actions/runs/38032945484/job/114159364272) passed on Ubuntu 24.04 and supplies the npm-mode evidence; this is a successful job, not a claim that its entire workflow passed.
- Native managed-Gateway replay: control `bbb82fd1e8a` (tree identical to `5ce8485a701`) versus combined `47c4c3641b6e` (tree identical to `f14888c058d`, containing this change and openclaw#168226). Both use an actual linked plugin and legacy bundled-path install records. Only commit metadata was advanced to avoid the already-current fast path. Both updates finished successfully and returned `/readyz` 200.
- Control's activation Doctor deferred the linked plugin with “Package convergence must wait”. Combined's activation Doctor did not defer it; the linked-plugin path and records survived. The focused migration regression above separately verifies retained data bytes. Combined also eliminated bundled-alias write/revert churn; control retained it.
- Readiness downtime, summing every last-200 → next-200 interval: control **420.642 s** (one outage); combined **498.144 s** (494.934 s + 3.210 s). The stopped-window activation Doctor step took **75.030 s** versus **90.987 s**. These loaded-host samples do not establish a speedup. Both still ran the post-plugin Doctor for deferred model retirement; that independent trigger is unchanged.
- Native artifacts: `runs/do-{ctl,f12}/evidence/legacy-index/{summary.json,update-result.json,readiness.jsonl,downtime-all-intervals.json}`, plus `native-legacy-evidence.json` with config-audit and retirement records.
- [Maintainer decision](openclaw#168190 (comment)): approve the healthy recorded-path exception while retaining the missing/stale/unrecorded/package-managed deferral.

### Released-driver stateful upgrade

The fixture was installed through `plugins install --link` and declared a real Doctor state-migration contract. Its migration renames `legacy-binding.json` to `migrated-binding.json` without changing bytes and appends `1` followed by a newline to a counter. Backup resources use Doctor's supplied state directory, so candidate validation runs on the cloned state, not live state.

Sanitized `update-result.json` / persisted update-ledger excerpts:

```json
{
  "status": "ok",
  "mode": "git",
  "before": {"sha": "fc23bc864e4553c2d215e479eeec47b67a0bf943", "version": "2026.9.8"},
  "after": {"sha": "08189f5bbe8cb82567587a3ed8edbba4e2cee65e", "version": "2026.9.9"},
  "activationDoctor": {
    "step": "openclaw doctor",
    "status": "completed",
    "startedAtMs": 1791628709879,
    "endedAtMs": 1791628789375,
    "exitCode": 0
  },
  "postUpdate.plugins.npm.outcomes": [
    {"pluginId": "harness-probe", "status": "skipped", "message": "Skipping \"harness-probe\" (source: path)."}
  ],
  "readyzAfter": 200
}
```

Live-state observations after the update:

```text
migration-count.txt bytes: 31 0a                       # exactly "1" + newline
migration-count.txt mtime: 2026-10-10T10:39:18.433789Z
activation Doctor window: 2026-10-10T10:38:29.879Z–10:39:49.375Z
legacy-binding.json exists: false
migrated-binding.json: {"binding":"retained","data":"byte-preserved"} + trailing newline
plugin settings: {"binding":"settings-retained"}
package-convergence deferrals in update result + complete ledger: 0
```

The counter was written **inside the activation Doctor window**, before post-plugin convergence. The final live counter remains exactly one, including after the later Doctor. Data SHA-256 is over the original/migrated file bytes; settings SHA-256 compares the before/after JSON subtree serialized with the same two-space indentation and trailing newline:

| Bytes | Before SHA-256 | After SHA-256 |
| --- | --- | --- |
| Plugin data | `adbf0252af99cc5ed2cd81923331a1a3f9aa5e0138bf771c9e9ed8981e5049fb` | `adbf0252af99cc5ed2cd81923331a1a3f9aa5e0138bf771c9e9ed8981e5049fb` |
| Plugin settings | `d3ba894374d916f631bf16386b64fc1e1b69cee66bf5ff227b039c5693c0c035` | `d3ba894374d916f631bf16386b64fc1e1b69cee66bf5ff227b039c5693c0c035` |

Read-only SQLite `diagnostic_events` config-audit rows (timestamps UTC; local paths/process identity omitted):

| Timestamp | Origin | Changed paths |
| --- | --- | --- |
| 09:09:42.462 | plugin-install | `plugins.installs` |
| 09:09:57.820 | cli | `plugins.entries.harness-probe.config`, `plugins.installs` |
| 10:39:23.947 | doctor | `meta.migrations.webhookListeners`, `plugins.installs`, `wizard` |
| 10:40:11.428 | not recorded | `plugins.installs`, `plugins.load.paths[1]`, `[2]`, `[3]` |
| 10:40:40.654 | doctor | `plugins.installs`, `plugins.load.paths[1]`, `[2]`, `[3]`, `wizard.lastRunAt`, `wizard.lastRunCommit` |

No update-time row changed `plugins.entries.harness-probe.config`. The latter alias add/remove is expected here: this exact candidate contains fix 2 only, not the separate fix in openclaw#168226. Deferred model retirement still caused the later Doctor; it did not rerun the plugin migration.

<details>
<summary>Inspectable retained outputs and proof boundary</summary>

Native update-result excerpts (paths omitted; no output values changed):

```json
{
  "control": {
    "status": "ok",
    "postUpdate.plugins.sync.changed": true,
    "activationDoctor.durationMs": 75030,
    "activationDoctor.stderr": "Plugin \"harness-probe\" data/settings upgrade is unfinished: Package convergence must wait until the updating parent releases its install records.",
    "finalReadyz": 200
  },
  "combined": {
    "status": "ok",
    "postUpdate.plugins.sync.changed": false,
    "activationDoctor.durationMs": 90987,
    "activationDoctor.packageConvergenceDeferralCount": 0,
    "finalReadyz": 200
  }
}
```

Both persisted installed indexes retained `harness-probe` with `source: "path"` and unchanged source/install paths. Both also retained the three bundled path records, including their original `spec` and `installedAt` values. The native probe does not declare a data-migration contract; this run proves the real updater's availability/deferral branch and retained existing state, not execution of a stateful migration.

Stateful migration coverage is the focused regression on this exact head:

```text
node scripts/run-vitest.mjs run src/commands/doctor-config-preflight.plugin-deferral.test.ts -t 'package convergence skips it'
Test Files  1 passed (1)
     Tests  2 passed | 11 skipped (13)
```

Its linked case invokes the real migration contract and verifies `{"binding":"retained"}` plus a trailing newline in the migrated file; its unrecorded-path control verifies the original bytes remain and no destination exists.

Local Docker npm-mode output on both candidate and exact merge-base control (OrbStack virtiofs limitation, not the successful native git-source run above):

```text
package-install: exitCode 0
package-update: exitCode 1
reason: unexpected-error
Retained runtime entry does not reference its inventoried file: <installed-root>/dist/a2ui-D3SkzOIh.mjs
postUpdate: null
```

</details>

Maintainer-intent check: no overlapping changes from the maintainers named in the repository review guide were found in the affected files.

Merge danger: two-way door; reverting restores the needless deferral. Blast radius is Doctor availability for explicitly recorded path plugins during updates.

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

Labels

commands Command implementations 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.

1 participant