Skip to content

fix(acp): honor config.json model when provider not yet loaded#1170

Closed
chaodu-agent wants to merge 2 commits into
XiaomiMiMo:mainfrom
chaodu-agent:fix/acp-default-model-resolution
Closed

fix(acp): honor config.json model when provider not yet loaded#1170
chaodu-agent wants to merge 2 commits into
XiaomiMiMo:mainfrom
chaodu-agent:fix/acp-default-model-resolution

Conversation

@chaodu-agent

@chaodu-agent chaodu-agent commented Jun 21, 2026

Copy link
Copy Markdown

Summary

When defaultModel() finds a model specified in config.json but the corresponding provider is not in the providers list, return the specified model instead of falling through to Provider.sort().

Current Behavior

config.json: {"model": "mimo/mimo-auto"}
providers:   [xiaomi]  (mimo not yet indexed)

defaultModel():
  ├─ config.json → specified = "mimo/mimo-auto"          ✅
  ├─ providers.find("mimo") → NOT FOUND
  ├─ (specified exists BUT providers.length > 0)
  │   └─ does NOT return specified
  ├─ falls through ↓
  ├─ Provider.sort([xiaomi models...])
  │   └─ picks "xiaomi/mimo-v2.5-pro-ultraspeed"         ❌ paid
  └─ calls paid API → 0 tokens → "(no response)"

Expected Behavior

config.json: {"model": "mimo/mimo-auto"}
providers:   [xiaomi]  (mimo not yet indexed)

defaultModel():
  ├─ config.json → specified = "mimo/mimo-auto"          ✅
  ├─ providers.find("mimo") → NOT FOUND
  ├─ (specified exists, provider missing)
  │   └─ RETURNS specified  ← trust user's explicit config
  └─ calls mimo-auto API → works                         ✅

Fix

When the specified provider is not found in the providers list, return the user's choice rather than falling through to Provider.sort() which picks an unintended paid model.

Fixes #865

When defaultModel() finds a model specified in config.json but the
corresponding provider is not in the providers list, return the
specified model instead of falling through to Provider.sort().

Provider.sort() picks the 'best' model which is typically a paid
model (e.g., mimo-v2.5-pro-ultraspeed), causing unexpected billing
and empty responses for free-tier users.

Fixes XiaomiMiMo#865
Address review finding: if provider exists but model is not yet indexed
(e.g. during cold-start), still honor user's explicit config rather than
falling through to Provider.sort().
@chaodu-agent

Copy link
Copy Markdown
Author

Superseded by #1172 (combined with #1171, added unit tests)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ACP mode ignores default model set by mimo auth login

1 participant