Repository navigation
refactor(models): share model metadata primitives - #140883
Conversation
Share data-only API and thinking values, media limits, raw pricing and nested routing shapes. Preserve all public exports, own routing members, optional catalog rates, and separate exported array identities. Proof: catalog normalization/pricing and model schema suites (124 passed), config docs check, exact type/augmentation probes, and independent autoreview clean. Clean Testbox build/check in progress.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 7, 2026, 1:46 AM ET / 05:46 UTC. ClawSweeper reviewWhat this changesThe PR shares model metadata definitions across runtime models, catalogs, and configuration while preserving existing exports and accepted values. Merge readiness⛔ Blocked before merge - 1 item remains Keep open. This is a focused, useful consolidation that is absent from the fetched main revision, and no actionable correctness defect was found. The maintainer-authored, protected PR is not eligible for cleanup closure. Priority: P3 Review scores
Verification
How this fits togetherModel metadata describes supported APIs, reasoning settings, pricing, and media limits. Configuration validation and catalog normalization consume these definitions before models reach provider request handling. flowchart LR
A[Provider metadata] --> B[Catalog normalization]
C[User configuration] --> D[Configuration validation]
E[Shared metadata definitions] --> B
E --> D
E --> F[Runtime model types]
B --> F
D --> F
F --> G[Provider request handling]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -33. Total -33 across 4 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep shared metadata in the dependency-free leaf while preserving public names, array identities, optionality, and owner-specific model contracts. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR consolidates existing definitions rather than reporting a runtime defect; the duplicated definitions are visible in current main. Is this the best way to solve the issue? Yes. Sharing primitive shapes while retaining separate public arrays and routing interface members is a narrow approach that preserves the inspected contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 44dbc50d172e. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
Share data-only API and thinking values, media limits, raw pricing and nested routing shapes. Preserve all public exports, own routing members, optional catalog rates, and separate exported array identities. Proof: catalog normalization/pricing and model schema suites (124 passed), config docs check, exact type/augmentation probes, and independent autoreview clean. Clean Testbox build/check in progress.
What Problem This Solves
Runtime models, catalog metadata, and model configuration independently declared the same reasoning values, media limits, pricing buckets, and nested routing shapes. Maintaining these copies makes metadata contracts easier to drift apart.
Why This Change Was Made
One dependency-free data leaf in
packages/llm-core/src/model-data.tsnow owns those shared primitives. Existing public names stay in their original modules. The leaf is bundled from source by the existing package builds; no package dependency or public subpath was added.Routing interfaces keep their own top-level members. Replacing those members with inheritance rejects a previously valid
only?: string[] | undefinedaugmentation under exact optional properties. Sharing only nested routing objects preserves that contract. The two-field Vercel shapes and API-specific compatibility bags remain local.User Impact
No user-visible change. Existing public type contracts are preserved. Runtime API/modality differences, optional catalog rates, normalized pricing, and complete model shapes remain intact. Exported arrays retain their order, readonly tuple types, mutability, and separate identities. Production delta: -33 lines; tests unchanged.
Config compatibility and upgrade review is complete: accepted schema values and defaults are unchanged, confirmed by the unchanged config documentation baseline and old/new type/value probes. No normalizer or config writer changed, no existing config is invalidated, and no migration is required.
Evidence
node scripts/run-vitest.mjs packages/model-catalog-core/src/model-catalog-normalize.test.ts packages/model-catalog-core/src/model-catalog-pricing.test.ts src/config/zod-schema.models.test.ts: 3 files / 124 tests passed.pnpm config:docs:checkpassed without generated-file changes.Actual-source type probes preserve all 113 existing exports and 53 type pairs with exact optional properties enabled and disabled. All 37 valid augmentation cases remain valid; 11 invalid cases keep the same diagnostics. Five tuple values and their owner identities/guards also pass. The inherited-interface negative control produces the expected two TS2430 errors.
Independent Codex autoreview: no actionable P0–P2 findings. Rebase verified patch-identical, with all four source hashes unchanged.
Clean build, built catalog smoke, declaration scan, and the complete changed-file gate passed on Blacksmith Testbox
tbx_01m1x5wna4xtejtdrd52hr0pjv: https://github.com/openclaw/openclaw/actions/runs/34087460914. Command elapsed 20m18.7s, exit 0; the lease stopped automatically. All four source hashes matched, and 454 declarations contained zero private LLM package specifiers. No live-provider contract changed.Exact-head CI passed for
d77aaf1e341543dc3d773186ceb030ce073dd7fd: https://github.com/openclaw/openclaw/actions/runs/34087729644. Native prepare completed without changing the head.Exact Testbox command