← Back to PRs

#11562: Fix #10883: Enforce subagent model configuration

by divol89 open 2026-02-08 00:42 View on GitHub →
channel: signal channel: telegram app: web-ui gateway cli commands agents stale
## 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