fix(agents): return 'inherit' instead of 'opus' for model resolution (#558)

Claude Code's "opus" alias maps to a specific model version (claude-opus-4-1).
Organizations that block older opus versions while allowing newer ones see
agents silently fall back to Sonnet. By returning "inherit" instead, agents
use whatever opus version the user has configured in their session.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Lex Christopherson
2026-02-15 09:21:40 -06:00
parent ca18c24474
commit 2b9951b9c8
3 changed files with 11 additions and 4 deletions

View File

@@ -1347,7 +1347,8 @@ function cmdResolveModel(cwd, agentType, raw) {
return;
}
const model = agentModels[profile] || agentModels['balanced'] || 'sonnet';
const resolved = agentModels[profile] || agentModels['balanced'] || 'sonnet';
const model = resolved === 'opus' ? 'inherit' : resolved;
const result = { model, profile };
output(result, raw, model);
}
@@ -3509,7 +3510,8 @@ function resolveModelInternal(cwd, agentType) {
const profile = config.model_profile || 'balanced';
const agentModels = MODEL_PROFILES[agentType];
if (!agentModels) return 'sonnet';
return agentModels[profile] || agentModels['balanced'] || 'sonnet';
const resolved = agentModels[profile] || agentModels['balanced'] || 'sonnet';
return resolved === 'opus' ? 'inherit' : resolved;
}
function findPhaseInternal(cwd, phase) {

View File

@@ -20,13 +20,15 @@ Look up the agent in the table for the resolved profile. Pass the model paramete
Task(
prompt="...",
subagent_type="gsd-planner",
model="{resolved_model}" # e.g., "opus" for quality profile
model="{resolved_model}" # "inherit", "sonnet", or "haiku"
)
```
**Note:** Opus-tier agents resolve to `"inherit"` (not `"opus"`). This causes the agent to use the parent session's model, avoiding conflicts with organization policies that may block specific opus versions.
## Usage
1. Resolve once at orchestration start
2. Store the profile value
3. Look up each agent's model from the table when spawning
4. Pass model parameter to each Task call
4. Pass model parameter to each Task call (values: `"inherit"`, `"sonnet"`, `"haiku"`)

View File

@@ -71,3 +71,6 @@ Verification requires goal-backward reasoning - checking if code *delivers* what
**Why Haiku for gsd-codebase-mapper?**
Read-only exploration and pattern extraction. No reasoning required, just structured output from file contents.
**Why `inherit` instead of passing `opus` directly?**
Claude Code's `"opus"` alias maps to a specific model version. Organizations may block older opus versions while allowing newer ones. GSD returns `"inherit"` for opus-tier agents, causing them to use whatever opus version the user has configured in their session. This avoids version conflicts and silent fallbacks to Sonnet.