Skip to content

fix(plugins): keep rebuilt bundled plugins on git installs instead of npm refreshes with a mismatched SDK - #145356

Merged
steipete merged 4 commits into
mainfrom
steipete/upd-git-plugin-convergence
Sep 12, 2026
Merged

steipete merged 4 commits into
mainfrom
steipete/upd-git-plugin-convergence

Conversation

@steipete

@steipete steipete commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #145266

What Problem This Solves

Fixes an issue where users updating a git/dev installation would lose every Codex harness turn after Doctor refreshed the plugin from npm. The published plugin and rebuilt host could share 2026.9.4 while importing and exporting different Plugin SDK symbols. Retained npm records could also make named plugin updates, --all, and stable/beta release-cohort convergence fail with missing package-owner metadata after selecting the rebuilt bundle.

Why This Change Was Made

Compiled bundled plugins from the running source checkout retain priority without requiring OPENCLAW_DEV_SOURCE_ROOT. Doctor and plugin updates keep those builds and record why the registry artifact was not admitted: current package metadata has no matching SDK build identity, and matching version strings are insufficient.

The existing manifest selection owner determines which registry payloads are dormant. Update planning carries that selection through package-mutation preflight, while active packages retain strict ownership and reconciliation checks. Dormant records still reach the updater for an explanatory unchanged outcome. A damaged unused npm generation cannot quarantine the selected bundle.

External npm records and payloads remain available; explicit plugin paths and the existing development selector retain their precedence. Unbuilt source copies do not gain automatic priority. Ordinary bundled plugins retain their existing stale-record cleanup. Status-only post-core acknowledgments remain valid when detailed npm outcomes are absent.

User Impact

Git/dev updates keep using the plugin rebuilt with the host SDK, including when an older or same-version npm installation remains recorded. Named and bulk plugin updates and stable/beta source updates no longer reject that dormant record as an active package. Package-host updates retain their registry behavior. Selection notices appear in update outcomes and the existing update ledger.

Thanks @DonnieFi for the report and artifact-skew evidence.

Evidence

Head 7eebcd4a85098b782b5240b01c2c5000dd558161 includes the reviewed preflight fixup and passed CI run 34673248789. The exact-head watcher reports GREEN with zero pending checks; five superseded check records remain in the aggregate GitHub rollup. Native review-artifact validation and hosted CI/Testbox preparation passed without changing the head. Its predecessor 893e9d86523fdd8cd1a8ce4e33692eb189d39568 also passed CI run 34670330882.

The source-checkout boundary fixture covers older and equal-version npm records, the development selector present and absent, a corrupt dormant payload, explicit symlink selection, and an unbuilt source control. The original selection regression failed before the original repair. The added entrypoint regressions failed on 893e9d86523 before the preflight fixup:

node scripts/run-vitest.mjs src/commands/doctor/shared/post-core-plugin-convergence.source-checkout.test.ts
Before preflight fixup: 4 failed | 5 passed
Named CLI, --all, stable, beta: Plugin "codex" has no authoritative package-owner metadata.
After: 9 passed

node scripts/run-vitest.mjs src/commands/doctor/shared/post-core-plugin-convergence.source-checkout.test.ts src/cli/plugins-cli.update.test.ts src/plugins/update-cohort.test.ts src/plugins/update-cohort.integration.test.ts src/plugins/plugin-package-update.test.ts
88 tests passed across 5 files; 4 Vitest shards passed.

node scripts/check-changed.mjs
Passed, including core/test typechecks, changed-file lint, unused-export scans,
and zero runtime import cycles.

The CLI entrypoint cases use dry-run with real manifest selection, isolated persisted install records, ownership preflight, and updater behavior. The stable/beta cases execute release-cohort convergence against synthetic source and registry artifacts. Existing ambiguous-ownership and package-reconciliation regressions pass. A lint-only fixture rewrite preserved the same cases, and the final regression rerun passed all 9 tests. git diff --check passed. Independent review of the original patch and the preflight fixup is scoped-clean at P1; the intervening rebases were verified mechanical.

Previously recorded real-artifact replay through original and repaired post-core convergence, followed by a built-CLI Codex turn:

Before: Refreshed stale configured plugin "codex" from @openclaw/codex.
Import: does not provide an export named 'registerRetainedNativeHookRelayForBundledRuntime'
After: Kept bundled plugin "codex" from the OpenClaw source build;
       the registry artifact has no matching host SDK build identity.
Turn: QA_CODEX_AUTH_PRODUCT_PROOF_OK; harness codex; exit 0

That turn uses a synthetic app-server transport and isolated state without real provider credentials. Doctor also passes with the published post-core marker. Earlier validation passed 401 Doctor/updater tests, the focused status-only post-core cases, and all 153 public Plugin SDK build subpaths. These earlier results are supporting evidence, not a fresh full build of the fixup.

ClawSweeper review

  • Applied the dormant-install preflight finding in both update entrypoints, with failing-before/passing-after regressions. Active-package ownership remains strict.
  • Deferred the broader published-driver install/service-switch and fresh-install matrix. Existing explicit-path and unbuilt-source controls remain covered, but no full old-driver upgrade campaign is claimed. A previously recorded non-blocking harness-dispose warning remains after the successful synthetic turn.

No baselines, limits, or assertions were weakened. No dependencies, schema changes, or changelog edits were added.

@clawsweeper

clawsweeper Bot commented Sep 11, 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: L maintainer Maintainer-authored PR labels Sep 11, 2026
@steipete
steipete marked this pull request as ready for review September 11, 2026 22:32
@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. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 11, 2026
@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 12, 2026, 12:06 AM ET / 04:06 UTC (Revision 10).

ClawSweeper review

What this changes

The PR keeps host-built plugins selected on source installations, preserves dormant registry installs, and reports skipped refreshes during Doctor and plugin updates.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 3 items remain

This remains a useful repair for a current problem, but the previously reported ownership-preflight failure is still present at the unchanged head. The related draft offers a different approach and does not supersede this PR.

Priority: P1
Reviewed head: 893e9d86523fdd8cd1a8ce4e33692eb189d39568

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful artifact-level proof supports the repair, but the unresolved production-entrypoint failure prevents merge readiness.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The captured real-artifact replay exercises post-core convergence and a built-CLI turn, showing the former SDK import failure replaced by bundled selection and successful completion using synthetic app-server transport. It establishes the targeted artifact repair, while published-driver upgrade coverage remains a separate compatibility gate.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The captured real-artifact replay exercises post-core convergence and a built-CLI turn, showing the former SDK import failure replaced by bundled selection and successful completion using synthetic app-server transport. It establishes the targeted artifact repair, while published-driver upgrade coverage remains a separate compatibility gate.
Evidence reviewed 11 items Introduced selection change survives the test merge: The verified test merge has the pinned base and head as its recorded parents. Its diff introduces automatic source-checkout selection while leaving CLI ownership preflight, package ownership resolution, and release-cohort preflight unchanged.
Selected bundle cannot satisfy retained package ownership: The index builder derives ownership from the selected candidate. A bundled candidate has no ownership of the separate retained npm package; resolvePackage rejects that row, and resolveLifecycle also rejects it because the same plugin ID remains present.
CLI rejects before the new updater skip: runPluginUpdateCommandUnlocked resolves lifecycle ownership before selecting targets and capturing its package snapshot. Named updates and --all return the ownership error before updateNpmInstalledPlugins can emit source-bundled-plugin.
Findings 1 actionable finding [P1] [P1] Carry dormant-bundle selection through update preflight
Security None None.

How this fits together

OpenClaw’s plugin registry selects executable plugins from bundled builds, explicit paths, and tracked installations. Doctor and update commands consume that selection alongside install records to repair packages and prepare Gateway startup.

flowchart TD
  A[Host-built plugins] --> D[Plugin selection]
  B[Tracked registry installs] --> D
  C[Explicit plugin paths] --> D
  D --> E[Update ownership preflight]
  E --> F[Doctor and plugin convergence]
  F --> G[Payload checks and Gateway startup]
  B --> E
Loading

Before merge

  • [P1] Carry dormant-bundle selection through update preflight (P1) - With a compiled source bundle and a retained same-ID npm record, this fallback selects the bundle without the npm package’s owner metadata. plugins-update-command.ts consequently rejects named updates and --all with “has no authoritative package-owner metadata”; stable/beta convergePluginReleaseCohort throws while capturing its package snapshot. Both failures precede the new updater skip. Handle proven dormant records in these preflights without weakening active-package ownership checks, and cover both entrypoints. This repeats the prior late finding; the selection file is byte-identical to the earlier reviewed head.
  • Resolve merge risk (P1) - Stable/beta source installations also change from tracked registry packages to compiled bundles; published-driver upgrade and fresh-install controls covering those channels and explicit paths remain unprovided.
  • Complete next step (P2) - Repair dormant-bundle handling in CLI and release-cohort preflight, then complete the previously requested published-driver and fresh-install controls.

Findings

  • [P1] [P1] Carry dormant-bundle selection through update preflight — src/plugins/dev-source-root.ts:53-54
Agent review details

Security

None.

PR surface

Source +148, Tests +313, Docs +6. Total +467 across 18 files.

View PR surface stats
Area Files Added Removed Net
Source 11 197 49 +148
Tests 4 321 8 +313
Docs 3 8 2 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 18 526 59 +467

Review metrics

