Repository navigation
perf(plugins): reuse provider ownership metadata - #127178
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 21, 2026, 8:12 AM ET / 12:12 UTC. ClawSweeper reviewWhat this changesThe PR reuses one prepared plugin manifest and ownership-metadata context across provider and CLI-backend ownership lookups to avoid repeated plugin discovery. Merge readinessThe duplicate metadata preparation remains on current main, and this branch consolidates it without a concrete behavioral regression found. Keep this protected maintainer PR open for normal review and exact-head CI. Priority: P3 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherProvider selection asks the plugin subsystem which installed plugin owns a provider or CLI backend. That ownership result feeds activation and model-reference routing while respecting explicit manifests and lifecycle snapshots. flowchart LR
A[Provider or model request] --> B[Ownership lookup]
B --> C[Prepared manifest and metadata]
C --> D[Direct provider decision]
D --> E[CLI-backend fallback]
E --> F[Plugin activation and routing]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -25, Tests +25. Total 0 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the single manifest-first ownership context after the branch is current and required checks are green. Do we have a high-confidence way to reproduce the issue? Yes — current main independently prepares metadata in both fallback branches when no compatible snapshot exists; the focused tests cover the shared-preparation path. Is this the best way to solve the issue? Yes — a request-scoped immutable manifest/metadata context is the narrowest solution and follows the plugin subsystem’s manifest-first snapshot contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 498471396fed. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Land-ready proof for exact head
Rank-up move disposition:
This is an internal, net-zero two-file refactor with no cache, protocol, SDK, persistence, config, security, or provider-output change. No agent transcript is attached or posted. |
|
Merged via squash.
|
Co-authored-by: Amp <[email protected]>
What Problem This Solves
Fixes an issue where provider ownership checks without an explicit or current lifecycle snapshot repeated full plugin registry and manifest preparation: once for a direct-provider miss and again for the CLI-backend fallback. Explicit model-ref batches could repeat the same work for each model.
Why This Change Was Made
Provider and CLI-backend ownership now share one immutable manifest/metadata context per decision, and model-ref batches carry one prepared manifest across all lookups. Explicit manifests and current metadata retain precedence; aliases, disabled/workspace/config/env behavior, ambiguity classification, result ordering, and lifecycle freshness remain unchanged. No cache is added.
This is AI-assisted. No agent transcript is attached.
User Impact
Provider-selection and activation paths avoid duplicate plugin discovery work. In the same isolated 10-call harness, median cold-fallback wall time improved from 133.569 ms to 68.850 ms per call (48.5% lower), median CPU from 1415.651 ms to 741.814 ms per 10 calls (47.6% lower), and first-round RSS growth from 12.516 MiB to 7.676 MiB (38.7% lower). Prepared lifecycle-snapshot lookups remain effectively free.
Evidence
node scripts/run-vitest.mjs src/plugins/providers.test.ts src/plugins/provider-runtime.test.ts src/plugins/providers.runtime.consult-current-snapshot.test.ts src/plugins/providers.setup-trust.test.ts --reporter=verbosenode scripts/check-changed.mjs -- src/plugins/providers.ts src/plugins/providers.test.tspassed formatting, core/core-test typechecks, lint, dead exports, database/schema guards, plugin boundaries, and import-cycle checks.pnpm buildpassed on exact final main plus this commit, including all public Plugin SDK subpaths and Control UI budgets.git show --check HEADpassed.191ee5e4d5b2c96f15b958a7acebd6158863b55b: TruffleHog clean; no accepted/actionable findings; patch correct confidence 0.97.resolveOwningPluginIdsForProviderRef; broader provider-ownership results were unrelated metadata validation, doctor-route, or model-alias work.