Repository navigation
fix: custom packages retain stale installed plugins - #160099
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 28, 2026, 5:39 AM ET / 09:39 UTC (Revision 6). ClawSweeper reviewWhat this changesThe branch marks explicitly selected custom-package plugins as distribution-owned, restores packaging inputs and lifecycle receipts after use, and updates package and CI planner tests. Merge readiness⛔ Blocked before merge - 3 items remain Current main still leaves explicitly packaged plugins externally marked, so Doctor can retain a same-version managed npm copy. The proposed repair has focused upgrade evidence and no concrete patch finding; the change in ownership of existing installations needs maintainer acceptance before merge. Priority: P2 Review scores
Verification
How this fits togetherThe custom package builder takes an OpenClaw source tree and selected plugins and produces an installable archive. During an update, Doctor uses the packaged plugin metadata and existing managed npm records to choose the active plugin and clean up eligible shadows. flowchart LR
A[Source tree and selected plugins] --> B[Custom package builder]
B --> C[Installable archive]
C --> D[Updater]
D --> E[Doctor ownership check]
F[Managed npm records] --> E
E --> G[Active plugin and saved state]
Decision needed
Why: The update proof supports compatibility, but choosing who owns an existing installation is an intentional operator-impact decision that the PR body alone cannot approve. Before merge
Agent review detailsSecurityNone. PR surfaceTests +183, Docs +2, Other +49. Total +234 across 7 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the opt-in ownership handoff in the package builder and existing Doctor path, protect retained installations, and make same-version replacement clear to operators. Do we have a high-confidence way to reproduce the issue? Yes. Current-main packaging leaves the selected plugin externally marked, and Doctor excludes externally distributed plugins from managed-copy cleanup; the PR reports a published-updater reproduction. I did not execute the path in this read-only checkout. Is this the best way to solve the issue? Yes. Changing the existing ownership field at explicit package composition keeps Doctor as the cleanup owner and leaves ordinary packages unchanged; the ownership transfer still needs acceptance. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4dbabc40f6fd. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
dce1c2a to
b6eea5f
Compare
b6eea5f to
c8bf11b
Compare
|
Merged via squash.
|
* fix(packaging): adopt plugins selected for custom distributions * test: close composed-plugin state before cleanup * test: align CI planner fixtures with canonical owners * test: export forced-exit assertion for activation fixtures * test: compare selected CI owner execution policy
What Problem This Solves
Fixes custom packages built with
--bundle-pluginretaining an older managed npm plugin instead of adopting the plugin included with the host, even when both packages have the same version.User Impact
Doctor can now converge eligible managed npm copies onto explicitly included plugins while keeping plugin settings and data. This lets an unreleased host and its runtime plugins travel together without restoring retired SDK APIs. Retained installations keep their existing protection.
Maintainer decision: accept distribution ownership for plugins explicitly included with
--bundle-plugin, including retirement of an eligible same-version managed npm copy. This restores the existing composition-to-Doctor contract: the selected plugin ships as part of the host distribution, and Doctor remains the sole retirement owner. Matching package/plugin identity and retained-install marker protection remain required. This acceptance is scoped to the existing explicit composition option; ordinary package and separately installed plugin behavior stays unchanged.This affects explicit custom package composition. Ordinary core packages, separately published plugins, and the Docker selected-plugin contract retain their existing behavior. A core-only archive cannot supply matching unreleased plugin code.
Why This Change Was Made
The packer included selected plugin files and dependencies but preserved their external ownership metadata. Doctor therefore kept the tracked npm copy. Set the existing distribution-ownership fact on those selected package manifests before producing the archive inventory, then restore the original manifests and both inventories.
The same lifecycle review exposed incomplete restoration: the content inventory was left changed, and the packaging receipt could be released after subordinate restoration failed. The existing package owner now records those failures, settles cleanup in order, and retains its receipt when restoration is incomplete, including failures before a cleanup handle returns.
Evidence
Installed the immutable published Codex
2026.9.6artifact beside a current host and reproduced the missingagent-harness-task-runtimeexport from the actual managed generation. That same old runtime imports successfully with its matching published host. Current Codex source uses the replacement completion API; no upstream Codex protocol change is proposed.Real packer → same-version managed npm payload and persisted record → Doctor registry regression failed on the original producer and passes with distribution ownership. Five cleanup assertions also reproduced stale content inventory and early receipt release before the repair.
Canonical full build and
--bundle-plugin codexpackaging passed atb20cecab40981. Archive integrity/import-graph checks passed; all 13,545 regular archive members were audited, with no native executable or embedded Codex platform package. The target package manager installs the declared platform dependency.Actual published
2026.9.6 (eb377ac)updater → composed candidate passed all 13 native steps, including canary startup, package swap, Doctor, plugin convergence and final lint. Final CLI selection is bundled Codex; the stale active npm payload and record are gone; the naturally retained prior generation and marker are unchanged; authored configuration and workspace data survive. The selected harness's lazy agent-entry/monitor import succeeds.A
ce73f2c8f2a7main-package updater independently passed the same native path, final selection, record retirement, workspace and deep runtime imports. Doctor's existing implicit-roster migration adds onlyagents.entries.main = {}; the authored defaults remain unchanged. This was verified against the unchanged migration owner and recorded separately from raw JSON equality.Initial Windows CI exposed an open SQLite handle in the new test's cleanup after successful convergence. The fixture now drains its exact database through the existing async lifecycle before directory removal. The complete local file passes 67 tests with 3 platform skips; both restoration-failure cases, scoped type/lint checks and all three dead-export scans pass. No cleanup error is suppressed.
Test cost: explicit
node scripts/run-vitest.mjs test/e2e/qa-lab/runtime/package-openclaw-for-docker.e2e.test.ts --maxWorkers=1passed 67 tests with 3 platform skips in 338.594s wall (294.67s Vitest, 69% transformation). The successful Windows CI file took 45.608s, including 6.628s for the new convergence regression. These are observed full-file costs, not additional test duration attributed solely to this change.Independent P0–P2 reviews found no actionable findings. The packaging producer, PackageManifest, Doctor registry and install-record owners remain byte-identical through the controlled refreshes onto official
a62d769b3cefand267da052ea26; native package evidence stays explicitly bound tob20cecab40981, not a claimed new build.The next CI run passed every Windows shard but exposed two inherited planner-fixture defects: duplicate manifest-only plugin composition and a missing backend in the expected-owner helper. They also remain on
a62d769b3cef. This PR removes the redundant composition and passes the existing backend, preserving ownership and concurrency assertions. Pre-edit focused execution reproduced three failures; corrected backend cases pass, and the corrected ownership integration passes on clean Linux in 34.192s.Two other CI planning timeouts remain unexplained. Eight matched exact-base/executed-merge probes passed on four visible CPUs, 16 GB RAM, Node 24.21 and pnpm 12.5.1 without changing deadlines. The corrected candidate also passed dependency-free preflight (13.427s) and leaf-config ownership (87.594s). Whole-file ordering, concurrent CI work and its shared-cache settings were not reproduced; these observations are not a claimed timeout fix. See the base/merge environment and corrected-candidate environment. Both temporary environments were stopped.
A later tested main base exposed two additional updater-test wiring defects. The refresh to
267da052ea26reuses the already-landed VM closure fixa61b5214bc83. This PR exports the existing forced-exit assertion for two new standalone activation fixtures, with no assertion behavior change. The exact services typecheck reproduces both missing-export errors before the repair and passes afterward; the actual 19-case VM suite and four private activation/safety cases pass. The focused activation command took 132.69s wall, primarily transformation/setup; no new tests, retries or deadlines were added.The subsequent mixed UI/core planner failure was an incorrect comparison with full-job capacity: its full tooling group included a compiler test, while the selected group did not. The fixture now checks execution policy against the canonical selected owner and preserves full-template lineage, direct-consumer, exclusion, uniqueness, and opaque-owner assertions. A whole-file Linux run exercised the planner unit file, integration file and workflow guards together under normal scheduling: 651 passed and one failed in 631.514s. All 322 planner unit cases and all seven integration cases passed; the corrected case took 41.718s and leaf-config ownership took 65.357s. The only failure reproduced the existing 30-second dependency-free preflight child timeout under concurrent execution (30.107s), with no dependency-import violation. The overall run remains red; its cause is unresolved, and no timeout, worker override, retry or assertion weakening was added. Local types/lint and the independent review of the correction pass.
Required CI run 36401937080 passed on exact head
78b9cdb44d198: 92 successful jobs, 21 skipped, zero failures or unfinished jobs. All 53 Node jobs, all five Windows shards, lint,security-fast, andopenclaw/ci-gatepassed without rerunning or dispatching CI. This does not retroactively turn the separately recorded concurrent preflight timeout into a fix.These native proofs use private synthetic state and
--no-restart; they establish updater convergence and runtime import compatibility, not an authenticated model turn or Windows service handoff. Those remain deployment acceptance checks.Automatic node bootstrap was checked separately: it uses fresh digest-addressed runtimes and isolated per-lease state without this Gateway managed-plugin coexistence path. The Docker selected-plugin lane does not call this packer and intentionally retains external release metadata; no persistent-state Docker upgrade claim is made here.