Metric Value Why it matters
Production versus regression coverage Production net +148 lines; tests net +313 lines The growth supports shared source selection and dormant-install handling, but the new boundary regression does not cover the failing update preflights.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor/shared/missing-configured-plugin-install.candidates.ts, migration/backfill/repair: src/commands/doctor/shared/missing-configured-plugin-install.repair.ts, migration/backfill/repair: src/commands/doctor/shared/post-core-plugin-convergence.ts, unknown-data-model-change: src/commands/doctor/shared/missing-configured-plugin-install.repair.ts. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #145266
Summary: Two open implementation candidates address the same reported SDK-skew failure with different install-record strategies.

Members:

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

Merge-risk options

Maintainer options:

  1. Carry dormant selection through preflight (recommended)
    Handle proven dormant installs before CLI and cohort ownership checks, preserve strict checks for active packages, and complete the upgrade controls.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Repair dormant source-bundle handling in plugin-update and release-cohort preflight without relaxing active-package ownership checks; add regressions through both entrypoints and retain the published-driver and fresh-install validation gate.

Technical review

Best possible solution:

Use one source-selection decision throughout update preflight, convergence, and payload checks, preserving active-package ownership safeguards and proving fresh and published-driver upgrade behavior.

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

Yes, from source: select a compiled source bundle with a retained same-ID npm record, then request a named plugin update, --all, or stable/beta cohort convergence. Ownership preflight rejects before the new skip; this read-only review did not execute tests.

Is this the best way to solve the issue?

Not yet: extending the existing selection owner is appropriate, but its consumers must consistently distinguish dormant installs before package ownership validation.

Full review comments:

  • [P1] [P1] Carry dormant-bundle selection through update preflight — src/plugins/dev-source-root.ts:53-54
    With a compiled source bundle and a retained same-ID npm record, this fallback selects the bundle without the npm package’s owner metadata. plugins-update-command.ts consequently rejects named updates and --all with “has no authoritative package-owner metadata”; stable/beta convergePluginReleaseCohort throws while capturing its package snapshot. Both failures precede the new updater skip. Handle proven dormant records in these preflights without weakening active-package ownership checks, and cover both entrypoints. This repeats the prior late finding; the selection file is byte-identical to the earlier reviewed head.
    Confidence: 0.98
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: The canonical report documents a source update that prevents every Codex-backed turn from completing.
  • merge-risk: 🚨 compatibility: Retaining npm records while selecting bundles makes existing plugin-update and stable/beta cohort preflights reject otherwise usable installations.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (terminal): The captured real-artifact replay exercises post-core convergence and a built-CLI turn, showing the former SDK import failure replaced by bundled selection and successful completion using synthetic app-server transport. It establishes the targeted artifact repair, while published-driver upgrade coverage remains a separate compatibility gate.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured real-artifact replay exercises post-core convergence and a built-CLI turn, showing the former SDK import failure replaced by bundled selection and successful completion using synthetic app-server transport. It establishes the targeted artifact repair, while published-driver upgrade coverage remains a separate compatibility gate.

Evidence

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs src/cli/plugins-cli.update.test.ts src/plugins/update-cohort.test.ts src/plugins/update-cohort.integration.test.ts.
  • [P1] node scripts/run-vitest.mjs src/commands/doctor/shared/post-core-plugin-convergence.source-checkout.test.ts src/commands/doctor/shared/missing-configured-plugin-install.test.ts src/plugins/update.test.ts.
  • [P1] node scripts/check-changed.mjs.
  • [P1] git diff --check.

What I checked:

  • Introduced selection change survives the test merge: The verified test merge has the pinned base and head as its recorded parents. Its diff introduces automatic source-checkout selection while leaving CLI ownership preflight, package ownership resolution, and release-cohort preflight unchanged. (src/plugins/dev-source-root.ts:53, 33976c1f37a4)
  • Selected bundle cannot satisfy retained package ownership: The index builder derives ownership from the selected candidate. A bundled candidate has no ownership of the separate retained npm package; resolvePackage rejects that row, and resolveLifecycle also rejects it because the same plugin ID remains present. (src/plugins/installed-plugin-package-ownership.ts:101, 893e9d86523f)
  • CLI rejects before the new updater skip: runPluginUpdateCommandUnlocked resolves lifecycle ownership before selecting targets and capturing its package snapshot. Named updates and --all return the ownership error before updateNpmInstalledPlugins can emit source-bundled-plugin. (src/cli/plugins-update-command.ts:255, 893e9d86523f)
  • Release-cohort preflight has the same failure: Stable/beta synchronization retains npm records when a bundle exists. convergePluginReleaseCohort then captures ownership for every retained install owner and throws on failure before invoking the updater. (src/plugins/update-cohort.ts:75, 893e9d86523f)
  • Prior finding continuity: The supplied completed review already reports this blocker at the current head. GitHub reports blob d359bdb03b6c0dc6184109ab584b08478c2aff1f for dev-source-root.ts at the earlier f28e947 review; git rev-parse reports the identical blob at HEAD. Earlier local objects were unavailable, so GitHub supplied this exact-file comparison. (src/plugins/dev-source-root.ts:53, 893e9d86523f)
  • Current main and release still need the repair: Both fetched main and v2026.9.4 retain the explicit-development-selector implementation; automatic selection of the running checkout’s compiled bundle is absent. The linked alternative remains open, not merged. (src/plugins/dev-source-root.ts:49, fec3b7de5df1)

