openclaw - ✅(Solved) Fix Model picker ignores models.mode=replace, shows full catalog [2 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#64950Fetched 2026-04-12 13:26:13
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
cross-referenced ×2

Fix Action

Fix

Use buildConfiguredModelCatalog({ cfg }) (already exported from src/agents/model-selection.ts) when cfg.models?.mode === "replace", falling back to loadModelCatalog() for "merge" mode (default).

PR fix notes

PR #64953: fix(models): respect models.mode=replace in model picker and gateway catalog

Description (problem / solution / changelog)

Summary

  • When models.mode is set to replace, the model picker (promptDefaultModel and promptModelAllowlist) and the gateway catalog (loadGatewayModelCatalog) now use buildConfiguredModelCatalog instead of fetching the full remote catalog via loadModelCatalog.
  • Previously, models.mode=replace was only honored during inference model resolution but ignored in the picker and gateway catalog, causing the full provider catalog to appear regardless of the user's configuration.
  • Both call sites in src/flows/model-picker.ts and the single call site in src/gateway/server-model-catalog.ts are fixed.

Fixes https://github.com/openclaw/openclaw/issues/64950

Changed files

  • src/flows/model-picker.ts (modified, +7/-2)
  • src/gateway/server-model-catalog.ts (modified, +6/-1)

PR #64967: fix(model-picker,gateway): respect models.mode=replace

Description (problem / solution / changelog)

Fixes #64950.

When models.mode: "replace" is set, the gateway model catalog and CLI picker were still showing the merged built-in catalog. This switches both paths to the configured catalog in replace mode, while leaving the default merge behavior alone.

Testing:

  • pnpm exec vitest run src/commands/model-picker.test.ts

Changed files

  • src/commands/model-picker.test.ts (modified, +58/-0)
  • src/flows/model-picker.ts (modified, +7/-2)
  • src/gateway/server-model-catalog.ts (modified, +6/-1)
RAW_BUFFERClick to expand / collapse

Bug

When models.mode is set to "replace" in the configuration, the model picker still shows the full built-in model catalog instead of only the user-configured models from models.providers.

The "replace" mode is correctly respected in the runtime model selection path (src/auto-reply/reply/model-selection.ts via buildConfiguredModelCatalog()), but ignored in:

  1. CLI model picker (src/flows/model-picker.ts) — promptDefaultModel() and promptModelAllowlist() always call loadModelCatalog() regardless of mode
  2. Gateway models.list handler (src/gateway/server-model-catalog.ts) — loadGatewayModelCatalog() always returns the full catalog, which is what the web UI model picker consumes

Expected behavior

When models.mode is "replace", the model picker (both CLI and web UI) should show only models defined in models.providers.

Fix

Use buildConfiguredModelCatalog({ cfg }) (already exported from src/agents/model-selection.ts) when cfg.models?.mode === "replace", falling back to loadModelCatalog() for "merge" mode (default).

extent analysis

TL;DR

Use the buildConfiguredModelCatalog function when models.mode is set to "replace" to correctly filter the model catalog.

Guidance

  • In src/flows/model-picker.ts, modify promptDefaultModel and promptModelAllowlist to use buildConfiguredModelCatalog when models.mode is "replace".
  • In src/gateway/server-model-catalog.ts, update loadGatewayModelCatalog to use buildConfiguredModelCatalog when models.mode is "replace", and fall back to loadModelCatalog for "merge" mode.
  • Verify the fix by checking the model picker in both CLI and web UI when models.mode is set to "replace" and ensuring only user-configured models are shown.
  • Review the buildConfiguredModelCatalog function in src/agents/model-selection.ts to ensure it correctly handles the models.providers configuration.

Example

if (cfg.models?.mode === "replace") {
  return buildConfiguredModelCatalog({ cfg });
} else {
  return loadModelCatalog();
}

Notes

This fix assumes that the buildConfiguredModelCatalog function is correctly implemented and exported from src/agents/model-selection.ts. If this function is not correctly handling the models.providers configuration, additional fixes may be required.

Recommendation

Apply the workaround by using the buildConfiguredModelCatalog function when models.mode is set to "replace", as this will correctly filter the model catalog and align with the expected behavior.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

When models.mode is "replace", the model picker (both CLI and web UI) should show only models defined in models.providers.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING