#11875: fix(ollama): accept /model directive for configured providers
stale
Cluster:
Ollama Model Enhancements
## Summary
When using `/model ollama/modelname`, the directive was rejected because the model wasn't in the curated catalog (`models.json`), even though the Ollama provider was explicitly configured in `openclaw.json`.
This PR adds a fallback check: if a model isn't in the catalog but the provider is explicitly configured, allow the directive.
## Changes
- Added fallback check in `directive-handling.model.ts` to allow models from configured providers
## Test Plan
1. Configure Ollama provider in `openclaw.json` without listing every model
2. Use `/model ollama/some-dynamic-model`
3. Verify the model switch is accepted
🤖 Generated with [Claude Code](https://claude.ai/code)
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This change updates model directive handling so that `/model <provider>/<model>` is accepted even when the specified model isn’t in the curated catalog, as long as the provider is explicitly configured in `openclaw.json` (intended to support dynamic providers like Ollama).
The key behavioral change is in `resolveModelSelectionFromDirective`, where a new fallback checks `cfg.models.providers` to allow provider/model pairs that would otherwise be rejected by the allowlist check against `allowedModelKeys`.
<h3>Confidence Score: 3/5</h3>
- This PR is mergeable after fixing an allowlist-bypass behavior change in /model directives.
- The change is small and localized, but the new fallback currently permits selecting arbitrary models for any configured provider even when an explicit allowlist is present, which contradicts existing allowlist enforcement and could weaken intended restrictions.
- src/auto-reply/reply/directive-handling.model.ts
<!-- greptile_other_comments_section -->
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#4782: fix: Auto-discover Ollama models without requiring explicit API key
by spiceoogway · 2026-01-30
83.4%
#9822: fix: allow local/custom model providers for sub-agent inference
by stammtobias91 · 2026-02-05
77.8%
#11877: feat(ollama): auto-detect vision capability via /api/show
by Nina-VanKhan · 2026-02-08
77.4%
#18587: fix(ollama): improve timeout handling and cooldown logic for local ...
by manthis · 2026-02-16
76.8%
#9583: fix(models): allow models in agents.defaults.models even if not in ...
by hotzen100 · 2026-02-05
76.8%
#7570: fix: allow models from providers with auth profiles configured
by DonSqualo · 2026-02-03
76.1%
#14508: fix(models): allow forward-compat models in allowlist check
by jonisjongithub · 2026-02-12
76.1%
#21977: Preserve provider API for discovered Ollama models
by graysurf · 2026-02-20
76.0%
#5115: fix: guard against undefined model.name in Ollama discovery (#5062)
by TheWildHustle · 2026-01-31
75.6%
#7278: feat(ollama): optimize local LLM support with auto-discovery and ti...
by alltomatos · 2026-02-02
74.8%