Skip to content

fix(update): keep bundled plugin aliases bundled in candidate rehearsal - #143190

Merged
steipete merged 3 commits into
mainfrom
steipete/upd-candidate-provenance
Sep 9, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/upd-candidate-provenance

Conversation

@steipete

@steipete steipete commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Refs #142633

Additional instructions

Maintainers can update this same-repository branch.

What Problem This Solves

Fixes an issue where users running openclaw update with path-install aliases of bundled plugins can have the candidate Gateway reject a plugin that the serving Gateway loads as bundled. This can prevent candidate readiness and block the update.

Why This Change Was Made

Copying a bundled alias into independent storage changed discovery to origin=global and trust.reason=origin-path. Candidate projection now redirects only physically verified bundled plugin roots and entrypoints to the staged bundled plugin with the same manifest ID, using runtime directory selection for source-checkout and split-runtime layouts.

Source metadata inspection stays read-only, and candidate containment is checked before discovery. External paths, escaping aliases, and absent or mismatched staged plugin IDs retain the existing independent-copy path and trust policy. Install-record source values are unchanged.

User Impact

Candidate rehearsal preserves bundled ownership for these aliases while keeping external path installations subject to their existing trust restrictions. Live plugin files, permissions, install records, and host links remain untouched. The update workflow documentation describes this behavior.

Evidence

The regression runs the real rehearsal snapshot worker and then real manifest discovery against synthetic plugin packages and SQLite state. With the production fix temporarily reversed against the branch base, the directory-alias regression fails with:

- origin: bundled
+ origin: global
  installSource: path
- trust.reason: bundled
+ trust.reason: origin-path
Test Files 1 failed; Tests 1 failed, 11 skipped

The repaired regression matrix covers direct and symlink aliases, entrypoints, renamed staged directories, split runtime and source-checkout layouts, external paths, source/candidate symlink escapes, absent/mismatched IDs, and preservation of live permissions and database bytes. A separate before/after regression proves a candidate bundled-root symlink cannot change permissions outside the staged package during projection.

Focused validation: 205 tests passed across 9 files, including a real built Gateway reaching started/ready and verified process-group/state cleanup. The test runner rebuilt the final runtime successfully. The final provenance-only rerun passed all 13 cases; changed-file checks, including production/test typechecks and lint, also passed.

node scripts/run-vitest.mjs \
  src/infra/update-candidate-bundled-provenance.test.ts \
  src/infra/update-candidate-state.test.ts \
  src/infra/update-candidate-canary.test.ts \
  src/infra/update-candidate-canary.integration.test.ts \
  src/plugins/discovery.test.ts \
  src/plugins/discovery-threading.test.ts \
  src/plugins/discovery-checkout.test.ts \
  src/plugins/bundled-discovery-state.test.ts \
  src/plugins/plugin-discovery-ordering.test.ts
node scripts/run-vitest.mjs src/infra/update-candidate-bundled-provenance.test.ts
node scripts/check-changed.mjs
node scripts/check-docs-mdx.mjs docs/cli/update/how-updates-run.md
git diff --check

CI completed on 66b62610dace56cdfa1466523d35285bef0aca88 with 131 checks passed and 50 skipped. CI is not green: checks-node-changed-extensions-bundle-27 failed in the unchanged extensions/telegram/src/model-callback.loopback.integration.test.ts:245, receiving HttpError: Network request for 'editMessageText' failed!; the aggregate openclaw/ci-gate consequently failed too. This test exercises the Telegram callback router against a local HTTP server and does not invoke candidate projection. This branch changes no Telegram files; the failure is recorded for separate follow-up.

Known Gaps

This repairs the reproduced bundled-alias projection defect. The earlier snapshot ENOENT, unexplained npm canary exits, and isolated xAI repair-auth failure reported in #142633 remain unresolved. The synthetic proof does not establish that every reported update failure has this cause, so this PR references the issue rather than closing it.

Credit

Reported by @DonnieFi in #142633.

Review notes

Live persisted state and install records remain untouched. There are no persisted-state, install-record, or config schema changes. Candidate projection redirects only aliases whose realpaths belong to the running package's bundled roots and whose discovery identity and entry name match a staged bundled entry. External path installs retain their existing copy and trust behavior.

The accepted fallback-root finding is repaired at the scan owners: source and candidate fallback roots are admitted before enumeration, diagnostics, or permission repair, and source metadata loading also checks package containment. The accepted multi-entry finding is repaired by sharing discovery's runtime entry enumeration, ID derivation, and collision handling. Declared and runtime paths stay paired; unmatched entries keep the existing copy path. A whole-package alias redirects only when every entry matches one candidate package.

The original 13 regression cases are: directory; source permissions; symlink; entrypoint; renamed candidate directory; split candidate runtime; source checkout alongside built runtime; external path; source symlink escaping the bundled directory; candidate symlink escaping the bundled directory; candidate bundled root escaping the package; missing candidate ID; mismatched candidate ID.

