Repository navigation
refactor(plugins): make discovery invocation-owned - #130486
Conversation
Remove the cache-era split result assembly, unreachable recursive scans, and repeated scan-state plumbing. Derive preferred install paths and managed classification together while keeping their distinct exclusion semantics.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 7:35 PM ET / 23:35 UTC. ClawSweeper reviewWhat this changesThis PR consolidates plugin discovery into one invocation-owned scanner while preserving configured, bundled, installed, and Doctor discovery behavior. Merge readinessKeep open. This is a coherent maintainer-owned cleanup; source review found no discrete patch defect, while normal exact-head CI and maintainer landing review remain. Priority: P3 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherPlugin discovery reads configured paths, bundled plugins, and install records, then produces ordered candidates and diagnostics. Plugin loading and Doctor consume those results to activate plugins and validate configured paths. flowchart LR
A[Configured paths] --> D[Plugin discovery]
B[Bundled plugins] --> D
C[Installed plugin records] --> D
D --> E[Candidate acceptance]
E --> F[Final ordering and deduplication]
F --> G[Plugin loader and registry]
F --> H[Doctor validation]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -242, Tests +203. Total -39 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain one scanner as the private discovery owner, with final publication deduplication and raw configured-path output kept as distinct intentional boundaries. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR does not claim a pre-existing user-visible failure; its added tests exercise the affected filesystem and registry boundaries. Is this the best way to solve the issue? Yes. A single private scanner owns scan-local state while preserving the loader and Doctor public entry points, avoiding the former split-result merge protocol. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 02a60e0d8714. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Land-ready review for The latest ClawSweeper review found no discrete patch defect. Its compatibility-validation request and sole Rank-up move—complete exact-head CI—are fulfilled. Normal maintainer source/proof review is also complete. Its live-proof wrapper reported a terminal-command synchronization failure even though the included log shows 116 discovery tests passing; I am not counting that wrapper as a passing proof. Separate terminal-result reporting follow-up noted. Completed proof: identical-order baseline and candidate suites each passed 317 tests; Proceeding through the repository-native preparation and merge gates. No rebase or source change was made after the reviewed proof. |
|
Merged via squash.
|
* origin/main: (26 commits) fix(plugins): preserve registry epoch on activation rollback (#129232) refactor(plugins): make discovery invocation-owned (#130486) feat(ui): save appearance preferences per user profile (#130340) fix: Buzz bots recover relay stalls and reject revoked senders (#130467) fix(code-mode): serialize catalog handles nested in final values (#130276) fix(webchat): CLI skill and harness-injected turns render as operator-sent messages (#130427) fix(agents): read the published model catalog owner from session_status (#130277) fix(channels): preserve long presentation text (#130368) fix(agents): route CLI bootstrap truncation notice into the system prompt (#130325) refactor(plugins): unify setup registration and artifact selection (#130474) fix(memory): prevent forgotten session content from returning (#130451) refactor(outbound): consolidate transport completion (#130460) fix(workers): protect in-flight workspace manifests from concurrent retention (#130449) fix(portals): keep worker previews reachable and owned by the active environment (#130434) fix(config): keep core channels keys in the generated config schema (#120736) chore(deps): refresh dependencies after seven-day cooldown (#130296) fix(agents): remind exec models to quote shell metacharacters (#125485) fix(auth): honor shared-store ownership in temp-state exec and agent deletion (#130437) fix(openshell): preserve file writes during concurrent mirror commands (#130447) fix(workers): report full nodes as at capacity, not offline (#130445) ...
Remove the cache-era split result assembly, unreachable recursive scans, and repeated scan-state plumbing. Derive preferred install paths and managed classification together while keeping their distinct exclusion semantics.
What Problem This Solves
Plugin discovery still assembles and merges separate scoped/shared result objects after the caches that needed them were removed. It also carries traversal state for recursion that has no remaining caller. This maintainer-requested structural cleanup removes those obsolete flows without changing which plugins operators can load.
Why This Change Was Made
One private, invocation-owned scanner now owns candidates, diagnostics, filesystem/package facts and phase-local attempted paths. The old result containers, merge protocol, unreachable recursive traversal and repeated state plumbing are deleted. Installed-path preparation has one owner while preserving the important distinction between preferred scan paths, all managed paths and auto-scan exclusion directories.
The two acceptance phases remain deliberately separate: a configured-path rejection must not prevent later bundled permission repair and acceptance. Physical aliases are normalized only after acceptance; the first candidate retains its origin and fields while symbol-backed install-owner/ambiguity facts merge. Configured-only discovery stays raw for Doctor's count-sensitive check. Registry duplicate-ID selection, official-install trust, package/runtime boundary checks, root ordering and metadata-cache lifecycle are unchanged.
Deleting recursion alone would leave the obsolete split-result owner. A generic discovery framework would add abstractions without replacing OpenClaw's origin-sensitive policy. This change instead consolidates the existing private owner and preserves both public entry points.
User Impact
No intended user-visible behavior or configuration change. Existing native, bundled, linked-source and bundle-style plugin discovery retains its ordering, diagnostics and safety checks. No dependency, SDK export, schema, persistence or protocol change.
Production LOC: +573/-815 (net -242). Tests: +234/-31 (net +203). Only
src/plugins/discovery.tsand its existing test file change.Evidence
Baseline:
86e208310ff2f7a66e4f0c5968e74b319234f6aa. Reviewed and proven commit:0dd08aa6643d5635ccaf092f063a1bb7e7c3a4a3.node scripts/check-changed.mjs -- src/plugins/discovery.ts src/plugins/discovery.test.tspassed completely, including formatting, production/test types, lint, dead exports and selected guards. Fresh full-change P1 autoreview is clean; independent source/test review is PASS.*.test.tswere fingerprinted by content/symlink-target bytes and matched the frozen candidate. Final committed source/test blobs match the reviewed local files. The earlier remote test snapshot differs only in a Windows symlink-test guard; Linux behavior is unchanged. Workflow cleanup may mark the infrastructure run canceled; the proof command itself ended withexitCode: 0.--force. After explicitly acknowledging the reviewed synthetic fixture, the live-only rerun passed. Neither retry required production changes.The final suite command was
node scripts/run-vitest.mjs src/plugins/discovery.test.ts src/plugins/discovery-threading.test.ts src/plugins/plugin-discovery-ordering.test.ts src/plugins/hardlink-policy.test.ts src/plugins/package-compat.test.ts src/plugins/manifest-registry.test.ts src/plugins/manifest-registry-installed.test.ts src/plugins/installed-plugin-index.test.ts src/commands/doctor/shared/pristine-startup-state.test.ts.AI-assisted implementation with independent design and source review.