Repository navigation
perf: separate static provider catalogs from live discovery - #133579
Conversation
Move manifest catalog builders into the existing plugin owner while retaining public SDK exports. Defer live discovery imports until the selected catalog hook runs, with a regression covering the static import boundary.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 7:26 PM ET / 23:26 UTC. ClawSweeper reviewWhat this changesThe branch moves manifest-derived provider catalog builders to the plugin catalog owner and defers live model discovery until a selected provider catalog hook runs. Merge readinessThis PR remains necessary: current main still eagerly imports live discovery during provider-entry loading, while the branch makes that path lazy without changing the exported SDK surface. No introduced correctness or security defect was found; the captured required-check rollup is incomplete and the maintainer-owned boundary needs normal human merge review. Priority: P3 Review scores
Verification
How this fits togetherProvider plugins first register manifest metadata for setup and static model selection, then may fetch a live catalog for a scoped discovery request. This change separates those control-plane registration inputs from the transport and HTTP dependencies used by live discovery. flowchart LR
A[Provider manifest] --> B[Plugin registration]
B --> C[Static catalog]
D[Scoped discovery request] --> E[Lazy live-runtime load]
E --> F[Live provider catalog]
C --> G[Model selection]
F --> G
Decision needed
Why: The public exports remain stable and no defect was found, but the permanent ownership split is an architectural decision on a maintainer-labeled PR. Before merge
Agent review detailsSecurityNone. PR surfaceSource +9, Tests +50, Other 0. Total +59 across 9 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one manifest-first catalog owner, retain the lazy live-discovery boundary, and merge only after the exact head has a complete green required-check rollup and owner review. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR is a registration-performance refactor rather than a standalone user-reported failure. Its focused source test directly exercises static registration, empty scope, and alias-selected discovery. Is this the best way to solve the issue? Yes: moving manifest construction to the catalog owner while deferring the heavy runtime import preserves manifest-first registration and removes the unwanted eager dependency path without adding an SDK API. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b287d63101e1. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
…#133579) * refactor(plugins): keep provider catalog registration lightweight Move manifest catalog builders into the existing plugin owner while retaining public SDK exports. Defer live discovery imports until the selected catalog hook runs, with a regression covering the static import boundary. * test: align catalog test routing fixtures
Related: #130324, #130706
What Problem This Solves
Provider plugin registration loaded live discovery and transport catalog dependencies even when only static manifest metadata was needed. This change separates that initialization work from the central provider registration path.
Why This Change Was Made
Manifest catalog builders move into the existing plugin catalog owner. The public SDK continues to export the same functions and types, while provider entry registration imports the lightweight owner directly. Live discovery uses the existing lazy-runtime helpers and loads when its selected catalog hook runs.
The pure catalog normalizer receives an explicit empty policy map, preserving the previous
allowManifestNormalization: falsebehavior. The prior provider declaration type is already an alias for the canonical config type. No API migration, configuration, dependency, schema, new SDK subpath, or metadata collection is introduced.Most production churn is a move. The remaining growth is the lazy import boundary and required assertion-safety comments; the assertion baseline shrinks by three.
User Impact
Static provider registration no longer eagerly loads the central live catalog runtime. Live discovery keeps its existing provider/alias scope and output, and existing auth and catalog behavior remain covered by the original tests. No operator action is required.
This does not remove every plugin-specific import path or by itself close the original Gateway CPU investigation. Qianfan onboarding still imports the broader SDK catalog surface; auditing that remaining onboarding boundary is a follow-up, not a fix claimed here.
Evidence
Verified on
3b80c2f38c5fd32f389176ff190370bb6e43274fwith Node 24.19.0 and pnpm 12.1.0:CI follow-up
The new cold-import regression correctly routes through SDK-light because it uses module mocks. Updated the existing routing fixtures to retain that ownership and use a pure SDK fixture for ordinary unit-fast checks. Broad/narrow changed-mode and exactly-once ownership assertions remain intact; no tests or assertions were removed and no new cases were added.
Reproduced all eight stale routing failures locally before their edits. Final verification passed 551 tests across all four affected routing suites, the original catalog cohort, and the pure fixture, with zero failures/skips. The expanded changed gate passed; final managed review was scoped-clean at P0. This corrective commit changes only four test files (+12/-14). Full PR totals are net +9 production / +50 test lines.
The original full-build and bounded Qianfan import proof remain associated with 3b80c2f; all original source/build hashes and the lockfile remain unchanged. No fresh-build or new authenticated-provider proof is claimed for this fixture-only correction. The separate docs release-list failure has been repaired on main; this corrective commit does not duplicate that change.