diff --git a/src/agents/utils.ts b/src/agents/utils.ts index 57eb6827f..83f4f8dc4 100644 --- a/src/agents/utils.ts +++ b/src/agents/utils.ts @@ -329,7 +329,7 @@ export async function createBuiltinAgents( const atlasRequirement = AGENT_MODEL_REQUIREMENTS["atlas"] const atlasResolution = resolveModelWithFallback({ - uiSelectedModel, + // NOTE: Atlas does NOT use uiSelectedModel - respects its own fallbackChain (k2p5 primary) userModel: orchestratorOverride?.model, fallbackChain: atlasRequirement?.fallbackChain, availableModels, diff --git a/src/shared/connected-providers-cache.ts b/src/shared/connected-providers-cache.ts index c7a91ffb3..ae6e3e433 100644 --- a/src/shared/connected-providers-cache.ts +++ b/src/shared/connected-providers-cache.ts @@ -159,13 +159,13 @@ export async function updateConnectedProvidersCache(client: { writeConnectedProvidersCache(connected) - // Also update provider-models cache if model.list is available + // Always update provider-models cache (overwrite with fresh data) + let modelsByProvider: Record = {} if (client.model?.list) { try { const modelsResult = await client.model.list() const models = modelsResult.data ?? [] - const modelsByProvider: Record = {} for (const model of models) { if (!modelsByProvider[model.provider]) { modelsByProvider[model.provider] = [] @@ -173,19 +173,21 @@ export async function updateConnectedProvidersCache(client: { modelsByProvider[model.provider].push(model.id) } - writeProviderModelsCache({ - models: modelsByProvider, - connected, - }) - - log("[connected-providers-cache] Provider-models cache updated", { + log("[connected-providers-cache] Fetched models from API", { providerCount: Object.keys(modelsByProvider).length, totalModels: models.length, }) } catch (modelErr) { - log("[connected-providers-cache] Error fetching models", { error: String(modelErr) }) + log("[connected-providers-cache] Error fetching models, writing empty cache", { error: String(modelErr) }) } + } else { + log("[connected-providers-cache] client.model.list not available, writing empty cache") } + + writeProviderModelsCache({ + models: modelsByProvider, + connected, + }) } catch (err) { log("[connected-providers-cache] Error updating cache", { error: String(err) }) }