Repository navigation
perf(plugins): reuse lifecycle metadata on secrets hot paths - #126629
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 20, 2026, 12:35 PM ET / 16:35 UTC. ClawSweeper reviewWhat this changesThe PR passes gateway-prepared plugin manifest metadata through secrets and web-provider discovery so repeated preparation avoids rereading plugin manifests. Merge readinessKeep open. Current main does not contain this branch’s manifest-record threading, and the reviewed patch has no discrete correctness finding; it needs a clean rebase/exact-head validation before maintainer landing. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherGateway startup and reload prepare plugin metadata, then secrets preparation resolves web-search and web-fetch providers before the runtime uses them. The change reuses that lifecycle-owned metadata across provider discovery instead of repeatedly scanning plugin manifests. flowchart LR
A[Gateway startup or reload] --> B[Prepared plugin metadata]
B --> C[Secrets preparation]
C --> D[Web provider discovery]
D --> E[Resolved providers and credentials]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +137, Tests +172. Total +309 across 19 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Rebase onto current main, retain the managed reload publication boundary, and land only after exact-head checks confirm prepared metadata reuse without changing provider activation or SecretRef policy. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: the branch adds a focused manifest-open regression harness for a published snapshot, although this read-only review did not execute it. Is this the best way to solve the issue? Yes, conditionally: forwarding lifecycle-owned metadata through the existing provider paths is the canonical fix, provided the clean merge preserves reload-generation ownership. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7975432eb525. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
922a00b to
e080fe2
Compare
e080fe2 to
3762c1b
Compare
|
Merged via squash.
|
What Problem This Solves
One secrets prepare call (
prepareSecretsRuntimeSnapshot→resolveRuntimeWebTools) with a keyless external web-search provider config re-scanned all 148 bundled plugin manifests up to 16 times — ~2,368 manifest opens, ~2.1s per call on an M3 Ultra, and warm calls stayed just as slow. The cost repeated on every prepare/refresh even though the gateway publishes a complete, lifecycle-owned plugin metadata snapshot at startup.This is also the root-cause answer to the downstream ask in #107155 (Microsoft Lobster patch 0003): keyless host-proxied web search stays fast without any new config key (
omitAuth), manifest field, or fast-path carve-out.Why This Change Was Made
The published snapshot cache was missed on the key, not bypassed by import: web-provider discovery mints bundled-compat activation configs (rewritten
plugins.allow/entries[].enabled) whose policy hash never matches;loadManifestMetadataSnapshotmintedconfig ?? {}, turning configless readers into incompatible explicit-policy readers; hot reload published a narrower compatibility envelope than startup; and the manifest-contract lane rebuilt registries outside the snapshot entirely.The fix follows the repo doctrine "hot paths carry prepared facts forward": thread the prepared manifest registry through all web-provider discovery lanes (pattern copied from
providers.runtime.ts), use the original config for snapshot lookups with activation applied as a projection, passundefinedconfig through as a configless default-context read, and publish the same compatibility envelope on hot reload as on startup.User Impact
Gateway secrets preparation with any web-search/web-fetch config gets dramatically cheaper: zero plugin-manifest disk opens per prepare when the published snapshot is live (was 1,332–2,368), and CLI-style processes without a published snapshot drop from ~1.3s to ~0.25s per warm call (one scan instead of sixteen). No config surface changes; no behavior changes to provider selection, credential resolution, or SSRF/cache policy.
Evidence
openclaw.plugin.jsonopens during a warm prepare with a published snapshot and a keyless external provider config (src/secrets/runtime.fast-path.test.ts)src/gateway/server-reload-handlers.test.ts)check:changedgreen; measured 20.5× (210ms → 10.3ms) warm prepare in-harness, 1,332 → 0 manifest opens