Skip to content

fix: stop bundled plugin config churn during updates - #168226

Merged
obviyus merged 1 commit into
mainfrom
fix/update-doctor-once
Oct 10, 2026
Merged

obviyus merged 1 commit into
mainfrom
fix/update-doctor-once

Conversation

@obviyus

@obviyus obviyus commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

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 fix: avoid deferring available linked plugins during updates #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.

@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 05:23
@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. 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

Plugin synchronization avoids adding packaged bundled-plugin load paths that Doctor subsequently removes.

Example: An unchanged brave install points to /opt/openclaw/dist/extensions/brave.

  • Before: Update adds that path to plugins.load.paths, marks configuration changed, and Doctor removes it.
  • After: Update leaves the canonical configuration unchanged while preserving the install record.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The focused repair and meaningful regressions support correctness; the described runtime replay needs inspectable evidence.
Proof confidence 🦪 silver shellfish (2/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Updates rewrite unchanged bundled-plugin configuration and Doctor immediately reverses those writes.
Reason: A small producer repair removes unnecessary persisted configuration churn without adding settings or changing plugin-source choices.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current plugin-update inconsistency at its producer; no introduced correctness or security defect was found.

Priority: P2
Reviewed head: 6249a2ebe88ffb74045cb4b9a904f804fcf48291

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Attach the retained redacted native-update output showing alias-free synchronization and preserved plugin records and availability; the body currently provides a summary and inaccessible artifact paths.
Agent review details

How this fits together

Update-channel synchronization consumes installed-plugin records and bundled discovery metadata, then returns configuration and change flags to plugin convergence.

flowchart LR
  A[OpenClaw update] --> B[Plugin convergence]
  B --> C[Channel synchronization]
  D[Bundled discovery] --> C
  E[Installed plugin records] --> C
  C --> F[Configuration and change flag]
  F --> G[Doctor repair]
Loading

Technical review

Best possible solution:

Keep channel synchronization aligned with bundled discovery and Doctor through the existing alias classifier.

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

Current main unconditionally adds the packaged path before recognizing an unchanged bundled install, while Doctor subsequently identifies that path as redundant; no target code was executed during this review.

Is this the best way to solve the issue?

The patch repairs the producer using Doctor's existing classification instead of suppressing change reporting or weakening repair behavior.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Bundled install synchronization keeps the original intent (a2eb27c: The lifecycle refactor carried forward bundled source selection and external-plugin boundaries; it does not establish when the unconditional additions originally began.)
  • Packaged bundled-path classification keeps the original intent (fix(doctor): prune stale bundled plugin load paths #85038: Doctor removes redundant current and stale packaged aliases while preserving unrelated custom paths.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Focused producer repair: The introduced patch replaces unconditional bundled-path additions in both channel branches with the existing packaged-alias classifier; install switching and external-link retention remain intact. (src/plugins/update-channel.ts:118, 6249a2ebe88f)
  • Discovery and Doctor agree: Discovery scans the stock bundled root independently of configured paths, and Doctor removes matching packaged bundled aliases while preserving unrelated paths. (src/plugins/discovery.ts:1097, 6249a2ebe88f)
  • Current main still needs the repair: The fetched main revision retains the unconditional addition, including the release-channel branch. (src/plugins/update-channel.ts:445, d54483901779)
  • Regression coverage: The added table exercises unchanged dev and stable path installs and a real dev npm-to-bundled switch, checking configuration, change reporting, install records, and Doctor convergence. (src/plugins/update-channel.bundled-load-paths.test.ts:15, 6249a2ebe88f)
  • Existing lifecycle intent: refactor(plugins): split update lifecycle #108877 split the update lifecycle while preserving source selection and external-plugin boundaries; this patch preserves those decisions. (src/plugins/update-channel.ts:443, a2eb27c03a5d)
  • Updated runtime evidence: The full body describes a successful native control-versus-combined replay and preserved custom paths and records, but supplies local artifact names rather than accessible logs or attachments. It explicitly distinguishes the baseline-identical published-driver activation failure from successful upgrade proof. (6249a2ebe88f)

Likely related people:

  • Peter Steinberger: Raw commit a2eb27c adds src/plugins/update-channel.ts:335 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: a2eb27c03a5d; files: src/plugins/update-channel.ts)

PR surface

Source +8, Tests +51. Total +59 across 2 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 1 10 2 +8
Tests 1 51 0 +51
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 61 2 +59

Labels

Label changes:

  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦪 silver shellfish, so this older rating label is no longer current.

Label justifications:

  • P2: Repeated redundant configuration writes affect updates with legacy bundled path-install records, with a focused repair and limited blast radius.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

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

  • Link or attach the existing native replay logs and configuration-audit records rather than rerunning the replay.

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 (3 earlier review cycles)
  • reviewed 2026-10-10T05:28:44.986Z sha 6249a2e :: blocked before merge. :: none
  • reviewed 2026-10-10T06:14:38.464Z sha 6249a2e :: blocked before merge. :: none
  • reviewed 2026-10-10T07:29:18.751Z sha 6249a2e :: blocked before merge. :: none

Reviewed October 10, 2026, 4:44 AM ET / 08:44 UTC (Revision 4).

@obviyus

obviyus commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

The body now includes retained production config-audit evidence and the completed native control versus combined replay: the control adds/removes all three bundled aliases; the combined tree does not. Published 2026.9.8 activation fails identically on exact plain-main merge base bc524d8, before either changed owner runs. No successful published cell or timing speedup is claimed. Please review exact head 6249a2e.

@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. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Oct 10, 2026
@obviyus
obviyus merged commit 76aabd1 into main Oct 10, 2026
216 of 218 checks passed
@obviyus
obviyus deleted the fix/update-doctor-once branch October 10, 2026 08:46
@obviyus

obviyus commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator Author

Landed in 76aabd1. The fix prevents bundled-path aliases from being rewritten and then removed by Doctor. The native legacy-index control reproduced the three-alias write/revert; the combined candidate preserved configuration and installed records without that churn. Focused negative controls, exact-head CI and hosted review passed. The published 2026.9.8 activation blocker also reproduced on plain main and is documented in the body. Thanks for the report.

obviyus added a commit that referenced this pull request Oct 10, 2026
## 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](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 `bc524d89030`) versus combined `47c4c3641b6e` (tree identical to `f14888c058d`, containing this change and #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](#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 #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]>
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

P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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