Added coverage: valid in-package candidate fallback; escaping candidate fallback; escaping candidate fallback with an external install; no enumeration of an outside source fallback; no enumeration of an outside candidate fallback; complete multi-entry redirect; and a missing candidate entry with matching siblings preserved. The fallback regressions failed before the containment fix, and both multi-entry regressions failed before the entry-mapping fix. All 20 provenance cases now pass. The requested suites plus shared entry-resolver consumer tests passed 262 tests across 12 files; changed-file checks passed before rebase.

The three-commit series was rebased without conflicts onto main containing #143197 and #143213. git range-diff reports all three patches unchanged; no hunk changed beyond rebase offsets.

Post-rebase node scripts/check-changed.mjs passed on f02b5484e8ab6f385e6ba98e7268b5e5e74e3fb5. The earlier CI failure above describes the old head; this head includes the Telegram and Windows fixture fixes from main and received a fresh CI run.

Fresh exact-head CI passed on f02b5484e8ab6f385e6ba98e7268b5e5e74e3fb5: run 34380528777. node scripts/watch-pr-ci.mjs 143190 f02b5484e8ab6f385e6ba98e7268b5e5e74e3fb5 exited successfully with STATUS state=SUCCESS pending=0 and GREEN; no rerun was needed. ClawSweeper's exact-head review found no actionable findings or remaining Before merge items, and the requested re-review comment has been posted.

@clawsweeper

clawsweeper Bot commented Sep 9, 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 size: M maintainer Maintainer-authored PR labels Sep 9, 2026
@steipete
steipete marked this pull request as ready for review September 9, 2026 14:45
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. 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 9, 2026
@clawsweeper

clawsweeper Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 9, 2026, 2:05 PM ET / 18:05 UTC (Revision 5).

ClawSweeper review

What this changes

Preserve bundled-plugin trust during update rehearsal by redirecting verified path aliases to matching staged plugins, while retaining independent copies for external or unmatched entries.

Merge readiness

✅ Ready for maintainer review

The fix remains necessary: current main still loses bundled provenance during candidate copying. The previous fallback-root finding is resolved, and this review found no remaining actionable defects.

Priority: P1
Reviewed head: f02b5484e8ab6f385e6ba98e7268b5e5e74e3fb5

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful boundary evidence, resolved prior findings, and successful exact-head CI.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The supplied before/after evidence exercises candidate projection through the real snapshot worker and manifest discovery using actual filesystem and SQLite fixtures, observing staged bundled selection, external-path isolation, and unchanged live state. The separate Gateway readiness run is supplemental and does not establish that all linked update failures are fixed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The supplied before/after evidence exercises candidate projection through the real snapshot worker and manifest discovery using actual filesystem and SQLite fixtures, observing staged bundled selection, external-path isolation, and unchanged live state. The separate Gateway readiness run is supplemental and does not establish that all linked update failures are fixed.
Evidence reviewed 9 items Current main still needs the repair: Current main copies all existing plugin locators into independent candidate storage without the branch's bundled redirect step.
Latest release retains the same copying behavior: The v2026.9.3 source also lacks bundled alias redirection; no shipped fix was established.
Contained identity-based projection: Redirects require physically contained source and candidate roots, matching discovery identities and entry names, and contained entry files. Whole-package redirects require every entry to match one candidate package; other locators retain the existing copy path.
Findings None None.
Security None None.

How this fits together

The updater rehearses a staged OpenClaw release against isolated copies of configuration, databases, and installed plugins. Plugin discovery then determines which code the candidate Gateway loads and which trusted capabilities it receives.

flowchart TD
  A[Installed plugin paths] --> B[Verify physical bundled ownership]
  C[Staged plugin inventory] --> D[Match plugin identity and entries]
  B --> D
  D -->|Verified match| E[Use staged bundled plugin]
  D -->|External or unmatched| F[Copy plugin into isolated state]
  E --> G[Candidate discovery and readiness]
  F --> G
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +159, Tests +413, Docs +2. Total +574 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 5 205 46 +159
Tests 1 413 0 +413
Docs 1 5 3 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 623 49 +574

Review metrics

Metric Value Why it matters
Production versus regression coverage Production net +159 lines; tests +413 lines Production growth supports contained alias mapping and shared discovery entry resolution, with regression coverage for trust and live-state preservation.

Technical review

Best possible solution:

Keep candidate aliases bound to verified staged bundled code while preserving external-plugin restrictions and the serving installation's state.

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

Yes: current-main copying moves a bundled path alias outside bundled roots, where discovery classifies it as an external path install. The supplied before/after regression demonstrates that transition; this review did not execute it.

Is this the best way to solve the issue?

Yes: repairing candidate projection preserves the existing trust contract without weakening runtime capabilities, changing live install records, or adding configuration.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: A reported supported update fails candidate readiness when an existing bundled plugin alias loses its trusted classification.
  • 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 (terminal): The supplied before/after evidence exercises candidate projection through the real snapshot worker and manifest discovery using actual filesystem and SQLite fixtures, observing staged bundled selection, external-path isolation, and unchanged live state. The separate Gateway readiness run is supplemental and does not establish that all linked update failures are fixed.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied before/after evidence exercises candidate projection through the real snapshot worker and manifest discovery using actual filesystem and SQLite fixtures, observing staged bundled selection, external-path isolation, and unchanged live state. The separate Gateway readiness run is supplemental and does not establish that all linked update failures are fixed.

Evidence

What I checked:

  • Current main still needs the repair: Current main copies all existing plugin locators into independent candidate storage without the branch's bundled redirect step. (src/infra/update-candidate-plugins.ts:123, 9865df7610c8)
  • Latest release retains the same copying behavior: The v2026.9.3 source also lacks bundled alias redirection; no shipped fix was established. (src/infra/update-candidate-plugins.ts:123, 1391f7cd2d40)
  • Contained identity-based projection: Redirects require physically contained source and candidate roots, matching discovery identities and entry names, and contained entry files. Whole-package redirects require every entry to match one candidate package; other locators retain the existing copy path. (src/infra/update-candidate-plugins.ts:36, f02b5484e8ab)
  • Previous finding resolved: Fallback roots now pass physical package containment before discovery enumeration. Shared entry enumeration preserves declaration/runtime pairing and existing collision handling. The previous completed review inspected this same head and retained no findings. (src/plugins/discovery.ts:713, f02b5484e8ab)
  • Production-boundary regression evidence: The supplied PR body reports before-fix failures and 20 passing provenance cases through the real rehearsal snapshot worker, filesystem, SQLite copies, and manifest discovery. Inspected assertions verify candidate bytes, external-path classification, fallback containment, multi-entry behavior, unchanged live permissions, and unchanged database bytes. Tests were not executed during this read-only review. (src/infra/update-candidate-bundled-provenance.test.ts:193, f02b5484e8ab)
  • Trust enforcement remains at runtime: Runtime state capabilities still reject records lacking bundled origin or verified official installation. Projection changes the selected candidate path, not this capability gate or the persisted install-source classification. (src/plugins/registry-runtime.ts:167, f02b5484e8ab)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: 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 (4 earlier review cycles)
  • reviewed 2026-09-09T14:51:28.647Z sha 66b6261 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-09T15:09:06.426Z sha 66b6261 :: needs real behavior proof before merge. :: [P2] Validate fallback bundled roots before invoking discovery
  • reviewed 2026-09-09T15:18:40.966Z sha 66b6261 :: needs real behavior proof before merge. :: [P2] Validate fallback bundled roots before invoking discovery
  • reviewed 2026-09-09T17:10:01.084Z sha f02b548 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. 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 9, 2026
Keep proven bundled plugin path aliases bound to the matching staged plugin during candidate projection, preserving bundled origin and trust without changing external path-install policy. Refs #142633.
Admit package-owned source and candidate roots before fallback enumeration or permission repair. Preserve external path-install copying and prove valid and escaping fallback behavior. Refs #142633.
Reuse discovery entry enumeration and identity derivation for all bundled entry aliases. Preserve declaration/runtime pairing, keep missing candidate entries on the existing copy path, and redirect package roots only when all entries match one candidate package. Refs #142633.
@steipete
steipete force-pushed the steipete/upd-candidate-provenance branch from 66b6261 to f02b548 Compare September 9, 2026 17:03
@clawsweeper clawsweeper Bot added 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 9, 2026
@steipete

steipete commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 9, 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 7c1824f into main Sep 9, 2026
198 checks passed
@steipete
steipete deleted the steipete/upd-candidate-provenance branch September 9, 2026 18:16
@steipete

steipete commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 10, 2026
…al (openclaw#143190)

* fix(update): preserve bundled aliases in candidate rehearsal

Keep proven bundled plugin path aliases bound to the matching staged plugin during candidate projection, preserving bundled origin and trust without changing external path-install policy. Refs openclaw#142633.

* fix(update): admit only contained fallback roots to bundled discovery

Admit package-owned source and candidate roots before fallback enumeration or permission repair. Preserve external path-install copying and prove valid and escaping fallback behavior. Refs openclaw#142633.

* fix(update): redirect every entry of multi-entry bundled plugins

Reuse discovery entry enumeration and identity derivation for all bundled entry aliases. Preserve declaration/runtime pairing, keep missing candidate entries on the existing copy path, and redirect package roots only when all entries match one candidate package. Refs openclaw#142633.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation maintainer Maintainer-authored PR 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: L 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