Repository navigation
perf(plugins): reuse one plugin metadata snapshot per CLI process - #129181
Merged
Merged
Conversation
Built CLI measurements with the same fs shim and isolated state copy:\n- status --json: 174.3k -> 52.8k fs calls; 4.33-4.41s -> 2.63-3.94s\n- agents list --json: 50.7k -> 38.3k fs calls; 2.32-2.93s -> 2.20-2.28s
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
steipete
marked this pull request as ready for review
August 25, 2026 09:06
Contributor
Author
|
ClawSweeper rank-up note: the exact-head review lease expired at 2026-08-25T10:03:46Z while the comment remained at |
Contributor
Author
|
Merged via squash.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Aug 26, 2026
…enclaw#129181) * perf(plugins): reuse one plugin metadata snapshot per CLI process Built CLI measurements with the same fs shim and isolated state copy:\n- status --json: 174.3k -> 52.8k fs calls; 4.33-4.41s -> 2.63-3.94s\n- agents list --json: 50.7k -> 38.3k fs calls; 2.32-2.93s -> 2.20-2.28s * style(config): use type-only snapshot imports * fix(cli): scope plugin snapshot adoption to inventory reads * test(cli): align snapshot harnesses with adoption
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
CLI commands repeatedly rebuilt the complete plugin discovery and manifest registry because only Gateway startup installed the process-current plugin metadata snapshot. On the measured state copy,
status --jsonrebuilt that metadata dozens of times in one process, producing large filesystem fanout and multi-second latency.agents list --jsonfollowed the same path.Why This Change Was Made
The first authoritative CLI config read now retains the metadata snapshot it already built, promotes a validation-scoped snapshot to a complete process generation without rerunning registry discovery, and adopts it only when the process-current slot is empty. Equivalent config objects continue to reuse the snapshot through the existing policy/control-plane fingerprint comparison.
Gateway behavior remains lifecycle-owned and explicit: its existing
setCurrentPluginMetadataSnapshotcalls still replace any prior value, while CLI adoption is first-wins only. Installed-index persistence already invalidates the same lifecycle slot for install, update, remove, rollback, onboarding, and Doctor repair flows.Production LOC: +113/-31 (net +82) | Tests: +148/-21
The production growth is the explicit CLI ownership seam, first-wins publication contract, config-wide snapshot handoff, and registry-free scoped-to-complete promotion. It adds no config or public product surface and removes the repeated discovery work instead of adding a second cache.
Two test-only current-main repairs are included from the broad plugin pass: the geolocation startup inventory now matches its manifest, and optional-tool tests assert the stronger descriptor-cache behavior instead of requiring a redundant scoped loader call.
User Impact
Read-only CLI status and agent inventory commands perform materially less filesystem work and complete faster on plugin-heavy installations. Plugin and Gateway lifecycle semantics are unchanged.
Evidence
Built CLI, isolated copies of the provided state, same
--requirefilesystem shim for every sample:status --json: 174,303 / 174,291 -> 52,823 / 52,821 counted fs calls (about 70% fewer); 4.33s / 4.41s -> 3.94s / 2.63s.agents list --json: 50,745 / 50,745 -> 38,279 / 38,279 counted fs calls (about 25% fewer); 2.93s / 2.32s -> 2.28s / 2.20s.fsentrypoints, so its absolute totals are higher than the earlier external trace; before and after use the identical method set.status --jsonoverview built the registry 5 times before the fix and exactly once after it.node scripts/run-vitest.mjs src/plugins: 356 files passed; 5,530 tests passed, 1 skipped.pnpm build: passed.ready; a status probe reportedgateway.reachable=trueforws://127.0.0.1:19792; SIGINT shutdown completed cleanly.OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 node scripts/check-changed.mjs: passed. Blacksmith delegation did not complete, so this used the authorized local fallback..claude/skills/autoreview/scripts/autoreview --mode branch --base origin/main: clean, no accepted/actionable findings.CHANGELOG.mdis intentionally unchanged.