Skip to content

improve(config): reuse plugin metadata during auto-enable - #206289

Merged
vincentkoc merged 1 commit into
mainfrom
fix/auto-enable-registry-reuse-20261127
Nov 27, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/auto-enable-registry-reuse-20261127

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

When configuration processing decides which plugins to enable, an apply call without a supplied registry resolves the same plugin metadata during both detection and materialization. Even a matching current snapshot is selected twice; the cold fallback can invoke the metadata loader twice.

User Impact

Configuration processing avoids the second metadata selection within each synchronous apply. Plugin enablement policy, explicit registries, standalone Doctor helpers, and metadata replacement between calls keep their existing behavior. No configuration changes or migration are required. Startup latency has not been measured.

Why This Change Was Made

Detection already owns the resolved registry, so it now carries that fact into materialization. The public detection helper still returns only candidates. This adds no cache and leaves async setup's post-await resolution and the existing bounded result caches unchanged.

Evidence

  • Acceptance: the existing apply flow invokes the cold metadata loader once, or selects the current snapshot once, while preserving the enabled plugin and observing a replacement on the next call.
  • Exact-head CI checked out 55510e4. All 77 auto-enable tests passed on Bun/Vitest: core 41, materialize 4, providers 14, channels 12, capture 6. This includes the cold-loader regression and current-snapshot replacement/count regression. Production/test types, source contracts and guards also pass. The subsequent normal ready-PR CI run completed successfully at the same head.
  • Baseline/staged owner-body replay: all 11 synthetic cases emitted identical results. Cold loader calls fell 2→1 and current-snapshot getter calls 2→1; separate-call replacement, standalone helpers, disabled/no-need cases, and explicit-registry cache behavior were preserved. This executes the real apply/detect/shared/materialize bodies with synthetic external readers; it is not a native Vitest baseline, filesystem scan count, or latency benchmark.
  • Native formatter check and git diff --check pass. Independent source review and autoreview found no actionable P0–P2 findings for the complete staged change against 2ab7b31 (snapshot e6fd0ad6). Autoreview used the configured Codex route; local ClawSweeper was unavailable because its runner checkout was not clean. Hosted intake acknowledged an existing cross-route review request after readiness; no hosted review result is claimed.
  • Config-doc validation passed, including both generated baseline files, on the CI merge tree containing this head. This closes the earlier local dependency-mismatch gap for the documented scoped commit exception; no schema/help/generator inputs changed.
  • Production delta: +13 lines for the prepared result and unchanged public helper shape; tests: +25 lines. No import edges, dependencies, provider requests, or async lifecycle behavior changed.

The earlier draft CI dependency check reported three pre-existing Knip symbols: readUpdateDatabaseEngineConfig, formatUpdateSnapshotCapacity, and DoctorContributionPending. The candidate job and the frozen main baseline job report the same names and classifications; the baseline checkout is 2ab7b31. Their source and dependency inputs are unchanged by this PR. That draft-run failure remains recorded; the subsequent normal ready-PR run is green.

The loader and snapshot counts above measure one synchronous applyPluginAutoEnable call. The complete CLI entry point was not instrumented. The change therefore establishes the work removed per apply while whole-command counts and latency remain open.

@vincentkoc vincentkoc self-assigned this Nov 27, 2026
@clawsweeper

clawsweeper Bot commented Nov 27, 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.

@clawsweeper clawsweeper Bot added the P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. label Nov 27, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review November 27, 2026 02:01
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 27, 2026
@clawsweeper

clawsweeper Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: passed.

What this changes

This PR passes the registry resolved during plugin detection into materialization instead of selecting the same metadata again.

Example: Apply configuration with model fixture/model, plugins.allow containing existing, and no supplied registry.

  • Before: Detection and materialization can each invoke the metadata loader before enabling fixture.
  • After: Both phases share one resolved registry while fixture is still enabled and added to the allowlist.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The implementation is focused and source-consistent with successful exact-head CI, but required real-setup evidence remains synthetic.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Configuration processing repeats plugin metadata selection within one apply call without improving the resulting activation decision.
Reason: The maintainer-authored direction removes source-verified waste with a small change and preserves existing activation and freshness contracts.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR removes verified duplicate metadata resolution with a focused change, and no discrete correctness or security defect was found.

