Skip to content

refactor(models): build provider catalogs as complete batches - #130564

Merged
steipete merged 2 commits into
mainfrom
codex/model-catalog-batch-builders
Aug 27, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/model-catalog-batch-builders

Conversation

@steipete

@steipete steipete commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Several provider plugins build their offline catalogs by repeatedly normalizing a one-model provider block. That duplicates the existing whole-provider construction path and adds an SDK adapter whose only job is to wrap that path again.

Why This Change Was Made

Use the canonical whole-provider builder for Baseten, Cerebras, Chutes, Cohere, DeepSeek, Meta, Tencent, Together and Venice. Reuse Mistral's existing provider builder for its default model. Delete the row-by-row adapter and its self-comparison assertion; keep provider-specific decorators in their owning plugins.

Production: +48/-110 (net -62). Tests: +0/-15. No dependency, manifest metadata, config/default, transport, auth, discovery-cache or persistence change.

The removed SDK symbol was introduced in #113879 and is absent from the latest stable tag, v2026.7.1-2. Tags containing it are beta-only. The SDK subpath and all other provider exports remain unchanged; no compatibility shim is needed for this unreleased helper.

User Impact

No intended behavior change. Existing catalog order, pricing, input capabilities, default-model selection, explicit per-model APIs and vendor compatibility overrides remain intact. Live discovery continues using the same provider-owned projection and credential/cache boundaries. The manifest itself is unchanged, so there is no hosted catalog update to publish.

Evidence

  • Before-edit baseline: 128 tests across 19 SDK/provider files passed.
  • After-edit: the same 128 tests across all 19 files passed. After the lint cleanup, all 61 affected SDK/provider tests across eight files passed again, and targeted type-aware lint passed.
  • Full build passed all 15 phases, including CLI bootstrap imports, 147 public SDK subpaths and built plugin control-plane loads. An earlier local build collided with an E2E setup rebuild; the clean serialized rerun above passed. Local changed-check startup also hit the shared Vitest cache; focused reruns use an isolated cache and hosted CI supplies the complete gate.
  • Actual built CLI with isolated empty config returned all five expected Cohere models with correct input/context metadata. A separate isolated fixture probe captured default/all/local/provider-filtered output; the all-model view also retains zai/glm-5.3-flash with text+image, 1,048,576 context and missing: false. These are real CLI probes, not authenticated inference calls; no external API behavior changed.
  • Initial CI rejected spreading newly allocated rows inside .map(). The follow-up decorates those owned rows in place; exact-head CI passed on 8b0fb83e06fe2e96a5b08fa4e6c9068cead062d8, including all 65 selected plugin test shards and the final CI gate.
  • Independent Codex autoreview: no actionable findings. An initial attempt selected an older installed CLI and failed before review; the retry used the installed compatible CLI and completed successfully.
  • Direct source audit covered the shared catalog normalizer/builder, all affected provider builders, onboarding and registration callers, public barrels, sibling catalog-family implementation, and stable-tag history.
  • Existing tests retain independent coverage of pricing tiers, thinking/context/media metadata, invalid manifest rejection, provider decorations, onboarding defaults, live fallback and credential isolation. Only the obsolete adapter self-comparison is deleted.

Follow-up from the broader audit: OpenCode Zen/Go have duplicated snapshot/lifecycle plumbing, but their dynamic-resolution policy differs intentionally (Go remains seed-only outside its authenticated catalog). A later snapshot refactor must preserve that account boundary. Their live-test model selection also needs updating: upstream metadata now marks Zen x-preview-f-free/deepseek-v4-flash-free and Go ox-alpha-free deprecated; production lifecycle filtering must not be weakened to satisfy stale tests.

@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@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 27, 2026
@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 9:49 PM ET / August 27, 2026, 01:49 UTC.

ClawSweeper review

What this changes

The PR replaces one-model manifest normalization in ten provider plugins with whole-provider catalog builders and removes the unused SDK row-builder helper.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open for explicit maintainer handling: the refactor preserves provider-wide normalization and plugin-owned decorations, with no concrete patch defect found. Exact-head CI is still running, and this review checkout could not fetch current-main source for the final rebase comparison.

