fix: reuse plugin manifest metadata safely#82814
Merged
Merged
Conversation
Contributor
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix: reuse plugin manifest metadata safely This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
shakkernerd
force-pushed
the
fix/plugin-metadata-reuse
branch
from
May 17, 2026 00:55
9a34af8 to
27d5348
Compare
This was referenced May 17, 2026
zeroaltitude
added a commit
to zeroaltitude/openclaw
that referenced
this pull request
May 22, 2026
…id normalize chain
model-id normalize path so consumers stop consulting the
`current-plugin-metadata-snapshot` single-slot handoff in
`resolveMetadataSnapshotForPolicies`. That eliminated most of the
hot-path `installs.json` disk walks (Kova metadata scans dropped
394 → 28 per cold+warm sample).
The remaining 28 scans come from the runtime plugin-normalize branch.
`model-selection-normalize.ts` already receives `options.manifestPlugins`
from its caller and threads it into the static branch
(`normalizeStaticProviderModelId`); the runtime branch a few lines down
silently drops it, and the chain falls through to the slot-or-load disk
walk in `resolveMetadataSnapshotForPolicies`:
src/agents/model-selection-normalize.ts:59
→ normalizeProviderModelIdWithRuntime(...) (no plugins param)
→ normalizeProviderModelIdWithPlugin(params) (no plugins param)
→ normalizeProviderModelIdWithManifest(params) (params.plugins undefined)
→ loadManifestModelIdNormalizationPolicies (slot-or-load disk walk)
This change extends the openclaw#82814 pattern into the runtime branch:
- Add optional `plugins` param to `normalizeProviderModelIdWithRuntime`
and `normalizeProviderModelIdWithPlugin`. Both forward unchanged into
`normalizeProviderModelIdWithManifest`, which already honors
`params.plugins` to skip the slot lookup.
- At the call site in `model-selection-normalize.ts`, thread
`options?.manifestPlugins` into the runtime call. Additive — when
manifestPlugins is absent the call shape is unchanged.
Architecturally aligned with openclaw#82814's framing (carrying prepared facts
forward) rather than adding another lazy slot-refill path; does not
touch `resolveMetadataSnapshotForPolicies`. All existing callers continue
to work because `plugins` is optional everywhere it was added.
Validation
- tsgo:core: clean
- tsgo:core:test: clean
- run-vitest model-selection.plugin-runtime + model-selection-manifest-workspace
+ model-selection + model-fallback + manifest-model-id-normalization:
9 files / 349 tests passed
- oxlint affected files: clean
Tests
- New: "forwards manifestPlugins to the runtime normalization call so
it can skip the slot-or-load disk walk"
- New: "omits plugins from the runtime call when no manifestPlugins
are prepared (preserves current behavior)"
(both in src/agents/model-selection.plugin-runtime.test.ts)
steipete
pushed a commit
to zeroaltitude/openclaw
that referenced
this pull request
Jun 16, 2026
…id normalize chain
model-id normalize path so consumers stop consulting the
`current-plugin-metadata-snapshot` single-slot handoff in
`resolveMetadataSnapshotForPolicies`. That eliminated most of the
hot-path `installs.json` disk walks (Kova metadata scans dropped
394 → 28 per cold+warm sample).
The remaining 28 scans come from the runtime plugin-normalize branch.
`model-selection-normalize.ts` already receives `options.manifestPlugins`
from its caller and threads it into the static branch
(`normalizeStaticProviderModelId`); the runtime branch a few lines down
silently drops it, and the chain falls through to the slot-or-load disk
walk in `resolveMetadataSnapshotForPolicies`:
src/agents/model-selection-normalize.ts:59
→ normalizeProviderModelIdWithRuntime(...) (no plugins param)
→ normalizeProviderModelIdWithPlugin(params) (no plugins param)
→ normalizeProviderModelIdWithManifest(params) (params.plugins undefined)
→ loadManifestModelIdNormalizationPolicies (slot-or-load disk walk)
This change extends the openclaw#82814 pattern into the runtime branch:
- Add optional `plugins` param to `normalizeProviderModelIdWithRuntime`
and `normalizeProviderModelIdWithPlugin`. Both forward unchanged into
`normalizeProviderModelIdWithManifest`, which already honors
`params.plugins` to skip the slot lookup.
- At the call site in `model-selection-normalize.ts`, thread
`options?.manifestPlugins` into the runtime call. Additive — when
manifestPlugins is absent the call shape is unchanged.
Architecturally aligned with openclaw#82814's framing (carrying prepared facts
forward) rather than adding another lazy slot-refill path; does not
touch `resolveMetadataSnapshotForPolicies`. All existing callers continue
to work because `plugins` is optional everywhere it was added.
Validation
- tsgo:core: clean
- tsgo:core:test: clean
- run-vitest model-selection.plugin-runtime + model-selection-manifest-workspace
+ model-selection + model-fallback + manifest-model-id-normalization:
9 files / 349 tests passed
- oxlint affected files: clean
Tests
- New: "forwards manifestPlugins to the runtime normalization call so
it can skip the slot-or-load disk walk"
- New: "omits plugins from the runtime call when no manifestPlugins
are prepared (preserves current behavior)"
(both in src/agents/model-selection.plugin-runtime.test.ts)
This was referenced Jun 19, 2026
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.
Summary
Measured impact
From
.artifacts/plugin-metadata-regression-fix-report.md, comparing the baseline Kova run to the fixed current-base run foragent-cold-warm-message:FAIL 3/3toPASS 3/3.394to28per cold+warm sample:366fewer scans, about92.9%fewer.14,800msto1,142.43msmedian: about13.66ssaved, about92.3%lower.10,640msto3,866ms: about6.77sfaster, about63.7%lower.10,556msto3,699ms: about6.86sfaster, about65.0%lower.10,344msto3,754ms: about6.59sfaster, about63.7%lower.10,100msto3,584ms: about6.52sfaster, about64.5%lower.0-1ms, fixed0-2ms.Live CLI probes after rebasing onto
origin/mainat89532d3a92:openclaw --version:47ms, status0openclaw plugins list --json:463ms, status0openclaw gateway status:468ms, status0openclaw config get gateway.port:302ms, status1with expected missing-key result in isolated empty homeopenclaw sessions --all-agents --active 5 --json:570ms, status0Current branch gateway proof also stayed green: Kova
gateway-session-send-turnpassed3/3, with3metadata scans per sample, cold turns around2.29s-2.40s, warm turns around1.61s-1.63s, and max RSS695.3 MB.Verification
origin/mainat89532d3a92.git diff --check origin/main...HEAD: passed.node scripts/run-vitest.mjs ... --run: 16 files, 514 tests passed.tsgo: passed before the final rebase.gateway-session-send-turn: 3/3 PASS..artifacts/kova/reports/plugin-metadata-gateway-session-send-after-workspace-threading-repeat3/kova-2026-05-17T001010Z.mdsessions.create,sessions.send, andchat.history.agent-cold-warm-message: 3/3 PASS..artifacts/kova/reports/plugin-metadata-agent-cold-warm-after-workspace-threading-repeat3/kova-2026-05-17T001213Z.mdpnpm check:changed: passed locally across core, core tests, extension typechecks, lint, guards, and import cycles before the final rebase.Real behavior proof
Behavior addressed: Plugin-heavy installs avoid repeated manifest metadata scans during model/runtime setup without changing default model selection, fallback handling, catalog visibility, or tool capability behavior.
Real environment tested: Local OpenClaw checkout with Kova mock OpenAI provider scenarios, isolated CLI probes, and local changed-surface checks.
Exact steps or command run after this patch: Kova gateway session-send repeat-3, Kova local agent cold/warm repeat-3, focused Vitest suite, core/core-test tsgo,
git diff --check, live CLI probes, and localpnpm check:changed.Evidence after fix: Gateway session-send and local agent Kova scenarios both passed 3/3, focused tests passed 514/514 after the final rebase, live CLI probes stayed fast with expected status codes, and the artifacted baseline-to-fixed measurements show metadata scan count fell from 394 to 28.
Observed result after fix: Runtime paths reuse prepared metadata, global/read-only paths do not consume stale runtime snapshots, provider latency remains effectively unchanged, and the measured metadata-scan regression did not reappear.