Skip to content

fix: use hosted catalog limits and input for live-listed models - #200403

Merged
obviyus merged 5 commits into
mainfrom
openclaw/dawn-langoustine
Nov 17, 2026
Merged

obviyus merged 5 commits into
mainfrom
openclaw/dawn-langoustine

Conversation

@obviyus

@obviyus obviyus commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

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.

Single-owner trace: every consumer reads the registry rows
  • 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.

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.

obviyus and others added 5 commits November 17, 2026 08:50
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]>
OpenClaw-Publication: adf6e2e6-ba18-824c-a17f-a463fd687476
@clawsweeper

clawsweeper Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Nov 17, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 17, 2026
@obviyus
obviyus merged commit cacbd46 into main Nov 17, 2026
126 checks passed
@obviyus
obviyus deleted the openclaw/dawn-langoustine branch November 17, 2026 04:22
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 17, 2026
@obviyus

obviyus commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator Author

Landed in cacbd46.

  • Bug: for live-listed providers (Together, Tencent and other refreshable catalogs), a listed model missing from the plugin's built-in rows got discovery defaults: 128k context, a 32k output cap and text-only input. The hosted catalog's row for that model was ignored.
  • Fix: ModelRegistry now describes each listed ID with the planner's effective catalog row (bundled plus hosted) at read time. The listing still decides which models exist, and stored rows are unchanged.
  • Proof: the regression test fails on base and passes here. In the real base vs branch Gateway E2E, Together Kimi-K3 went from 128k text-only with max_tokens 32768 to 1M text+image with max_tokens ≈1M. The controls did not change. The local review was clean and CI was green on the exact head.

@clawsweeper

clawsweeper Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

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

  • Before: The reported Gateway comparison shows 128,000 context tokens, text-only input, and max_tokens 32768.
  • After: The reported branch comparison shows 1,048,576 context tokens, text and image input, and max_tokens 1020067.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The repair has clear value and useful Gateway observations, but optional-field handling is incorrect and the repository-required live proof remains incomplete.
Proof confidence 🦪 silver shellfish (2/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦪 silver shellfish (2/6) 2 actionable review findings remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Live-listed models absent from bundled rows show understated context limits and missing image support, and receive an incorrect output cap.
Reason: The change restores the documented split between account-owned availability and catalog-owned metadata, and its maintainer-authored direction needs no additional product approval.

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
Reviewed head: 5b7de7ab5741fa86e46fd42c97505d5881649b58

Before merge

  • Preserve discovered capabilities when catalog fields are omitted (P2) - A valid hosted row can provide contextWindow 1048576 and maxTokens 65536 while omitting input and reasoning. If discovery reported input ["text", "image"] and reasoning true, normalizeModelCatalogProviderRows supplies input ["text"] and reasoning false for those omissions. Spreading metadata here then replaces the discovered capabilities, making a previously image-capable reasoning model text-only and non-reasoning. Preserve field presence through the existing planner/projection boundary and apply defaults after merging; add a regression with omitted catalog fields.
  • Enrich partial catalog rows without requiring both token limits (P2) - The hosted schema permits contextWindow and maxTokens independently, but buildEffectiveManifestProviderConfig discards every row missing either value. For a listed model with discovered maxTokens 32768 and a hosted row containing contextWindow 1048576 and image input but no maxTokens, catalogModel is absent and this function returns the unchanged 128000/text-only discovery row. Fill the omitted limit from discovery before complete runtime materialization so the available hosted fields still apply.

Findings

  • [P2] Preserve discovered capabilities when catalog fields are omitted — src/agents/sessions/model-registry-sources.ts:224-226
  • [P2] Enrich partial catalog rows without requiring both token limits — src/agents/sessions/model-registry-sources.ts:211-212

Tests

  • Missing end-to-end proof: Provide redacted output from an isolated Gateway using a real provider/model with a hosted-only row, showing corrected model metadata and an accepted agent request; remove IPs, keys, phone numbers, and private endpoints.
Agent review details

How this fits together

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

Technical review

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

  • [P2] Preserve discovered capabilities when catalog fields are omitted — src/agents/sessions/model-registry-sources.ts:224-226
    A valid hosted row can provide contextWindow 1048576 and maxTokens 65536 while omitting input and reasoning. If discovery reported input ["text", "image"] and reasoning true, normalizeModelCatalogProviderRows supplies input ["text"] and reasoning false for those omissions. Spreading metadata here then replaces the discovered capabilities, making a previously image-capable reasoning model text-only and non-reasoning. Preserve field presence through the existing planner/projection boundary and apply defaults after merging; add a regression with omitted catalog fields.
    Confidence: 0.98
  • [P2] Enrich partial catalog rows without requiring both token limits — src/agents/sessions/model-registry-sources.ts:211-212
    The hosted schema permits contextWindow and maxTokens independently, but buildEffectiveManifestProviderConfig discards every row missing either value. For a listed model with discovered maxTokens 32768 and a hosted row containing contextWindow 1048576 and image input but no maxTokens, catalogModel is absent and this function returns the unchanged 128000/text-only discovery row. Fill the omitted limit from discovery before complete runtime materialization so the available hosted fields still apply.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against a117ca507362.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test src/agents/sessions/model-registry.catalog-description.test.ts src/model-catalog/manifest-planner.test.ts --maxWorkers=1
  • pnpm test src/agents/agent-tools.prefix-stability.test.ts --maxWorkers=1
  • pnpm tsgo:core
  • git diff --check

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit f7a419a adds src/agents/model-catalog.ts:184 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f7a419aeaf72; files: src/agents/model-catalog.ts)
  • Vincent Koc: Raw commit 625945b adds src/agents/sessions/model-registry.core.ts:364 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 625945b7ae01; files: src/agents/sessions/model-registry.core.ts)
  • Peter Steinberger: Raw commit 7dcd9a3 adds src/agents/model-catalog.ts:376 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 7dcd9a34be0d; files: src/agents/model-catalog.ts)

PR surface

Source +65, Tests +109. Total +174 across 4 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 3 68 3 +65
Tests 1 109 0 +109
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 177 3 +174

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P2: Incorrect metadata limits capabilities for affected live-listed models, with no demonstrated broad outage or urgent regression.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: Incorrect metadata limits capabilities for affected live-listed models, with no demonstrated broad outage or urgent regression.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 16, 2026, 11:21 PM ET / November 17, 2026, 04:21 UTC.

RomneyDa added a commit that referenced this pull request Nov 17, 2026
…#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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 18, 2026
…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]>
RomneyDa added a commit that referenced this pull request Nov 19, 2026
)

## 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant