Highlights
providers configure and agent spawn --provider/--model previously persisted user intent but the execution path (callAnthropicMessages, executeAgentTask, determineAgentModel) only ever consulted env vars and a fixed 5-alias model list β silently discarding both. A user who configured local Ollama or OpenRouter would see two successful CLI commands, then execution would either fail closed or silently use a different provider/model than requested.
determineAgentModel()now treats any non-aliasconfig.modelstring (e.g. an Ollama tag) as an explicit selection via the existingmodelIdfast-path, instead of falling through to task-based routing / agent-type defaults.agent_spawnforwardsconfig.providerinto the stored (and returned) agent record when it's an unambiguous explicit choice (ollama/openrouter;anthropicis excluded since the CLI silently defaults to it when--providerisn't passed).callAnthropicMessages()now consults the persistedagents.providersconfig forbaseUrl/apiKey/modelwhen env vars are absent. A self-hosted, unauthenticated Ollama endpoint no longer requires the undocumentedOLLAMA_API_KEY=localsentinel.executeAgentTask()forwards the agent's explicit provider into the first dispatch call.
Precedence (resolving the open design question from the issue thread, credit @pacphi): explicit per-agent flag β env vars β persisted agents.providers config β key-presence inference (unchanged, last resort).
Regression coverage: v3/@claude-flow/cli/__tests__/agent-provider-model-propagation.test.ts (3 tests, each verified to fail against the pre-fix code and pass against the fix).
Verification
- TypeScript clean (
tsc --noEmit) - 202/209 existing tests green for touched files (7 pre-existing unrelated failures confirmed present on unpatched
maintoo β stalefsmock inmcp-tools-deep.test.ts) - CI: 107 checks passed, 3 skipped (conditional), 0 failed
- Tarball-verified: fix present in the published
@claude-flow/cli@3.38.8package