Skip to content

refactor(plugins): centralize install recovery metadata - #140002

Merged
steipete merged 1 commit into
mainfrom
codex/plugin-install-recovery-owner
Sep 6, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/plugin-install-recovery-owner

Conversation

@steipete

@steipete steipete commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

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

  • 84 tests passed across recovery policy, install config, and mutation-free CLI preflight. Ten focused cases use real Commander pre-action parsing and generated package manifests. Seven initial characterization cases also passed against the original code.
  • The complete changed-file gate passed, including core/test types, typed lint, dead exports and ownership boundaries.
  • Independent P2 review found no actionable issues. Production is −56 LOC; tests are +144, with no file moves counted as savings.

Related: #135599. This refactor is independently landable from the Gateway lifecycle changes.

Real CLI validation

Real CLI proof passed on 47806ba38447fbeacd18d5cd5c3ee77b73a1fdef with 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.

  • Allowed local/file recovery: plugins install file:<replacement> --force --accept-capabilities exited 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.
  • Explicit recovery refusal: the replacement package declared recovery=false; install exited 1 and preserved the config bytes, complete installed-index value, and installed version 1 files.
  • Unrelated invalid config: recovery=true did not authorize invalid gateway.mode; install exited 1 with “Config invalid outside the plugin recovery path” and preserved the same config/index/files.

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.

@clawsweeper

clawsweeper Bot commented Sep 6, 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.

@steipete
steipete marked this pull request as ready for review September 6, 2026 09:47
@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: M maintainer Maintainer-authored PR labels Sep 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 6:09 AM ET / 10:09 UTC.

ClawSweeper review

What this changes

Centralizes 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
Reviewed head: 47806ba38447fbeacd18d5cd5c3ee77b73a1fdef

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused consolidation with meaningful precedence coverage and scoped real CLI observations resolving the previous proof gap.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The updated body records the changed resolver exercised through actual CLI installs on the pinned head: permitted file recovery updates the installation, while explicit refusal and unrelated invalid config preserve config, SQLite records, and files. This satisfies the prior scoped proof request; remote registry coverage is not claimed or required for this behavior-preserving metadata refactor.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The updated body records the changed resolver exercised through actual CLI installs on the pinned head: permitted file recovery updates the installation, while explicit refusal and unrelated invalid config preserve config, SQLite records, and files. This satisfies the prior scoped proof request; remote registry coverage is not claimed or required for this behavior-preserving metadata refactor.
Evidence reviewed 8 items Verified introduced change: The pinned merge-base-to-head diff consolidates recovery selection without changing exported request fields, marketplace exclusion, or invalid-file error handling. The host-verified test merge contains only the two introduced CLI files.
Current-main necessity: Fetched main retains separate bundled and official recovery resolvers and merges their results; the proposed consolidation is not already present.
Latest-release comparison: The latest supplied release also retains the separate resolvers and existing recovery permission field; this PR does not introduce a new configuration option or replace a shipped default.
Findings None None.
Security None None.

How this fits together

The 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]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -56, Tests +144. Total +88 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 31 87 -56
Tests 1 144 0 +144
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 175 87 +88

Review metrics

None.

Technical review

Best 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.

Labels

Label justifications:

  • P3: This is a bounded internal cleanup preserving existing recovery behavior, with no demonstrated urgent user-facing defect.
  • 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 updated body records the changed resolver exercised through actual CLI installs on the pinned head: permitted file recovery updates the installation, while explicit refusal and unrelated invalid config preserve config, SQLite records, and files. This satisfies the prior scoped proof request; remote registry coverage is not claimed or required for this behavior-preserving metadata refactor.
  • proof: sufficient: Contributor real behavior proof is sufficient. The updated body records the changed resolver exercised through actual CLI installs on the pinned head: permitted file recovery updates the installation, while explicit refusal and unrelated invalid config preserve config, SQLite records, and files. This satisfies the prior scoped proof request; remote registry coverage is not claimed or required for this behavior-preserving metadata refactor.

Evidence

What I checked:

  • Verified introduced change: The pinned merge-base-to-head diff consolidates recovery selection without changing exported request fields, marketplace exclusion, or invalid-file error handling. The host-verified test merge contains only the two introduced CLI files. (src/cli/plugin-install-config-policy.ts:63, 47806ba38447)
  • Current-main necessity: Fetched main retains separate bundled and official recovery resolvers and merges their results; the proposed consolidation is not already present. (src/cli/plugin-install-config-policy.ts:63, d7217198496e)
  • Latest-release comparison: The latest supplied release also retains the separate resolvers and existing recovery permission field; this PR does not introduce a new configuration option or replace a shipped default. (src/cli/plugin-install-config-policy.ts:63, 3928bad9badf)
  • Recovery remains bounded before installation: The unchanged configuration owner requires explicit recovery permission, attributes missing paths to install records or recovery locations, and rejects unrelated validation errors. The command exits on configuration rejection before constructing the installation context. (src/cli/plugins-install-config.ts:200, 47806ba38447)
  • Focused source-precedence coverage: The ten added cases exercise Commander pre-action parsing, official permission and refusal over bundled permission, direct and file sources, missing file sources, and marketplace exclusion. They use existing production exports without adding a test-only seam. (src/cli/plugin-install-config-policy.test.ts:53, 47806ba38447)
  • Updated real CLI evidence resolves prior feedback: The complete supplied PR body at sourceRevision 3d5046dd3cfc231967b588664dd88d44f373debf5ae06d09548e6e5454ab0f18 records six actual CLI installations on the pinned head using Node 24.19.0 and three isolated synthetic environments. Permitted file recovery installed version 2 and updated the owned stale path and SQLite record; explicit refusal and unrelated gateway configuration errors exited 1 while preserving config, index, and installed files. This addresses the previous review's permitted/rejected recovery request. These are contributor-recorded observations, not reviewer-executed tests. (47806ba38447)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: 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 (1 earlier review cycle)
  • reviewed 2026-09-06T09:50:55.607Z sha 47806ba :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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. labels Sep 6, 2026
@steipete
steipete merged commit 9a32bc7 into main Sep 6, 2026
254 checks passed
@steipete
steipete deleted the codex/plugin-install-recovery-owner branch September 6, 2026 10:14
@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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