Skip to content

fix(plugins): preserve bundled install ownership - #123063

Merged
vincentkoc merged 1 commit into
mainfrom
fix/plugin-discovery-install-owner
Aug 13, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/plugin-discovery-install-owner

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes an issue where a bundled plugin discovered before its managed install record could lose package ownership during same-scan source deduplication. Lifecycle actions then lacked the authoritative install owner even though the install ledger claimed the same plugin root.

Why This Change Was Made

Discovery now merges only install-owner and ambiguity metadata into the retained first candidate before returning from same-pass deduplication. Bundled precedence, origin, package metadata, and source stay unchanged; conflicting install records still fail closed as ambiguous with the existing diagnostic.

Root cause: addCandidate returned on its seen check before ownership from the later managed-install pass reached the retained bundled candidate.

Production delta: +31/-12 (+19 net), justified by restoring the lifecycle ownership boundary without replacing or revalidating the retained candidate. Test delta: +59.

User Impact

Operators can use managed lifecycle actions for package-less and package-backed bundled plugins whose install records point at the same discovered root. Conflicting ownership remains unavailable rather than selecting an unsafe owner.

Evidence

  • OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs src/plugins/discovery.test.ts src/plugins/manifest-registry-installed.test.ts src/plugins/install-persistence.test.ts
    • 3 files passed, 146 tests passed
  • node scripts/check-changed.mjs -- src/plugins/discovery.ts src/plugins/discovery.test.ts
    • passed on Blacksmith Testbox
  • pnpm format:check src/plugins/discovery.ts src/plugins/discovery.test.ts
  • git diff --check
  • exact-head autoreview: clean, no accepted/actionable findings
  • exact-head local ClawSweeper review: nothing_found, high confidence, best-fix verdict

The heavy bundled-plugin shard is deferred, not waived, while beta.2 validation capacity is reserved. Exact-head ordinary CI and ClawSweeper review remain required before merge.

AI-assisted: yes. I reviewed and understand the implementation and tests.

Punchcard-Session: ember-meadow-river-68
@clawsweeper

clawsweeper Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@vincentkoc vincentkoc self-assigned this Aug 13, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review August 13, 2026 08:02
@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Aug 13, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 Aug 13, 2026
@clawsweeper

clawsweeper Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 13, 2026, 4:15 AM ET / 08:15 UTC.

ClawSweeper review

What this changes

The PR preserves managed install ownership when bundled and managed-install discovery encounter the same plugin source in one scan.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open: current main still drops managed install ownership at same-scan deduplication, while this PR repairs that producer-boundary gap without changing bundled precedence or ambiguity handling.

Priority: P2
Reviewed head: 91d1e7f90a61baf5c2407f03799b3ad8d0b24850

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-proven ownership repair with targeted regression coverage and no blocking review finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This MEMBER-authored internal discovery fix is not subject to the external-contributor real-behavior-proof gate; the PR body supplies focused test evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This MEMBER-authored internal discovery fix is not subject to the external-contributor real-behavior-proof gate; the PR body supplies focused test evidence.
Evidence reviewed 6 items Current-main defect: The same-scan seen-set path returns before later managed-install discovery can update the retained bundled candidate's ownership metadata.
Later ownership input: Managed install records are scanned after bundled roots and pass install-owner or ambiguity metadata into discovery, so the early return prevents that metadata reaching the retained candidate.
PR repair: The branch merges only ownership and ambiguity metadata at the seen-source return, using the existing cross-result conflict semantics.
Findings None None.
Security None None.

How this fits together

Plugin discovery combines bundled locations with managed-install records into one plugin registry. Manifest and installed-index construction carry the selected install owner to lifecycle actions such as update and uninstall.

flowchart LR
  A[Bundled plugin roots] --> C[Plugin discovery]
  B[Managed install records] --> C
  C --> D[Same-source deduplication]
  D --> E[Manifest and installed index]
  E --> F[Managed lifecycle actions]
Loading

Before merge

  • Resolve merge risk (P1) - Production code grows by 19 net lines for a bug fix; the shared helper is justified because the identical ownership invariant must run at both same-scan and cross-result deduplication boundaries.
Agent review details

Security

None.

PR surface

Source +19, Tests +59. Total +78 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 31 12 +19
Tests 1 59 0 +59
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 90 12 +78

Review metrics

Metric Value Why it matters
Production vs test LOC production +31/-12 (net +19); tests +59/-0 The production increase centralizes an existing ownership-conflict rule for the newly covered same-scan deduplication boundary.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the shared ownership-merge helper, land it after exact-head validation, and preserve the existing fail-closed result for conflicting install records.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain the shared ownership-merge helper, land it after exact-head validation, and preserve the existing fail-closed result for conflicting install records.

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

Yes. Current main's exact same-source early return drops later managed-install ownership, and the added fixture exercises that ordering without needing an external service.

Is this the best way to solve the issue?

Yes. Merging only authoritative ownership metadata into the first retained candidate fixes the owner boundary while preserving bundled precedence and existing ambiguity behavior.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This is a bounded plugin lifecycle ownership repair with limited blast radius.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This MEMBER-authored internal discovery fix is not subject to the external-contributor real-behavior-proof gate; the PR body supplies focused test evidence.

Label justifications:

  • P2: This is a bounded plugin lifecycle ownership repair with limited blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This MEMBER-authored internal discovery fix is not subject to the external-contributor real-behavior-proof gate; the PR body supplies focused test evidence.

Evidence

What I checked:

  • Current-main defect: The same-scan seen-set path returns before later managed-install discovery can update the retained bundled candidate's ownership metadata. (src/plugins/discovery.ts:803, b54034d5c22a)
  • Later ownership input: Managed install records are scanned after bundled roots and pass install-owner or ambiguity metadata into discovery, so the early return prevents that metadata reaching the retained candidate. (src/plugins/discovery.ts:1638, b54034d5c22a)
  • PR repair: The branch merges only ownership and ambiguity metadata at the seen-source return, using the existing cross-result conflict semantics. (src/plugins/discovery.ts:815, 91d1e7f90a61)
  • Lifecycle contract: Manifest records copy candidate ownership, and the installed-package resolver rejects missing or ambiguous ownership before lifecycle work proceeds. (src/plugins/manifest-registry.ts:1216, b54034d5c22a)
  • Regression coverage: The added test covers manifest-less and package-backed bundled candidates plus duplicate install-record ambiguity. (src/plugins/discovery.test.ts:1383, 91d1e7f90a61)
  • Area history: Recent plugin lifecycle and discovery work is concentrated around Peter Steinberger, with Vincent Koc also contributing a recent managed-install repair. (src/plugins/discovery.ts:394, 5a643e354310)

Likely related people:

  • steipete: History shows sustained work across discovery, ownership, index, and lifecycle files, including the recent packed-entry lifecycle repair. (role: long-running discovery and lifecycle contributor; confidence: high; commits: 5a643e354310, 441a9b94cf05, 3972c4151390; files: src/plugins/discovery.ts, src/plugins/installed-plugin-package-ownership.ts, src/plugins/management-service.ts)
  • vincentkoc: Recent merged work repaired managed-install runtime-child policy in the same plugin lifecycle area. (role: recent managed-install contributor; confidence: medium; commits: 6966301523a5; files: src/plugins/discovery.ts, src/plugins/installed-plugin-index-record-builder.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Wait for required exact-head CI to complete before merge.

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.

@vincentkoc

Copy link
Copy Markdown
Member Author

Maintainer merge-risk decision: retain the shared ownership-merge helper. The +19 net production lines centralize the same fail-closed owner/ambiguity invariant at both same-scan and cross-result deduplication boundaries, without replacing the retained candidate or broadening plugin behavior.

Waiting for the remaining exact-head CI jobs before merge. The heavy bundled-plugin shard remains deferred, not waived, while beta.2 validation capacity is reserved.

@vincentkoc
vincentkoc merged commit 4c60b3b into main Aug 13, 2026
189 of 190 checks passed
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

@vincentkoc
vincentkoc deleted the fix/plugin-discovery-install-owner branch August 13, 2026 08:22
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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