Skip to content

fix: custom packages retain stale installed plugins - #160099

Merged
steipete merged 5 commits into
mainfrom
codex/composed-plugin-cohort
Sep 28, 2026
Merged

steipete merged 5 commits into
mainfrom
codex/composed-plugin-cohort

Conversation

@steipete

@steipete steipete commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes custom packages built with --bundle-plugin retaining 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.6 artifact beside a current host and reproduced the missing agent-harness-task-runtime export 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 codex packaging passed at b20cecab40981. 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 ce73f2c8f2a7 main-package updater independently passed the same native path, final selection, record retirement, workspace and deep runtime imports. Doctor's existing implicit-roster migration adds only agents.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=1 passed 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 a62d769b3cef and 267da052ea26; native package evidence stays explicitly bound to b20cecab40981, 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 267da052ea26 reuses the already-landed VM closure fix a61b5214bc83. 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, and openclaw/ci-gate passed 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.

@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime scripts Repository scripts docker Docker and sandbox tooling size: M labels Sep 28, 2026
@steipete
steipete marked this pull request as ready for review September 28, 2026 04:32
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 28, 2026, 5:39 AM ET / 09:39 UTC (Revision 6).

ClawSweeper review

What this changes

The 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
Reviewed head: 78b9cdb44d198f67b7519a49bcd16412360db08b
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused repair and published-updater exercise support a good patch; the intentional upgrade ownership change awaits maintainer acceptance.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR reports a published v2026.9.6 updater exercising the custom archive and Doctor against a same-version managed plugin: bundled selection succeeds, the eligible managed payload and record retire, and configuration, workspace data, and retained prior state survive. The production packaging files are unchanged since that exercised implementation; no stored schema changes, and the reported existing-state upgrade verifies the record transition. Authenticated model turns and Windows service handoff were outside this packaging proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR reports a published v2026.9.6 updater exercising the custom archive and Doctor against a same-version managed plugin: bundled selection succeeds, the eligible managed payload and record retire, and configuration, workspace data, and retained prior state survive. The production packaging files are unchanged since that exercised implementation; no stored schema changes, and the reported existing-state upgrade verifies the record transition. Authenticated model turns and Windows service handoff were outside this packaging proof.
Evidence reviewed 8 items Introduced ownership change: The pinned PR hunk sets bundledDist only on explicitly selected built plugin manifests and restores their original bytes after packaging.
Current-main ownership contract: Doctor excludes externally distributed plugins from managed npm shadow cleanup; bundledDist=true makes a packaged plugin distribution-owned. Current main's package builder does not set that field for custom selections.
Doctor cleanup safeguards: Doctor limits cleanup to matching @openclaw managed npm packages and plugin IDs, and skips packages with retained-install markers.
Findings None None.
Security None None.

How this fits together

The 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]
Loading

Decision needed

Question Recommendation
Should installing a custom package with --bundle-plugin transfer ownership of that plugin from an eligible managed npm installation to the package, including when versions match? Accept the opt-in transfer: Approve replacement for explicitly included plugins while retaining the marker safeguard and documented update behavior.

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

  • Resolve merge risk (P1) - An explicitly composed package now retires an eligible managed npm plugin during upgrade even when its version matches; maintainers have not explicitly accepted that operator-visible ownership transfer.
  • Complete next step (P2) - Obtain maintainer acceptance of the custom package's ownership transfer over eligible managed npm plugin installations.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
Agent review details

Security

None.

PR surface

Tests +183, Docs +2, Other +49. Total +234 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 3 211 28 +183
Docs 1 3 1 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 3 65 16 +49
Total 7 279 45 +234

Review metrics

Metric Value Why it matters
Production and test growth production +49 net lines; tests +183 net lines Production growth implements manifest restoration and receipt retention, with regression coverage at the package-to-Doctor boundary.
Reported regression test cost 6.628 s new Windows case; 45.608 s full Windows file The PR reports the new case's measured CI cost separately from the existing suite's total.

Merge-risk options

Maintainer options:

  1. Accept explicit package ownership (recommended)
    Approve retirement of eligible managed npm copies for explicitly selected plugins, based on the published-updater proof and retained-install safeguard.
  2. Pause this upgrade behavior
    Hold the PR if managed npm ownership must remain the default even for a custom package that explicitly includes the same plugin.

