Repository navigation
fix: use hosted catalog limits and input for live-listed models - #200403
Conversation
Generated (live-listed) provider rows reach the model registry with discovery defaults: 128k context, a 32k output cap and a $0 cost placeholder. The hosted catalog's rows for those IDs were planned but never reached the registry, so pickers, run-time resolution and request limits ignored them for every refreshable provider (Tencent TokenHub/TokenPlan, Together, ...). The registry now describes each listed ID with its effective catalog row (bundled plus hosted) at read time. The listing still decides which models exist; unlisted catalog rows stay hidden and unknown listed IDs keep their discovered values. Stored rows are unchanged. Co-authored-by: obviyus <[email protected]>
Co-authored-by: obviyus <[email protected]>
…ve-rows Co-authored-by: obviyus <[email protected]>
Co-authored-by: obviyus <[email protected]>
OpenClaw-Publication: adf6e2e6-ba18-824c-a17f-a463fd687476
|
🦞👀 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. |
|
Landed in cacbd46.
|
|
Codex review: needs changes before merge. What this changesEnrich live-listed models with hosted catalog metadata while preserving account-controlled model availability. Example: Together lists moonshotai/Kimi-K3, which has a hosted catalog row but no bundled plugin row.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 2 items remain This PR addresses a current catalog bug and should remain open, but sparse catalog rows expose two correctness problems in the proposed enrichment. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherProvider discovery supplies account-listed models, and ModelRegistry combines admitted inventory with catalog metadata for model lists, runtime resolution, context sizing, and request limits. flowchart TD
A[Account model listing] --> D[Model registry]
B[Bundled catalog] --> C[Effective catalog planner]
H[Hosted catalog] --> C
C --> D
D --> E[Picker and model lists]
D --> F[Runtime model resolution]
F --> G[Context and request limits]
Technical reviewBest possible solution: Keep enrichment in the existing registry and planner boundary, preserving omitted metadata and filling missing limits from discovery before runtime materialization. Do we have a high-confidence way to reproduce the issue? Source inspection establishes the main-branch metadata gap and both sparse-row failures; this read-only review executed no target code. Is this the best way to solve the issue? The registry is the appropriate shared owner, but converting optional catalog metadata into complete runtime models before merging loses omission semantics. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a117ca507362. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +65, Tests +109. Total +174 across 4 files. Added test files: 1. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 16, 2026, 11:21 PM ET / November 17, 2026, 04:21 UTC. |
…#200403) Reuse effective catalog planning for generated registry reads without adding unlisted models or changing persisted inventory and request authority. Preserve the stable filesystem owner and adapt the fallback regression to the stable inference schema. Validation: genuine regression baseline fails; 105 tests pass across seven registry, catalog and prefix-stability files. Scoped type-aware lint, formatting and assertion safety pass. Full installed/upgrade qualification remains with assembled release validation. (cherry picked from commit cacbd46) Co-authored-by: Ayaan Zaidi <[email protected]> Co-authored-by: RomneyDa <[email protected]>
…claw#200403) ## What Problem This Solves Some providers list their models live from the account: Together, Tencent TokenHub/TokenPlan, and other OpenAI-compatible live catalogs. When a listed model is missing from the plugin's built-in rows, OpenClaw ignores the hosted catalog's details for it and uses discovery defaults: 128k context, a 32k output cap and text-only input. For example, Together `moonshotai/Kimi-K3` has a 1M context window and accepts images according to the hosted catalog. Before this change, the picker showed it as 128k text-only and requests were capped at 32,768 output tokens. ## User Impact Live-listed models now get the hosted catalog's context window, output limit, input modalities, reasoning/compat data and price. This reaches the picker, `models list`, run-time model resolution, compaction limits and request `max_tokens`. The account listing still decides which models exist. A catalog row the account does not list stays hidden, and a listed ID with no catalog row keeps its discovered values. Stored catalog rows are unchanged. ## Why This Change Was Made The planner already merges bundled and hosted rows correctly (`planEffectiveModelCatalogRows`). The prepared catalog then drops planned rows for runtime/refreshable providers on purpose (openclaw#143837): a manifest row must not publish a model the account does not list. The live projection is left to fill in the details for a listed ID, but it only searches the plugin's own static rows. This change does not add a second merge. `ModelRegistry`, when it reads a generated (live-listed) provider catalog, describes each listed ID with that planner's effective row. The catalog value wins field by field, and a discovered value fills only what the catalog omits. The row keeps its ID, its route and a declared non-chat kind. <details><summary>Single-owner trace: every consumer reads the registry rows</summary> - **Picker / `models list`:** `buildModelsListResult` reads the published snapshot from `prepareFullCatalogFacts` (`src/agents/prepared-model-runtime.full-catalog.ts`). It passes `templateModelRegistry.getAll()` (`ModelRegistry`) as `models` into `buildPreparedModelCatalogSnapshot`, whose `dynamicManifestKeys` filter (`src/agents/model-catalog.ts`) still drops the planned rows, so registry rows are the only source for these providers. - **Run-time resolution:** `resolveModelAsync` → `resolveExplicitModelWithRegistry` (`model.registry-resolution.ts`) reads `preparedCatalogModel ?? modelRegistry.find(...)`. `preparedCatalogModel` comes from `completeConfiguredRuntimeModels`, which resolves through the same registry. - **Context window / compaction:** `src/agents/context.ts` projects `owner.modelCatalog.entries`, the registry-derived snapshot above, and the resolved model's `contextWindow`. - **Request max tokens:** taken from the resolved runtime model (above). The captured request moves from 32768 to about 1M for Kimi-K3. - **Usage cost:** `withResolvedPricing` → `resolveModelCostConfig` and the Gateway usage paths (`captureModelCostPricing`) price through `prepareModelPricingContext`. That pricing owner already reads the same planner plus hosted prices, so turn cost was already correct for these rows on main (measured below). The registry row now carries the same price, so the two agree. No change was made to the pricing owner. - **Persistence:** `models-config.plan.ts` keeps the plain admission filter (`filterGeneratedPluginModelCatalogProviders`), so stored generated rows stay as discovered and the description is applied at read time only. </details> ## Evidence Regression test `model-registry.catalog-description.test.ts`: it fails on base `e28416097d78` (the listed row keeps `name`/`maxTokens`/`input` discovery defaults) and passes on the branch. Real E2E, base main `e28416097d78` vs this branch, both dist builds. Each side ran an isolated Gateway with dummy keys and a candidate hosted catalog republished from the branch with `scripts/publish-model-catalog.mts`, served on loopback. Provider traffic for the real Together and Tencent host names went to a self-signed TLS mock through a test-only preload; the configured base URLs stayed the real ones. | row | base: list | base: request / cost | branch: list | branch: request / cost | |---|---|---|---|---| | together `moonshotai/Kimi-K3` (hosted-only) | **128000, text** | **max_tokens 32768** / $0.000105 | 1048576, text+image | max_tokens 1020067 / $0.000105 | | together `zai-org/GLM-5.2` (control) | 262144, text | 131072 / $0.000036 | same | same | | tencent-tokenhub `hy4` | 1024000/960000, text+image | 64000, effort high / $0.0000208 | same | same | | tencent-tokenhub `hy4-flash` | 1048576/983040, text+image | 65536, effort high / $0.0000021 | same | same | | tencent-tokenhub `hy4-preview` (control) | 1024000, text | 64000, effort high / $0.0000208 | same | same | Tencent `hy4`/`hy4-flash` are already correct on main because the bundled Tencent manifest now carries their rows, so they serve as controls here. On 2026.11.4 the same hosted rows showed 128k text-only; that is the case this change fixes for any provider whose plugin lacks the row. Gates: consumer tests (model registry, `model-catalog`, prepared runtime catalog projection/publication/configured catalog, `models list` prepared catalog, manifest planner, pricing), `src/agents/agent-tools.prefix-stability.test.ts`, `pnpm tsgo:core`, oxlint and format on the changed files all pass. Production delta against the merge base: +68/−3 lines in `src/agents` (one read-time function plus a call-site swap). Test: +109. **Merge danger:** low. The change is read-time only, with no schema, protocol or stored-row change. If a hosted row is wrong for a listed model, its values now apply to that model, where before they were silently ignored. **Blast radius:** generated (live-listed) provider catalogs read through `ModelRegistry`. These are providers with `modelCatalog.discovery: runtime | refreshable` whose plugin manifest or the hosted catalog has a row for a listed ID. Static providers and authored `models.json` rows are untouched. Co-authored-by: Ayaan Zaidi <[email protected]>
) ## What Problem This Solves Some providers list their models live from the account: Together, Tencent TokenHub/TokenPlan, and other OpenAI-compatible live catalogs. When a listed model is missing from the plugin's built-in rows, OpenClaw ignores the hosted catalog's details for it and uses discovery defaults: 128k context, a 32k output cap and text-only input. For example, Together `moonshotai/Kimi-K3` has a 1M context window and accepts images according to the hosted catalog. Before this change, the picker showed it as 128k text-only and requests were capped at 32,768 output tokens. ## User Impact Live-listed models now get the hosted catalog's context window, output limit, input modalities, reasoning/compat data and price. This reaches the picker, `models list`, run-time model resolution, compaction limits and request `max_tokens`. The account listing still decides which models exist. A catalog row the account does not list stays hidden, and a listed ID with no catalog row keeps its discovered values. Stored catalog rows are unchanged. ## Why This Change Was Made The planner already merges bundled and hosted rows correctly (`planEffectiveModelCatalogRows`). The prepared catalog then drops planned rows for runtime/refreshable providers on purpose (#143837): a manifest row must not publish a model the account does not list. The live projection is left to fill in the details for a listed ID, but it only searches the plugin's own static rows. This change does not add a second merge. `ModelRegistry`, when it reads a generated (live-listed) provider catalog, describes each listed ID with that planner's effective row. The catalog value wins field by field, and a discovered value fills only what the catalog omits. The row keeps its ID, its route and a declared non-chat kind. <details><summary>Single-owner trace: every consumer reads the registry rows</summary> - **Picker / `models list`:** `buildModelsListResult` reads the published snapshot from `prepareFullCatalogFacts` (`src/agents/prepared-model-runtime.full-catalog.ts`). It passes `templateModelRegistry.getAll()` (`ModelRegistry`) as `models` into `buildPreparedModelCatalogSnapshot`, whose `dynamicManifestKeys` filter (`src/agents/model-catalog.ts`) still drops the planned rows, so registry rows are the only source for these providers. - **Run-time resolution:** `resolveModelAsync` → `resolveExplicitModelWithRegistry` (`model.registry-resolution.ts`) reads `preparedCatalogModel ?? modelRegistry.find(...)`. `preparedCatalogModel` comes from `completeConfiguredRuntimeModels`, which resolves through the same registry. - **Context window / compaction:** `src/agents/context.ts` projects `owner.modelCatalog.entries`, the registry-derived snapshot above, and the resolved model's `contextWindow`. - **Request max tokens:** taken from the resolved runtime model (above). The captured request moves from 32768 to about 1M for Kimi-K3. - **Usage cost:** `withResolvedPricing` → `resolveModelCostConfig` and the Gateway usage paths (`captureModelCostPricing`) price through `prepareModelPricingContext`. That pricing owner already reads the same planner plus hosted prices, so turn cost was already correct for these rows on main (measured below). The registry row now carries the same price, so the two agree. No change was made to the pricing owner. - **Persistence:** `models-config.plan.ts` keeps the plain admission filter (`filterGeneratedPluginModelCatalogProviders`), so stored generated rows stay as discovered and the description is applied at read time only. </details> ## Evidence Regression test `model-registry.catalog-description.test.ts`: it fails on base `f52f728d3415` (the listed row keeps `name`/`maxTokens`/`input` discovery defaults) and passes on the branch. Real E2E, base main `f52f728d3415` vs this branch, both dist builds. Each side ran an isolated Gateway with dummy keys and a candidate hosted catalog republished from the branch with `scripts/publish-model-catalog.mts`, served on loopback. Provider traffic for the real Together and Tencent host names went to a self-signed TLS mock through a test-only preload; the configured base URLs stayed the real ones. | row | base: list | base: request / cost | branch: list | branch: request / cost | |---|---|---|---|---| | together `moonshotai/Kimi-K3` (hosted-only) | **128000, text** | **max_tokens 32768** / $0.000105 | 1048576, text+image | max_tokens 1020067 / $0.000105 | | together `zai-org/GLM-5.2` (control) | 262144, text | 131072 / $0.000036 | same | same | | tencent-tokenhub `hy4` | 1024000/960000, text+image | 64000, effort high / $0.0000208 | same | same | | tencent-tokenhub `hy4-flash` | 1048576/983040, text+image | 65536, effort high / $0.0000021 | same | same | | tencent-tokenhub `hy4-preview` (control) | 1024000, text | 64000, effort high / $0.0000208 | same | same | Tencent `hy4`/`hy4-flash` are already correct on main because the bundled Tencent manifest now carries their rows, so they serve as controls here. On 2026.11.4 the same hosted rows showed 128k text-only; that is the case this change fixes for any provider whose plugin lacks the row. Gates: consumer tests (model registry, `model-catalog`, prepared runtime catalog projection/publication/configured catalog, `models list` prepared catalog, manifest planner, pricing), `src/agents/agent-tools.prefix-stability.test.ts`, `pnpm tsgo:core`, oxlint and format on the changed files all pass. Production delta against the merge base: +68/−3 lines in `src/agents` (one read-time function plus a call-site swap). Test: +109. **Merge danger:** low. The change is read-time only, with no schema, protocol or stored-row change. If a hosted row is wrong for a listed model, its values now apply to that model, where before they were silently ignored. **Blast radius:** generated (live-listed) provider catalogs read through `ModelRegistry`. These are providers with `modelCatalog.discovery: runtime | refreshable` whose plugin manifest or the hosted catalog has a row for a listed ID. Static providers and authored `models.json` rows are untouched. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit cacbd46) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 35ae84abfb92e7b89de680273338474f190bf3f6)
What Problem This Solves
Some providers list their models live from the account: Together, Tencent TokenHub/TokenPlan, and other OpenAI-compatible live catalogs. When a listed model is missing from the plugin's built-in rows, OpenClaw ignores the hosted catalog's details for it and uses discovery defaults: 128k context, a 32k output cap and text-only input. For example, Together
moonshotai/Kimi-K3has a 1M context window and accepts images according to the hosted catalog. Before this change, the picker showed it as 128k text-only and requests were capped at 32,768 output tokens.User Impact
Live-listed models now get the hosted catalog's context window, output limit, input modalities, reasoning/compat data and price. This reaches the picker,
models list, run-time model resolution, compaction limits and requestmax_tokens. The account listing still decides which models exist. A catalog row the account does not list stays hidden, and a listed ID with no catalog row keeps its discovered values. Stored catalog rows are unchanged.Why This Change Was Made
The planner already merges bundled and hosted rows correctly (
planEffectiveModelCatalogRows). The prepared catalog then drops planned rows for runtime/refreshable providers on purpose (#143837): a manifest row must not publish a model the account does not list. The live projection is left to fill in the details for a listed ID, but it only searches the plugin's own static rows.This change does not add a second merge.
ModelRegistry, when it reads a generated (live-listed) provider catalog, describes each listed ID with that planner's effective row. The catalog value wins field by field, and a discovered value fills only what the catalog omits. The row keeps its ID, its route and a declared non-chat kind.Single-owner trace: every consumer reads the registry rows
models list:buildModelsListResultreads the published snapshot fromprepareFullCatalogFacts(src/agents/prepared-model-runtime.full-catalog.ts). It passestemplateModelRegistry.getAll()(ModelRegistry) asmodelsintobuildPreparedModelCatalogSnapshot, whosedynamicManifestKeysfilter (src/agents/model-catalog.ts) still drops the planned rows, so registry rows are the only source for these providers.resolveModelAsync→resolveExplicitModelWithRegistry(model.registry-resolution.ts) readspreparedCatalogModel ?? modelRegistry.find(...).preparedCatalogModelcomes fromcompleteConfiguredRuntimeModels, which resolves through the same registry.src/agents/context.tsprojectsowner.modelCatalog.entries, the registry-derived snapshot above, and the resolved model'scontextWindow.withResolvedPricing→resolveModelCostConfigand the Gateway usage paths (captureModelCostPricing) price throughprepareModelPricingContext. That pricing owner already reads the same planner plus hosted prices, so turn cost was already correct for these rows on main (measured below). The registry row now carries the same price, so the two agree. No change was made to the pricing owner.models-config.plan.tskeeps the plain admission filter (filterGeneratedPluginModelCatalogProviders), so stored generated rows stay as discovered and the description is applied at read time only.Evidence
Regression test
model-registry.catalog-description.test.ts: it fails on basef52f728d3415(the listed row keepsname/maxTokens/inputdiscovery defaults) and passes on the branch.Real E2E, base main
f52f728d3415vs this branch, both dist builds. Each side ran an isolated Gateway with dummy keys and a candidate hosted catalog republished from the branch withscripts/publish-model-catalog.mts, served on loopback. Provider traffic for the real Together and Tencent host names went to a self-signed TLS mock through a test-only preload; the configured base URLs stayed the real ones.moonshotai/Kimi-K3(hosted-only)zai-org/GLM-5.2(control)hy4hy4-flashhy4-preview(control)Tencent
hy4/hy4-flashare already correct on main because the bundled Tencent manifest now carries their rows, so they serve as controls here. On 2026.11.4 the same hosted rows showed 128k text-only; that is the case this change fixes for any provider whose plugin lacks the row.Gates: consumer tests (model registry,
model-catalog, prepared runtime catalog projection/publication/configured catalog,models listprepared catalog, manifest planner, pricing),src/agents/agent-tools.prefix-stability.test.ts,pnpm tsgo:core, oxlint and format on the changed files all pass.Production delta against the merge base: +68/−3 lines in
src/agents(one read-time function plus a call-site swap). Test: +109.Merge danger: low. The change is read-time only, with no schema, protocol or stored-row change. If a hosted row is wrong for a listed model, its values now apply to that model, where before they were silently ignored.
Blast radius: generated (live-listed) provider catalogs read through
ModelRegistry. These are providers withmodelCatalog.discovery: runtime | refreshablewhose plugin manifest or the hosted catalog has a row for a listed ID. Static providers and authoredmodels.jsonrows are untouched.