Skip to content

[BUG] Sub-agents Don't Inherit Model Configuration in Task Tool #5456

Description

@jumane

Bug Report: Sub-agents Don't Inherit Model Configuration in Task Tool

Summary

When using the Task tool to spawn sub-agents, they default to Claude Sonnet 4 instead of inheriting the configured model (Claude Opus 4.1) from both global and local settings.

Environment

  • Claude Code Version: 1.0.72
  • Platform: Linux 6.8.0-65-generic
  • Date: 2025-08-09
  • Parent Model: claude-opus-4-1-20250805 (Claude Opus 4.1)
  • Sub-agent Model: claude-sonnet-4-20250514 (Claude Sonnet 4)

Configuration

Both global and local settings explicitly request Opus model:

Global Settings (~/.claude/settings.json)

{
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
  "model": "opus"
}

Local Project Settings (.claude/settings.local.json)

{
  "model": "claude-opus-4-1-20250805"
}

Agent Definitions (.claude/agents/*.md)

All 15 custom agents have explicit model specification:

---
name: debugger
model: claude-opus-4-1-20250805
---

Steps to Reproduce

  1. Configure Claude Code with "model": "opus" in global settings
  2. Create local project settings with "model": "claude-opus-4-1-20250805"
  3. Create agent definitions with model specifications
  4. From main Claude Code session (running Opus 4.1), use Task tool to spawn a sub-agent:
    Task tool -> subagent_type: "debugger" -> prompt: "What is your model?"
    
  5. Sub-agent reports: "I am Claude Sonnet 4 (claude-sonnet-4-20250514)"

Expected Behavior

Sub-agents should inherit the model configuration from:

  1. Parent session model (Opus 4.1)
  2. Or respect local/global settings configuration
  3. Or use agent-specific model configuration

Actual Behavior

All sub-agents default to Claude Sonnet 4 regardless of:

  • Parent model being Opus 4.1
  • Global settings specifying "opus"
  • Local settings specifying "claude-opus-4-1-20250805"
  • Agent definitions specifying the model

Impact

  • Inconsistent model capabilities between parent and sub-agents
  • Unable to leverage Opus 4.1's advanced capabilities in delegated tasks
  • Configuration settings are effectively ignored for sub-agents
  • Makes multi-agent workflows less effective

Attempted Workarounds

  1. ✅ Set global settings to "opus"
  2. ✅ Create comprehensive local settings with model specification
  3. ✅ Add model to each agent definition file
  4. ✅ Set CLAUDE_CONFIG_DIR environment variable
  5. ❌ None of these affect sub-agent model selection

Suggested Fix

The Task tool should:

  1. Check parent session model and use it for sub-agents by default
  2. Respect model configuration in settings files
  3. Allow explicit model parameter in Task tool invocation
  4. Document model inheritance behavior

Additional Context

This issue significantly impacts complex multi-agent workflows where consistent model capabilities are critical. In our case, we're running a production financial system that requires the most advanced model for all analytical tasks.

Verification Test

# Main session check
print(f"Parent model: {model_id}")  # Returns: claude-opus-4-1-20250805

# Sub-agent check (via Task tool)
Task(subagent_type="debugger", prompt="Report your model ID")
# Returns: claude-sonnet-4-20250514

# Expected: Both should return claude-opus-4-1-20250805

Reported by: WNBA Betting System Team
Claude Code Version: 1.0.72
Priority: High - Blocks advanced multi-agent workflows

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions