Repository navigation
refactor(plugins): centralize install recovery metadata - #140002
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 6:09 AM ET / 10:09 UTC. ClawSweeper reviewWhat this changesCentralizes plugin-install recovery metadata selection while preserving local-source ownership, official-catalog precedence, and rejection of unrelated invalid configuration. Merge readiness✅ Ready for maintainer review Keep open as a useful, independently landable refactor. No actionable introduced defects were found, and the updated CLI validation resolves the previous proof concern. Current main still contains the duplicated resolver. Priority: P3 Review scores
Verification
How this fits togetherThe plugin-install CLI reads source metadata to decide whether an installation may proceed past invalid configuration. The installation owner then checks that recovery affects only the requested plugin before changing configuration, files, or install records. flowchart TD
A[Plugin install request] --> B{Source kind}
B --> C[Local package metadata]
B --> D[Official then bundled metadata]
B --> E[Marketplace recovery denied]
C --> F[Recovery eligibility]
D --> F
F --> G[Validate plugin ownership and config errors]
G --> H[Install or reject without changes]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -56, Tests +144. Total +88 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep one metadata resolver while retaining the existing plugin-owned recovery checks and mutation safeguards. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR preserves existing behavior through a refactor; source inspection and the supplied real CLI observations cover its recovery contract. Is this the best way to solve the issue? Yes. Selecting source ownership once removes duplicated policy while preserving the existing precedence, refusal, and downstream validation rules. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d7217198496e. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
What Problem This Solves
Plugin installation classified local sources and npm names separately for bundled and official recovery metadata, then merged the answers. That duplicated the policy deciding whether plugin-owned recovery may run with invalid config.
Why This Change Was Made
One resolver now determines source ownership once. Local and file requests use their own package metadata; catalog requests use the official descriptor before bundled metadata. An explicit official refusal still wins over bundled recovery permission. This removes 56 production lines.
User Impact
Recovery decisions remain consistent across direct paths, file specs, versioned npm names, and marketplace requests. The CLI parser, exported helpers, invalid-file errors and config mutation rules retain their existing behavior.
Evidence
Related: #135599. This refactor is independently landable from the Gateway lifecycle changes.
Real CLI validation
Real CLI proof passed on
47806ba38447fbeacd18d5cd5c3ee77b73a1fdefwith Node 24.19.0. The normal source launcher built the runtime artifacts, then six actual CLI install invocations ran in three independent synthetic HOME/state directories. Each case first installed version 1 and created a genuinely owned stale source path using the resulting SQLite install record.plugins install file:<replacement> --force --accept-capabilitiesexited 0, installed version 2, removed the owned missing load path, and updated the canonical SQLite source/version record. The initial invalid-config diagnostic was printed before successful recovery.All six CLI process groups closed. Source remained clean and unchanged, and all 10,800 regular dist/dist-runtime files stayed byte-identical across the runs. No Gateway, real credentials, npm/ClawHub registry, or operator state was used. This proves the actual local CLI recovery/install/persistence path; it does not claim hosted catalog or remote install coverage.
Exact-head CI passed.