Skip to content

fix(plugins): repair stale host packages after OpenClaw upgrades - #118304

Merged
steipete merged 3 commits into
mainfrom
codex/issue-108705-host-links
Aug 3, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/issue-108705-host-links

Conversation

@steipete

@steipete steipete commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Closes #108705

What Problem This Solves

Fixes an issue where users upgrading OpenClaw with an older npm-installed plugin could see the Codex plugin and other providers fail with missing host exports because a stale nested node_modules/openclaw copy continued loading an obsolete OpenClaw runtime.

Why This Change Was Made

The authoritative SQLite plugin-install registry now owns detection and repair of stale managed npm plugin host links. Doctor inspections report the exact problem without modifying files; doctor --fix, unchanged-version plugin updates, and post-core-update repair replace the obsolete nested host with the current canonical host for both peer and direct dependencies. Developer/path/git/ClawHub/marketplace installations, unknown manifests, out-of-root symlinks, and ambiguous ownership remain untouched.

User Impact

Upgraded installations recover broken provider plugins at the existing doctor/update repair boundaries without reinstalling plugins, changing runtime fallback behavior, or risking developer-owned plugin directories.

Evidence

  • Reproduced the reporter exact shipped v2026.7.1 legacy ~/.openclaw/extensions/email/node_modules/openclaw package against the authoritative installed-plugin SQLite index; current main does not repair it.
  • Real filesystem regressions prove doctor inspection vs repair, unchanged-version updates, post-core repair before provider smoke checks, peer/direct dependency parity, two consecutive stale plugins, malicious/out-of-root symlinks, malformed sibling manifests, and every non-npm ownership boundary.
  • Exact rebased head 7951bf9ad511dfe5c8c2bbc944d73758258b0875: 11 complete affected suites / 471 tests passed, including the already-landed fix(auth): retain the selected account when migrating Codex sessions #118205 selected-account OAuth, SQLite-session, and actual /status migration regressions.
  • Fresh trusted Testbox full unbypassed corepack pnpm check:changed passed: production and core-test typechecks, 17-file format, every changed-core lint shard (zero warnings/errors), plugin SDK/boundary guards, dead-export checks, database-first guards, and import-cycle checks.
  • Fresh independent xhigh P0-P2 autoreview found no actionable findings; separate deep review verified every registry/path/symlink ownership and the preserved fix(auth): retain the selected account when migrating Codex sessions #118205 account-selection contract.

Follow-up security and ownership correction

A fresh ClawSweeper review correctly identified that the inherited post-installer repair loop trusted an arbitrary configured npm install path. The follow-up removes that destructive path entirely: every post-update host repair now flows through the same canonical SQLite-derived registered-install owner, accepting only an npm record at its exact managed state/extensions/<pluginId> root and canonical realpath. Real filesystem regressions prove external packages, out-of-root aliases, in-root developer aliases, developer/path installs, Marketplace packages, and ClawHub packages are never modified; malformed sibling packages and broken links do not block valid siblings. Modern managed npm project repair remains owned by its existing installer.

The follow-up also reads bounded package manifests through the existing src/infra/json-files.ts policy owner, fixing the previously failing hosted fs-safe-import-boundary shard without suppressing its check.

Exact follow-up validation: 578/578 tests across 14 complete affected suites, 2/2 real packaged npm installs against a real local HTTP registry, and a fresh full unbypassed pnpm check:changed (production/core-test typechecks, all lint shards with zero warnings, formatting, SDK/plugin boundaries, Knip, SQLite/schema guards, and runtime import cycles). Fresh independent xhigh autoreview inspected the complete effective 17-file PR plus the security correction and found zero P0/P1/P2 findings.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes commands Command implementations size: XL maintainer Maintainer-authored PR labels Aug 2, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Aug 2, 2026
@clawsweeper

clawsweeper Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 8:43 PM ET / August 3, 2026, 00:43 UTC.

ClawSweeper review

What this changes

Repairs stale nested openclaw host packages for registered npm plugins during Doctor, plugin updates, and post-core-update convergence without touching developer-owned or out-of-root installations.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open. Current main repairs host links only inside managed npm project roots, while this PR adds the missing registered legacy state/extensions/&lt;pluginId> repair path and resolves the prior arbitrary-path mutation finding with exact record, root, and realpath checks. The protected maintainer label and upgrade-time filesystem mutation still require a maintainer security-boundary decision before landing.