Priority: P3
Reviewed head: 8b0fb83e06fe2e96a5b08fa4e6c9068cead062d8
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, net-negative refactor with preserved owner boundaries and no concrete correctness finding; final current-main and exact-head CI validation remain pending.
Proof confidence 🌊 off-meta tidepool Not applicable: Not applicable: the supplied repository state identifies this as a member-authored internal refactor, and its asserted behavior remains covered by existing provider and onboarding tests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Not applicable: the supplied repository state identifies this as a member-authored internal refactor, and its asserted behavior remains covered by existing provider and onboarding tests.
Evidence reviewed 6 items Shared owner path: The shared provider builder normalizes an entire manifest catalog into fresh runtime model definitions, preserving copied headers and model metadata.
Plugin callers retain policy: Cerebras and Meta now reuse their existing provider builders; Baseten, Chutes, DeepSeek, Tencent, Together, and Venice apply their existing owned decoration after the complete build.
Existing behavior coverage: Current-head tests assert fallback catalog order and owned compatibility metadata for Baseten, and assert Cerebras onboarding and static-catalog rows against the manifest.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw -- --help

Result: FAIL (failed) — step 1 run pnpm openclaw -- --help: previous terminal command was still running after 30 seconds: "pnpm openclaw -- --help"

$ node scripts/run-node.mjs -- --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 120.81 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.8s
node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

[tsdown-build] invocation 2/2 finished in 15.3s
[plugin-control-plane-loads] verified 36 built modules with native require and checked doctor closures
runtime-postbuild: 11 phases completed in 4557ms (slowest: built plugin control-plane loads 3784ms)
 •●●:.        .:●●•
:●●●●:        :●●●●:
.●●●●:.:•●●•:.:●●●●.
 .●●●: •●●●●• :●●●.    █▀▀▀█ █▀▀▀█ █▀▀▀▀ █▄  █ █▀▀▀▀ █     █▀▀▀█ █   █
 ..:••●●●●●●●●••:..    █   █ █▀▀▀▀ █▀▀▀  █ ▀▄█ █     █     █▀▀▀█ █▄▀▄█
.::••••●●●●●●••••::.   ▀▀▀▀▀ ▀     ▀▀▀▀▀ ▀   ▀ ▀▀▀▀▀ ▀▀▀▀▀ ▀   ▀ ▀   ▀
 . .:  •●●●●•  :. .
    .  :●●●●:  .
      .●●●●●●.
       :••••:

┌  Hi — I'm OpenClaw. I keep this system running. Let's get you set up.
│
◇  Setup choices ───────────────────────────────────────────────────────╮
│                                                                       │
│  For the full step-by-step wizard, run ˋopenclaw onbo
… output truncated …

Assertions:

  • FAIL expect_output: Usage:

How this fits together

Provider plugins turn manifest catalog entries into offline model definitions used by onboarding and fallback model selection. The shared builder normalizes provider-wide metadata, then each plugin applies any provider-specific model policy.

flowchart LR
  A[Plugin manifest catalog] --> B[Shared provider catalog builder]
  B --> C[Normalized provider models]
  C --> D[Plugin-specific decorations]
  D --> E[Offline fallback catalog]
  E --> F[Onboarding and model selection]
Loading

Decision needed

Question Recommendation
After the branch is refreshed against current main and its exact-head checks complete, should this maintainer-owned SDK cleanup be landed? Land after validation: Rebase or refresh against current main, confirm exact-head checks are green, then merge the net-negative refactor.

Why: The PR carries the protected maintainer label, so automatic cleanup must not close or finalize it despite the absence of a discrete code finding.

Before merge

  • Resolve merge risk (P1) - Exact-head CI remains incomplete, and the unavailable promisor remote prevented a final source-level comparison with current main; refresh both before merge.
  • Complete next step (P2) - The protected maintainer label requires explicit maintainer handling; no narrow automated repair is indicated by this review.
Agent review details

Security

None.

PR surface

Source -62, Tests -15. Total -77 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 11 48 110 -62
Tests 1 0 15 -15
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 48 125 -77

Review metrics

Metric Value Why it matters
Production versus tests production +48/-110 (net -62); tests +0/-15 The patch removes the row adapter and its self-comparison while remaining substantially net-negative in production code.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the single whole-provider normalization path, preserve the provider-owned decorations, and land only after a current-main refresh and exact-head checks confirm the same catalog and onboarding contracts.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain the single whole-provider normalization path, preserve the provider-owned decorations, and land only after a current-main refresh and exact-head checks confirm the same catalog and onboarding contracts.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR is an internal behavior-preserving refactor, not a reported user-facing defect.

Is this the best way to solve the issue?

