openclaw - ✅(Solved) Fix Adding a provider can silently switch the default model to an expensive tier [1 pull requests, 2 comments, 3 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#78162Fetched 2026-05-06 06:16:25
View on GitHub
Comments
2
Participants
3
Timeline
3
Reactions
2
Author
Timeline (top)
commented ×2cross-referenced ×1

Root Cause

This is a user-safety / cost-control issue. Users should be able to add providers and gain access to models without accidentally being switched onto the most expensive one.

PR fix notes

PR #78241: fix(models/auth): preserve default model unless --set-default (fixes #78162)

Description (problem / solution / changelog)

Summary

When running openclaw models auth login without --set-default, merged provider configPatch / applyConfig output could still overwrite agents.defaults.model (for example OpenAI and Gemini helpers call applyAgentDefaultModelPrimary). That silently switched the live primary to the provider’s recommended tier.

Root cause

persistProviderAuthResult merged the auth configPatch before applying defaultModel, but only gated the explicit applyDefaultModel(...) step on --set-default. Patches that embedded agents.defaults.model escaped that gate.

Fix

Snapshot agents.defaults.model from the on-disk config at the start of the update mutator and, when --set-default is not passed and a prior model section existed, restore it after the patch + auth profile bindings. New configs with no prior agents.defaults.model still accept the patch’s primary. --set-default unchanged: applyDefaultModel still runs after restore.

Why this is safe

  • Policy is enforced in config persistence, not prompt wording.
  • No OAuth/API credential handling changes; auth profiles and patch merges for allowlists and provider tables behave as before.
  • Opt-in --set-default path is unchanged.

Security / runtime controls

Unchanged: gateway auth, SecretRef resolution, auth profile storage, and provider credential flows. This only affects how merged onboarding config applies to agents.defaults.model for the models-auth CLI persist path.

Tests run

  • pnpm vitest run src/commands/models/auth.test.ts
  • pnpm check:changed

Real behavior proof

To be filled from your machine: after upgrading to this branch, run openclaw models auth login for a provider whose applyConfig sets a recommended primary while your config already has a different agents.defaults.model.primary; confirm openclaw models status still reports the previous primary until you pass --set-default or openclaw models set._

Out of scope / follow-ups

  • Tier labeling (cheap/balanced/premium) from the issue discussion.
  • Refactoring individual provider applyConfig functions to stop emitting primary in patches (could be redundant after this guard).

Fixes #78162.

Made with Cursor

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • docs/concepts/model-providers.md (modified, +1/-1)
  • src/commands/models/auth.test.ts (modified, +58/-1)
  • src/commands/models/auth.ts (modified, +7/-0)
  • src/plugins/provider-auth-choice-helpers.ts (modified, +25/-0)

Code Example

openclaw config set agents.defaults.model.primary openai-codex/gpt-5.4
RAW_BUFFERClick to expand / collapse

When adding or refreshing a provider, OpenClaw can end up setting that provider’s top-tier/latest model as the default even if the user did not explicitly choose it.

I’ve now seen this happen with:

  • OpenAI
  • Google / Gemini
  • Anthropic

This is risky because it can:

  • increase spend unexpectedly
  • exhaust OAuth/auth faster than expected
  • confuse users about what model is actually live

To be clear: I do want those premium models available in the usable model list. I just don’t want them becoming the default without me knowingly choosing that.

Example

After adding/refreshing a provider, openclaw models status showed a premium model as the default, and the fix required a manual config command like:

openclaw config set agents.defaults.model.primary openai-codex/gpt-5.4

Most users will not know to do that.

Proposed fix

Adding a provider should not silently change the active default model.

Safer behavior would be:

  1. preserve the current default unless the user explicitly changes it
  2. add new provider models as available, but not default
  3. if OpenClaw wants to suggest a new default, require confirmation
  4. ideally label model tiers like:
    • cheap
    • balanced
    • premium

Why this matters

This is a user-safety / cost-control issue. Users should be able to add providers and gain access to models without accidentally being switched onto the most expensive one.

extent analysis

TL;DR

To prevent unexpected changes to the default model, OpenClaw should preserve the current default model when adding or refreshing a provider unless the user explicitly chooses a new default.

Guidance

  • When adding or refreshing a provider, ensure that the current default model is preserved to avoid unexpected changes.
  • Consider adding a confirmation step when suggesting a new default model to prevent accidental changes.
  • Labeling model tiers (e.g., cheap, balanced, premium) can help users make informed decisions about their default model.
  • Review the openclaw config set command to ensure it allows users to easily change their default model if needed.

Example

The proposed fix suggests using a command like openclaw config set agents.defaults.model.primary openai-codex/gpt-5.4 to manually set the default model, but a more user-friendly solution may be needed.

Notes

The exact implementation details of the proposed fix are not provided, so further discussion and testing may be necessary to ensure the solution meets user needs.

Recommendation

Apply a workaround by manually setting the default model using the openclaw config set command until a more permanent solution is implemented, as this will allow users to maintain control over their default model choice.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix Adding a provider can silently switch the default model to an expensive tier [1 pull requests, 2 comments, 3 participants]