Priority: P1
Reviewed head: c7547e2d7f68765d09e25a7cc2c8ba75a0697669
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch has focused source and ownership-boundary coverage plus reported real-install proof; the remaining gate is maintainer acceptance of automatic legacy-state repair semantics.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR body provides after-fix real packaged npm-install evidence and states that the final head exercised two real local-registry installs plus filesystem repair scenarios; redact private paths or registry details if additional evidence is posted.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body provides after-fix real packaged npm-install evidence and states that the final head exercised two real local-registry installs plus filesystem repair scenarios; redact private paths or registry details if additional evidence is posted.
Evidence reviewed 7 items Current-main gap: Current main's post-core convergence repairs only managed npm project roots via relinkOpenClawPeerDependenciesInManagedNpmRoot; it has no registered extensions-root reconciliation, so the reported legacy install remains uncovered.
Canonical repair boundary: The PR accepts only npm records whose resolved install path exactly equals the plugin-id-derived directory, whose realpath stays inside the extensions root, and whose realpath is exactly the expected path before it can inspect or relink a host dependency.
Post-update owner uses the constrained reconciler: The PR routes legacy registered installs through the same constrained reconciler before the active-plugin payload smoke check, while retaining the existing managed-npm-root repair path.
Findings None None.
Security None None.

How this fits together

OpenClaw stores installed-plugin records in its state index and loads plugin packages from managed roots. Doctor and update convergence inspect those records, repair a stale plugin-local host package when the installation is proven to be OpenClaw-managed, then run payload checks before the gateway uses the plugin.

flowchart TD
  A[Installed plugin index] --> B[Registered npm install record]
  B --> C[Exact extensions-root and realpath checks]
  C --> D[Inspect package host dependency]
  D --> E[Repair stale nested OpenClaw host link]
  E --> F[Doctor or update convergence]
  F --> G[Payload smoke check]
  G --> H[Gateway loads healthy plugin]
Loading

Decision needed

Question Recommendation
Does the exact registered npm record plus expected extensions-root realpath predicate provide the intended authorization boundary for replacing a stale nested openclaw package during Doctor and update repair? Confirm the constrained repair boundary: Accept repair only for authoritative npm records at their exact canonical extensions-root path, then merge after normal current-head checks complete.

Why: The patch performs destructive repair of user-local plugin directories; source review shows the requested narrowing, but repository policy reserves larger ownership and security-boundary changes for maintainer judgment, and Codex-specific source validation could not be completed locally.

Before merge

  • Resolve merge risk (P1) - This intentionally changes upgrade-time filesystem repair: a stale copied nested openclaw directory may be replaced with a canonical host link, so maintainers must accept the exact registered-root and realpath predicate as the ownership boundary.
  • Resolve merge risk (P1) - The affected report concerns the Codex plugin, but the sibling Codex checkout required by repository policy was unavailable and GitHub DNS prevented obtaining it; the remaining Codex-specific runtime contract check needs an environment with that source available.
Agent review details

Security

None.

PR surface

Source +250, Tests +734. Total +984 across 17 files.

View PR surface stats
Area Files Added Removed Net
Source 10 553 303 +250
Tests 7 795 61 +734
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 17 1348 364 +984

Review metrics

None.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor-config-flow.test.ts, migration/backfill/repair: src/commands/doctor-plugin-host-links.test.ts, migration/backfill/repair: src/commands/doctor-plugin-host-links.ts, migration/backfill/repair: src/commands/doctor-plugin-registry.ts, migration/backfill/repair: src/commands/doctor/repair-sequencing.test.ts, migration/backfill/repair: src/commands/doctor/repair-sequencing.ts, and 10 more. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #108705
Summary: This PR is a concrete candidate repair for the open stale-host-package regression described in the linked issue; current main still lacks the registered legacy-install repair path.

Members:

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

Merge-risk options

Maintainer options:

  1. Confirm exact-root repair semantics before merge (recommended)
    Accept the upgrade repair only if maintainers agree that a registered npm record plus canonical root and realpath checks establishes OpenClaw ownership of the nested host package.
  2. Keep repair explicit-only
    If automatic replacement is too broad for legacy installations, narrow the change to Doctor's explicit repair path and document the operator-visible recovery.

Technical review

Best possible solution:

Land the canonical SQLite-record and exact-realpath repair only after a maintainer confirms that registered npm installs at the exact state/extensions/<pluginId> path are OpenClaw-owned upgrade state and accepts the bounded replacement behavior.

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

Yes, source reproducibly shows the gap: current main repairs managed npm project roots but not registered legacy npm installs under the extensions root; the PR adds focused filesystem regressions for that state.

Is this the best way to solve the issue?

