#11562: Fix #10883: Enforce subagent model configuration
channel: signal
channel: telegram
app: web-ui
gateway
cli
commands
agents
stale
Cluster:
Model Management Enhancements
## Problem
Subagent model configuration in `agents.defaults.subagents.model` was being ignored. Subagents configured to use local Ollama models were falling back to cloud API models (Claude), causing unexpected costs.
## Root Cause
When executing a subagent session (`agent:{id}:subagent:{uuid}`), `agentCommand` resolved the model from the main agent configuration instead of checking for subagent-specific model settings.
## Fix
- Detect subagent sessions using `isSubagentSessionKey()`
- Read subagent model from `cfg.agents?.defaults?.subagents?.model`
- Use `effectiveModelPrimary` = `subagentModelPrimary ?? agentModelPrimary`
- Ensures subagents respect their configured model chain
## Testing
- Subagents with `agents.defaults.subagents.model.primary = "ollama/phi3:mini"` will now use the configured local model
- Falls back to agent model if no subagent config exists
Fixes #10883
Wallet: BYCgQQpJT1odaunfvk6gtm5hVd7Xu93vYwbumFfqgHb3
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR tightens up several configuration and runtime behaviors:
- Updates `agentCommand` model selection so subagent sessions (as identified by `isSubagentSessionKey`) can use `cfg.agents.defaults.subagents.model` as the effective primary model, falling back to the parent agent model when not configured.
- Adds a default `ollama` provider `baseUrl` when missing and relaxes the model provider schema to allow `baseUrl` to be omitted.
- Makes a collection of robustness tweaks across cron normalization/timer/store, Telegram native command registration, Signal edit handling, browser proxy parameter parsing, TTS OpenAI baseUrl support, and markdown rendering limits.
Overall, the change aligns subagent model resolution with config intent (preventing unexpected cloud model usage/cost) while also addressing a few operational edge cases in adjacent subsystems.
<h3>Confidence Score: 3/5</h3>
- Reasonably safe, but has a couple of correctness issues worth fixing before merge.
- Core subagent model-selection change is straightforward, but the new lane-task timeout introduces an uncleared timer (resource leak) and the Signal edit messageId logic can produce a constant "undefined" id, breaking deduplication for edits. Fixing these should make the PR low-risk.
- src/process/command-queue.ts, src/signal/monitor/event-handler.ts
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#13376: fix: pass model directly to agent for sub-agent runs
by jrbobbyhansen-pixel · 2026-02-10
86.2%
#20712: fix(subagents): prioritize agent runtime default model over global ...
by sourcesavant · 2026-02-19
86.2%
#9721: fix: heartbeat model override not working for per-agent config (#9556)
by divol89 · 2026-02-05
83.7%
#9583: fix(models): allow models in agents.defaults.models even if not in ...
by hotzen100 · 2026-02-05
83.3%
#21088: fix: sessions_sspawn model override ignored for sub-agents
by Slats24 · 2026-02-19
81.7%
#11474: fix(cron): respect subagents.model in isolated cron sessions
by AnonO6 · 2026-02-07
81.6%
#7292: feat: Implement subagent model inheritance system
by levineam · 2026-02-02
81.1%
#23286: fix: use configured model in llm-slug-generator instead of hardcoded …
by wsman · 2026-02-22
80.9%
#9080: Fix: Use configured model for memory file slug generation
by vishaltandale00 · 2026-02-04
80.4%
#16838: fix: include configured fallbacks in model allowlist
by taw0002 · 2026-02-15
79.6%