bug: ProviderService.getDefaultModel() returns first available model with no reasoning guarantee #207
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
ProviderService.getDefaultModel()returnsavailable[0]— the first model in the registry that has valid auth. This is non-deterministic and routinely returns a model withreasoning: false(Ollama, custom providers), causinggetAvailableThinkingLevels()to return["off"]for every new session.Root Cause
apps/gateway/src/agent/provider.service.ts:The built-in model list is ordered
amazon-bedrock → anthropic → azure → .... However:OLLAMA_BASE_URL) it is registered viaregisterOllamaProvider()and appended after built-ins. Built-ins only appear if their env-var API key is present.available[0]is an Ollama model withreasoning: false.ANTHROPIC_API_KEYpresent, if another provider sorts first inavailable[], thinking may still be unavailable.Because
createAgentSessionis called without an explicitthinkingLevel, it initialises tosettingsManager.getDefaultThinkingLevel() ?? "medium"— but then clamps to"off"whenmodel.reasoningis falsy. The session is born with thinking permanently off.Impact
--modelflag uses whichever model happens to beavailable[0]session:inforeportsthinkingLevel: "off"andavailableThinkingLevels: ["off"]Expected Behaviour
getDefaultModel()should prefer a model withreasoning: truewhen thinking is required, or the session-creation path should surface the model's capabilities so callers can make an informed choice.Affected File
apps/gateway/src/agent/provider.service.ts—getDefaultModel()apps/gateway/src/agent/agent.service.ts—doCreateSession()(passes nothinkingLevel)