Yes, subject to the maintainer ownership decision: routing all legacy repair paths through the SQLite-record-derived exact-root reconciler is safer than the earlier arbitrary install-path loop and keeps developer-owned installs out of scope.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 18c9f27e2de3.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides after-fix real packaged npm-install evidence and states that the final head exercised two real local-registry installs plus filesystem repair scenarios; redact private paths or registry details if additional evidence is posted.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: A stale host package can make an upgraded provider plugin fail before an agent reply, affecting an existing user workflow.
  • merge-risk: 🚨 compatibility: The PR changes post-upgrade and unchanged-version plugin repair behavior for existing local installations.
  • merge-risk: 🚨 security-boundary: The repair can replace a local nested package, so correctness depends on the new ledger, canonical-root, and realpath ownership checks.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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 body provides after-fix real packaged npm-install evidence and states that the final head exercised two real local-registry installs plus filesystem repair scenarios; redact private paths or registry details if additional evidence is posted.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix real packaged npm-install evidence and states that the final head exercised two real local-registry installs plus filesystem repair scenarios; redact private paths or registry details if additional evidence is posted.

Evidence

What I checked:

  • Current-main gap: Current main's post-core convergence repairs only managed npm project roots via relinkOpenClawPeerDependenciesInManagedNpmRoot; it has no registered extensions-root reconciliation, so the reported legacy install remains uncovered. (src/cli/update-cli/post-core-plugin-convergence.ts:63, 18c9f27e2de3)
  • Canonical repair boundary: The PR accepts only npm records whose resolved install path exactly equals the plugin-id-derived directory, whose realpath stays inside the extensions root, and whose realpath is exactly the expected path before it can inspect or relink a host dependency. (src/plugins/plugin-peer-link.ts:391, c7547e2d7f68)
  • Post-update owner uses the constrained reconciler: The PR routes legacy registered installs through the same constrained reconciler before the active-plugin payload smoke check, while retaining the existing managed-npm-root repair path. (src/cli/update-cli/post-core-plugin-convergence.ts:69, c7547e2d7f68)
  • Prior review finding addressed: The follow-up commit is explicitly titled fix(plugins): constrain host repair to registered install roots; its implementation replaces the formerly broad post-update repair ownership with the exact-root reconciliation above. (src/plugins/plugin-peer-link.ts:428, c7547e2d7f68)
  • Feature-history routing: Local history identifies Vincent Koc's merged fix(plugins): relink host runtime dependencies commit as the earlier mainline owner trail; Peter Steinberger has the largest local shortlog footprint across the affected plugin files and authored the current repair series. (src/plugins/plugin-peer-link.ts:391, 355295bfef4a)
  • Release status: The candidate repair commit is not on current main and therefore cannot be in the current release; the checked-out main head is 18c9f27e2de3cb1d3ac6555588a356d56c6fd9bb. (src/cli/update-cli/post-core-plugin-convergence.ts:63, 18c9f27e2de3)

Likely related people:

  • Peter Steinberger: Local shortlog shows the strongest contribution trail across the affected plugin repair files, and the current three-commit repair series is authored by him. (role: recent area contributor and current repair author; confidence: high; commits: c7547e2d7f68, 7951bf9ad511, fa8a1335c265; files: src/plugins/plugin-peer-link.ts, src/commands/doctor-plugin-host-links.ts, src/cli/update-cli/post-core-plugin-convergence.ts)
  • Vincent Koc: Local feature history identifies the merged fix(plugins): relink host runtime dependencies commit as an earlier owner of the managed host-link behavior this PR extends. (role: earlier host-link implementation contributor; confidence: medium; commits: 355295bfef4a; files: src/plugins/plugin-peer-link.ts, src/plugins/update-config.ts)

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 (1 earlier review cycle)
  • reviewed 2026-08-02T23:52:30.688Z sha 7951bf9 :: found issues before merge. :: [P1] Constrain post-update host repairs to registered install roots

@clawsweeper clawsweeper Bot added 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. and removed 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. labels Aug 3, 2026
@steipete
steipete merged commit 6ee406b into main Aug 3, 2026
134 of 140 checks passed
@steipete
steipete deleted the codex/issue-108705-host-links branch August 3, 2026 01:10
@steipete

steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 3, 2026
…nclaw#118304)

* fix(plugins): repair stale registered host package links

* refactor(plugins): isolate authoritative host-link repair owners

* fix(plugins): constrain host repair to registered install roots
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 maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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.

[Bug]: 2026.7.1 — Codex plugin fails: "does not provide an export named 'formatToolExecutionErrorMessage'" in agent-harness-runtime

1 participant