Likely related people:

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

  • Repair dormant-install handling before CLI and release-cohort ownership preflight, with regressions through both entrypoints.
  • Complete the previously requested published-driver and fresh-install controls for stable/beta source selection and explicit plugin paths.

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 (9 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-11T23:03:40.373Z sha eb828a3 :: blocked before merge. :: none
  • reviewed 2026-09-11T23:43:09.593Z sha 9e1f7e8 :: blocked before merge. :: none
  • reviewed 2026-09-12T00:06:01.517Z sha 9e1f7e8 :: blocked before merge. :: none
  • reviewed 2026-09-12T00:46:19.576Z sha f28e947 :: blocked before merge. :: none
  • reviewed 2026-09-12T01:03:27.246Z sha f28e947 :: blocked before merge. :: none
  • reviewed 2026-09-12T02:24:24.283Z sha f28e947 :: blocked before merge. :: none
  • reviewed 2026-09-12T02:59:40.054Z sha c66c4a502db1dd16d02dd71a2af507578c25e773 :: blocked before merge. :: [P1] [P1] Carry dormant-bundle selection through update preflight
  • reviewed 2026-09-12T03:33:36.443Z sha 893e9d8 :: blocked before merge. :: [P1] [P1] Carry dormant-bundle selection through update preflight

@steipete
steipete force-pushed the steipete/upd-git-plugin-convergence branch from 9e1f7e8 to f28e947 Compare September 12, 2026 00:37
@steipete steipete closed this Sep 12, 2026
@steipete steipete reopened this Sep 12, 2026
@steipete
steipete force-pushed the steipete/upd-git-plugin-convergence branch from f28e947 to c66c4a5 Compare September 12, 2026 02:50
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 12, 2026
Prefer compiled plugins from the running source checkout during discovery,
Doctor convergence, updates, and payload verification. Preserve dormant npm
records and report why version equality cannot establish SDK compatibility.

Fixes #145266. Thanks @DonnieFi for the report and artifact-skew evidence.
Retain external install records for rebuilt source bundles while preserving the existing record retirement for ordinary bundled plugins. Extend the cleanup regression to a source checkout.
Read plugin outcome details only when present. The shipped post-core result reader accepts status-only acknowledgments, and collecting advisories must not turn that committed success into an update failure.
@steipete
steipete force-pushed the steipete/upd-git-plugin-convergence branch from c66c4a5 to 893e9d8 Compare September 12, 2026 03:25
Carry the existing source-build selection through named and bulk plugin
updates and stable/beta release-cohort preflight. Keep dormant registry
records available for unchanged notices without treating them as packages
to mutate; retain strict ownership checks for active package updates.

The four entrypoint regressions failed with missing package-owner metadata
before this change and now pass. Thanks @DonnieFi for the original report.

Refs #145266
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Addressed the dormant-install preflight finding in 7eebcd4. Named CLI, --all, and stable/beta cohort regressions fail before the fix and pass after it; 88 focused tests and the complete changed-file gate pass. The PR body records the remaining broader upgrade-matrix gap. Fresh CI for this head is being watched.

@clawsweeper

clawsweeper Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete
steipete merged commit fe05653 into main Sep 12, 2026
191 of 192 checks passed
@steipete
steipete deleted the steipete/upd-git-plugin-convergence branch September 12, 2026 04:50
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 13, 2026
… npm refreshes with a mismatched SDK (openclaw#145356)

Git/dev installations keep the plugin rebuilt from the running source checkout instead of refreshing a same-version npm build with a different Plugin SDK. Doctor records why the registry artifact was not admitted.

Manifest-registry selection owns bundle precedence and dormant install detection. Named plugin updates, --all, and stable/beta release-cohort convergence carry that decision through package-mutation preflight while retaining strict checks for active packages. Existing npm records remain available, explicit plugin paths retain priority, and package-host updates retain their registry behavior.

Fixes openclaw#145266

Thanks @DonnieFi for reporting the artifact skew and providing the reproduction evidence.
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 maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L 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.

[Bug]: Git/dev Doctor refreshes Codex from npm and shadows rebuilt bundled plugin (missing native-hook-relay export)

1 participant