Technical review

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The defect affects explicitly composed custom packages rather than ordinary installations.
  • merge-risk: 🚨 compatibility: The package can replace an existing managed npm plugin during upgrade despite an unchanged version string.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR reports a published v2026.9.6 updater exercising the custom archive and Doctor against a same-version managed plugin: bundled selection succeeds, the eligible managed payload and record retire, and configuration, workspace data, and retained prior state survive. The production packaging files are unchanged since that exercised implementation; no stored schema changes, and the reported existing-state upgrade verifies the record transition. Authenticated model turns and Windows service handoff were outside this packaging proof.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR reports a published v2026.9.6 updater exercising the custom archive and Doctor against a same-version managed plugin: bundled selection succeeds, the eligible managed payload and record retire, and configuration, workspace data, and retained prior state survive. The production packaging files are unchanged since that exercised implementation; no stored schema changes, and the reported existing-state upgrade verifies the record transition. Authenticated model turns and Windows service handoff were outside this packaging proof.

Evidence

What I checked:

  • Introduced ownership change: The pinned PR hunk sets bundledDist only on explicitly selected built plugin manifests and restores their original bytes after packaging. (scripts/lib/package-bundled-plugins.mts:140, 78b9cdb44d19)
  • Current-main ownership contract: Doctor excludes externally distributed plugins from managed npm shadow cleanup; bundledDist=true makes a packaged plugin distribution-owned. Current main's package builder does not set that field for custom selections. (src/plugins/official-external-plugin-catalog.ts:543, 4dbabc40f6fd)
  • Doctor cleanup safeguards: Doctor limits cleanup to matching @openclaw managed npm packages and plugin IDs, and skips packages with retained-install markers. (src/commands/doctor-plugin-registry.ts:158, 4dbabc40f6fd)
  • Regression coverage: The added package-to-Doctor test checks same-version managed-copy retirement, persisted record removal, bundled selection, and restoration of the source plugin manifest. (test/e2e/qa-lab/runtime/package-openclaw-for-docker.e2e.test.ts:254, 78b9cdb44d19)
  • Reported native upgrade proof: The captured PR body reports a published v2026.9.6 updater driving the composed candidate through package swap and Doctor: the bundled Codex plugin becomes active, the stale managed payload and record disappear, and configuration, workspace data, and a retained prior generation survive. This proof is bound to an earlier production implementation; the two production packaging files are unchanged from commit c67fa5d to the reviewed head. (78b9cdb44d19)
  • Feature-history routing: Recent main history names Peter Steinberger on custom packaging and plugin custody, Ayaan Zaidi on package lifecycle restoration, and Vincent Koc on packed-tarball cleanup. Source-line introduction could not be established from the partial local history. (scripts/package-openclaw-for-docker.mts, 4dbabc40f6fd)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (5 earlier review cycles)
  • reviewed 2026-09-28T04:33:25.513Z sha b20cecab40981c2d2fcf4e4a389826a1c02a45a2 :: blocked before merge. :: none
  • reviewed 2026-09-28T05:40:42.940Z sha dce1c2a5adbb4cdb25d79aaf2166b3b4dca6e19c :: needs maintainer review before merge. :: none
  • reviewed 2026-09-28T07:20:38.432Z sha b6eea5f :: needs changes before merge. :: none
  • reviewed 2026-09-28T07:56:09.647Z sha c8bf11b :: needs changes before merge. :: none
  • reviewed 2026-09-28T09:19:56.380Z sha 78b9cdb :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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 28, 2026
@steipete
steipete enabled auto-merge (squash) September 28, 2026 05:53
@steipete
steipete disabled auto-merge September 28, 2026 06:15
@steipete
steipete force-pushed the codex/composed-plugin-cohort branch from dce1c2a to b6eea5f Compare September 28, 2026 07:11
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 28, 2026
@steipete
steipete force-pushed the codex/composed-plugin-cohort branch from b6eea5f to c8bf11b Compare September 28, 2026 07:48
@steipete
steipete merged commit 2c97229 into main Sep 28, 2026
179 checks passed
@steipete
steipete deleted the codex/composed-plugin-cohort branch September 28, 2026 09:47
@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 29, 2026
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docker Docker and sandbox tooling docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: M 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