Yes, subject to the final current-main and CI refresh: the shared builder already owns whole-provider normalization, while each plugin keeps its own policy decoration.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 4e92ea645a89.

Labels

Label changes:

  • add P3: This is a low-risk internal provider-catalog cleanup with no intended user-visible behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Not applicable: the supplied repository state identifies this as a member-authored internal refactor, and its asserted behavior remains covered by existing provider and onboarding tests.

Label justifications:

  • P3: This is a low-risk internal provider-catalog cleanup with no intended user-visible behavior change.
  • 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: Not applicable: the supplied repository state identifies this as a member-authored internal refactor, and its asserted behavior remains covered by existing provider and onboarding tests.

Evidence

What I checked:

  • Shared owner path: The shared provider builder normalizes an entire manifest catalog into fresh runtime model definitions, preserving copied headers and model metadata. (src/plugin-sdk/provider-catalog-shared.ts:221, 8b0fb83e06fe)
  • Plugin callers retain policy: Cerebras and Meta now reuse their existing provider builders; Baseten, Chutes, DeepSeek, Tencent, Together, and Venice apply their existing owned decoration after the complete build. (extensions/cerebras/models.ts:17, 8b0fb83e06fe)
  • Existing behavior coverage: Current-head tests assert fallback catalog order and owned compatibility metadata for Baseten, and assert Cerebras onboarding and static-catalog rows against the manifest. (extensions/baseten/models.test.ts:41, 8b0fb83e06fe)
  • Helper provenance: History identifies the removed row-builder helper as introduced by the earlier merged provider-unification work; the same history shows later shared-catalog maintenance by Peter Steinberger. (src/plugin-sdk/provider-catalog-shared.ts:221, e30217d25cf2)
  • Release boundary: The locally available latest-release commit is dated 2026-07-18, before the helper-introducing commit dated 2026-07-25, supporting the stated beta-only compatibility boundary. (0790d9f593ad)
  • Current-main inspection gap: The checkout's promisor remote could not resolve GitHub, so a direct source comparison against current main and live PR discussion refresh could not complete. (4e92ea645a89)

Likely related people:

  • steipete: Introduced the shared row builder in the prior merged provider-unification work and authored the recent shared-catalog maintenance plus this refactor. (role: feature owner and recent area contributor; confidence: high; commits: e30217d25cf2, 4c4c06aa359f, 8b0fb83e06fe; files: src/plugin-sdk/provider-catalog-shared.ts, extensions/cerebras/provider-catalog.ts, extensions/meta/provider-catalog.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Refresh against current main and confirm the exact PR head has green required checks.

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.

@steipete

Copy link
Copy Markdown
Contributor Author

Addressed the final validation and rank-up items: exact-head CI is now green on 8b0fb83 (run), and native prepare accepted the hosted gates. I fetched and inspected current main through the native review workflow; no conflicting change to these owner paths requires a rebase.

The full local build passed all 15 phases, and the actual built CLI successfully listed the five Cohere models. A separate all-model probe retains GLM 5.3 Flash with text+image and the expected context window. This supersedes the review worker's incomplete help/onboarding attempt; no authenticated inference is claimed for this internal refactor.

Maintainer-directed landing is explicit in this task. The shared whole-provider builder and plugin-local policy boundary are retained; no concrete review defect remains.

@steipete
steipete merged commit 89d6ce4 into main Aug 27, 2026
215 checks passed
@steipete
steipete deleted the codex/model-catalog-batch-builders branch August 27, 2026 02:07
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

dynamite-bud added a commit to team-telnyx/openclaw-telnyx-provider that referenced this pull request Sep 16, 2026
OpenClaw 2026.8.1 (openclaw/openclaw#130564) removed
buildManifestModelDefinition from openclaw/plugin-sdk/provider-catalog-shared,
so 0.1.0 fails to load on 2026.8.x and 2026.9.x hosts with
`sdk-incompatible`. Build the static Telnyx rows with
buildManifestModelProviderConfig and decorate the owned rows afterwards.

- Raise the peer/minHostVersion/pluginApi floor to >=2026.8.1 and build
  against 2026.9.4.
- Update the local SDK type shims to the current export.
- State the host requirement in the README.
- Release 0.2.0.

Co-authored-by: Claude Fable 5.1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: baseten Extension: baseten extensions: cerebras extensions: chutes extensions: cohere extensions: deepseek extensions: meta Extension: meta extensions: mistral extensions: tencent extensions: together extensions: venice 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: S 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