Skip to content

perf: separate static provider catalogs from live discovery - #133579

Merged
steipete merged 2 commits into
mainfrom
codex/130706-lightweight-catalog
Aug 30, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/130706-lightweight-catalog

Conversation

@steipete

@steipete steipete commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

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: false behavior. 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.

Change Added Removed Net
Production 222 213 +9
Tests 65 15 +50
Assertion baseline 1 1 0

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 3b80c2f38c5fd32f389176ff190370bb6e43274f with Node 24.19.0 and pnpm 12.1.0:

  • The new cold-import regression failed on unchanged base code at the transport-policy sentinel, then passed after extraction. Static registration and empty discovery scope stay lazy; a matching alias invokes live discovery once.
  • All 54 focused tests passed across provider entry, SDK catalog helpers, plugin catalog ownership, live family scope, BytePlus, and Qianfan. All 16 existing provider-entry cases remain. The added test is 30 net lines smaller than the original combined branch's version.
  • Changed-file checks passed: core/plugin and test type checks, lint, SDK boundaries/exports, unused exports, and architecture guards. Runtime value cycles: zero.
  • Full build passed in 5m 42s, including SDK declarations, 63 package-local plugins, CLI import guards, and UI budgets. No ineffective dynamic import warnings were emitted.
  • The real built Qianfan entrypoint imported successfully in the standard isolated RSS harness: 201.8 MiB peak RSS, 46.5 MiB empty-Node baseline, no failure or timeout. This is a candidate measurement, not a before/after memory reduction or authenticated provider test.
  • Deslop completed. Managed Codex autoreview returned scoped-clean with no findings at its default P0 priority. Source, lockfile, and tree hashes stayed unchanged through build and profiling.

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.

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.
@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added size: M maintainer Maintainer-authored PR labels Aug 30, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 30, 2026
@clawsweeper

clawsweeper Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 7:26 PM ET / 23:26 UTC.

ClawSweeper review

What this changes

The 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 readiness

⚠️ Ready for maintainer review - 2 items remain

This 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
Reviewed head: 5371950ffe675f531d7744fd201665d811d4f4f2
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is a coherent owner-boundary refactor with targeted regression coverage and no supported correctness finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The repository state identifies a MEMBER author, so the external-contributor proof gate does not apply. The source test covers the changed static/live import boundary, and the PR body additionally reports a built Qianfan entrypoint import.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The repository state identifies a MEMBER author, so the external-contributor proof gate does not apply. The source test covers the changed static/live import boundary, and the PR body additionally reports a built Qianfan entrypoint import.
Evidence reviewed 7 items Lazy registration boundary: The introduced lazy module loader replaces the value import of live discovery; it is only invoked from the selected live-catalog hook after the provider/alias scope guard.
Static catalog owner: Manifest catalog construction now resides with plugin manifest/catalog handling, while the SDK shared module preserves the existing public exports by re-exporting them.
Normalization contract preserved: An explicit empty policy map reaches the core normalizer, which applies no manifest policy and then the same built-in normalization formerly selected by allowManifestNormalization: false.
Findings None None.
Security None None.

How this fits together

Provider 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
Loading

Decision needed

Question Recommendation
Do the plugin-SDK owners want the direct SDK-to-plugin catalog import to be the permanent lightweight registration boundary? Accept the lightweight boundary: Retain the moved manifest builders and lazy live-discovery import once exact-head CI is complete.

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

  • Resolve merge risk (P1) - The captured exact-head check rollup is incomplete, so required CI completion still needs confirmation before merge.
Agent review details

Security

None.

PR surface

Source +9, Tests +50, Other 0. Total +59 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 3 222 213 +9
Tests 5 65 15 +50
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 1 0
Total 9 288 229 +59

Review metrics

Metric Value Why it matters
Production versus test LOC production net +9; tests net +50; assertion baseline net 0 Most production churn relocates existing manifest helpers; the remaining production growth establishes the lazy runtime boundary and its safety context.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    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.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best 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.

Labels

Label justifications:

  • P3: This is a bounded internal performance and initialization refactor, not a demonstrated current user-facing outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The repository state identifies a MEMBER author, so the external-contributor proof gate does not apply. The source test covers the changed static/live import boundary, and the PR body additionally reports a built Qianfan entrypoint import.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Erick Kinnee: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-08-30T22:02:10.941Z sha 3b80c2f :: needs maintainer review before merge. :: none
  • reviewed 2026-08-30T23:11:12.217Z sha 5371950 :: needs maintainer review before merge. :: none

@steipete
steipete merged commit 77279fb into main Aug 30, 2026
244 checks passed
@steipete
steipete deleted the codex/130706-lightweight-catalog branch August 30, 2026 23:30
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 31, 2026
…#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant