fix(plugins): preserve host package during peer repair#82289
Conversation
|
Codex review: needs maintainer review before merge. Summary Reproducibility: yes. at source level: current main returns before scrubbing stale managed-root Real behavior proof Next step before merge Security Review detailsBest possible solution: Land this PR after required CI and maintainer approval, keeping the fix scoped to managed-root metadata cleanup, stable runtime aliasing, and the narrow Telegram no-config guard. Do we have a high-confidence way to reproduce the issue? Yes at source level: current main returns before scrubbing stale managed-root Is this the best way to solve the issue? Yes: the PR uses the existing scrub path but adds a narrow preserve-package-dir mode for linked active hosts, and the hook-runner alias follows the established stable-runtime compatibility pattern. I found no safer narrower fix in the inspected code path. What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 3064d6181d18. |
cab9688 to
ea69d45
Compare
ea69d45 to
e1d8093
Compare
fcbca2d to
d22a903
Compare
d22a903 to
127bde8
Compare
|
Verification before merge:
Known proof note: the Crabbox package/runtime proof was on the same code line before the final clean rebase; the final head also has exact-head GitHub CI green. |
Summary
openclawhost packages while scrubbing stale managed-root package/lock/bin ownership metadataplugins/hook-runner-globaldist entry plus thehook-runner-global-B8rMIo8I.jslegacy alias for package-swap shutdown compatibilityVerification
OPENCLAW_VITEST_FS_MODULE_CACHE_PATH="$PWD/.vitest-cache-package-atomicity" node scripts/run-vitest.mjs src/infra/npm-managed-root.test.ts test/scripts/runtime-postbuild.test.ts src/infra/tsdown-config.test.ts extensions/telegram/src/polling-session.test.ts(4 files, 77 tests passed)git diff --check origin/main...HEADrun_9d948db51781oncbx_24f1a9cbc577:pnpm check:changedpassed, thenpnpm buildpassed on the pre-rebase code head; final head only rebased the changelog over newermain, and GitHub CI is running one1d8093eda30db4caec148670080dbe31cb68e7eBehavior addressed: managed plugin installs no longer let npm uninstall or replace a linked npm-global
openclawhost package; running gateways can resolve the shutdown hook-runner chunk after package swaps.Real environment tested: fresh Linux PR checkout via Crabbox on
cbx_24f1a9cbc577.Exact steps or command run after this patch:
env CI=1 NODE_OPTIONS=--max-old-space-size=4096 OPENCLAW_TEST_PROJECTS_PARALLEL=6 OPENCLAW_VITEST_MAX_WORKERS=1 OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS=900000 pnpm check:changed; pnpm build.Evidence after fix: Crabbox run
run_9d948db51781completed with exit code 0; command phases:check_changed3m12s,build54s.Observed result after fix: linked active host packages are preserved while stale managed metadata is removed; runtime postbuild writes the legacy hook-runner alias to the new stable plugin entry; changed gate and build pass from a full fresh PR checkout.
What was not tested: live npm-global package upgrade against a real user home directory; covered here by unit-level filesystem reproduction plus package/build gates.
Fixes #79462.
Fixes #81819.