fix(model-resolver): gate saved default restore on provider readiness

Restore the isProviderRequestReady() guard lost during the main merge.
Tests in model-resolver.test.ts and model-resolver-initial-model-auth.test.ts
require findInitialModel() to skip an unauth'd saved default and fall
through to the first available model.
This commit is contained in:
Jeremy 2026-04-13 10:26:28 -05:00
parent bafa4e483d
commit cce3bc6828

View file

@ -474,7 +474,10 @@ export async function findInitialModel(options: {
// 3. Try saved default from settings — use it exactly as configured.
// Whatever the user chose is what gets used; no silent substitution.
if (defaultProvider && defaultModelId) {
// Skip the saved default if its provider is not request-ready (no auth
// available) so we fall through to an actually-usable model instead of
// returning a stale selection every selector surface would display.
if (defaultProvider && defaultModelId && modelRegistry.isProviderRequestReady(defaultProvider)) {
const found = modelRegistry.find(defaultProvider, defaultModelId);
if (found) {
model = found;