Reviewed head: 55510e4a1492aa56941380cdeee485cae7d49307

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Supply a redacted CLI or isolated Gateway trace showing the omitted-registry path selects metadata once while preserving activation; native red-on-base regression execution is also not shown.
Agent review details

How this fits together

Plugin auto-enable consumes configuration, environment, and plugin metadata for CLI, Gateway, and Doctor callers, returning effective configuration and activation reasons.

flowchart TD
  A[CLI Gateway or Doctor] --> B[Apply auto enable]
  B --> C[Detect candidates]
  C --> D[Resolve plugin registry]
  C --> E[Candidates and resolved registry]
  E --> F[Materialize activation policy]
  F --> G[Effective config and reasons]
Loading

Technical review

Best possible solution:

Carry the detection owner's resolved registry through the synchronous apply while retaining standalone helpers and existing cache lifetimes.

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

Current-main source establishes duplicate registry resolution when detection produces candidates and the caller supplies no registry; the supplied synthetic replay reports loader and current-snapshot selections falling from two to one.

Is this the best way to solve the issue?

The change removes redundant work at the existing owner without adding cache state, changing plugin policy, or carrying metadata across an await.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5b6cc381e1d0.

Provenance checked

  • Separate detection and materialization keeps the original intent (1afa076: The refactor split detection and materialization into separate modules; both phases independently accepted an optional registry.)
  • Same-turn cache and omitted-metadata freshness keeps the original intent (perf(config): dedupe plugin auto-enable fanout work #89978: Deduplicate identical cold-start fanout while preventing mutable or replaced metadata from becoming long-lived stale inputs.)
  • Runtime generation preparation keeps the original intent (fix: reduce plugin preparation overhead in agent runs with fallbacks #194816: Reuse activation preparation within an unchanged runtime generation while preserving mutable setup and config reload behavior.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit f475f27 adds src/config/plugin-auto-enable.apply.ts:115 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f475f27d3539; files: src/config/plugin-auto-enable.apply.ts)
  • Vincent Koc: Raw commit 876fc4e adds src/config/plugin-auto-enable.detect.ts:8 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 876fc4e43ca3; files: src/config/plugin-auto-enable.detect.ts)
  • Dallin Romney: Raw commit 8ccb11c adds src/config/plugin-auto-enable.detect.ts:1 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 8ccb11cbfca7; files: src/config/plugin-auto-enable.detect.ts)

PR surface

Source +13, Tests +25. Total +38 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 26 13 +13
Tests 1 26 1 +25
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 52 14 +38

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

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

  • Provide the missing production-entry-point work-count trace.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 26, 2026, 9:32 PM ET / November 27, 2026, 02:32 UTC.

@vincentkoc
vincentkoc merged commit 28b17fb into main Nov 27, 2026
300 of 303 checks passed
@vincentkoc
vincentkoc deleted the fix/auto-enable-registry-reuse-20261127 branch November 27, 2026 02:54
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Nov 27, 2026
* commit '7df6cb759f9e604921536a700e2f527c5516e7de': (185 commits)
  docs: clarify what telemetry OpenClaw sends and how to opt out
  refactor(ui): remove retired stream-follow test seams (#206316)
  fix: distinguish missing command results from unknown outcomes (#206313)
  fix(build): reuse stamps after identical pnpm installs (#206282)
  chore(ci): inventory Gateway model catalog worker lifecycles (#206251)
  fix: keep failed image inspections inside chat activity (#206283)
  fix: clarify sent-message labels and chat activity icons (#206048)
  fix(cron): use the service's free memory for extra automation runs (#206322)
  test(android): reuse the shared TLS fixture (#206280)
  fix(ui): restore New Session recovery during startup (#206319)
  test(macos): align new Gateway URL expectations (#206281)
  feat: let doctor --fix tell when its startup repairs have nothing to do (#206246)
  fix(android): pause idle gateway discovery without blocking consumers (#196209)
  fix(ci): prepare the Android SDK for scheduled CodeQL scans (#203843)
  fix(memory): read delegated cgroup pressure from the mapped leaf (#206308)
  improve(config): reuse plugin metadata during auto-enable (#206289)
  improve: copy only the selected model for agent completions (#206287)
  fix(pr): refresh tooling before preparing reviewed incoming PRs (#206236)
  fix: keep Gateway ready while plugins drain after updates (#206299)
  fix(crabbox): keep unused prepared mirrors reusable (#206267)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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