Skip to content

Subagent model resolution strips [1m] context window suffix #45169

Closed as not planned

Description

@dulvac

Summary

When spawning subagents (via the Agent tool or agent teams), the [1m] context window suffix is stripped during model alias resolution. Subagents always get the default ~200k context window, even when the parent session runs with 1M context.

Reproduction

  1. Set "model": "opus[1m]" in ~/.claude/settings.json
  2. Parent session correctly runs as claude-opus-4-6[1m] with 1M context
  3. Spawn a subagent via the Agent tool (any type — custom agent, general-purpose, etc.)
  4. The subagent's system prompt shows claude-opus-4-6 (no [1m]) and no context window size is mentioned

Evidence

The subprocess command that spawns the subagent passes:

--model claude-opus-4-6

instead of:

--model claude-opus-4-6[1m]

What we tested

Configuration Result
Parent opus[1m], no agent override Subagent gets claude-opus-4-6 (no 1M)
Agent frontmatter model: opus[1m] Subagent gets claude-opus-4-6 (no 1M)
Agent tool model: "opus" Subagent gets claude-opus-4-6 (no 1M)

All three approaches produce the same result — the [1m] suffix is dropped.

Expected behavior

The model alias resolution should preserve the [1m] suffix:

opus[1m] → claude-opus-4-6[1m]   (expected)
opus[1m] → claude-opus-4-6        (actual)

Subagents should be able to inherit or be explicitly configured to use the 1M context window, through any of:

  • Inheriting from parent session's model setting
  • model: opus[1m] in agent definition frontmatter
  • model parameter on the Agent tool

Environment

  • Claude Code v2.1.96
  • macOS (Darwin 23.1.0)
  • Model: opus[1m] (parent), claude-opus-4-6 (subagents)

Activity

  1. added
    bug
    platform:macos
    has repro
    on Apr 8, 2026
  2. github-actions commented on Apr 8, 2026

    @github-actions

    Found 3 possible duplicate issues:

    1. [BUG] Agent Teams teammates lose [1m] context window suffix — root cause: tmux spawn hardcodes model without variant #34421
    2. Agent subprocesses always get 200K context instead of 1M — --model flag bypasses plan entitlement #40929
    3. [BUG] Team agent teammates don't inherit [1m] context window variant from leader (v2.1.80) #36670

    This issue will be automatically closed as a duplicate in 3 days.

    • If your issue is a duplicate, please close it and 👍 the existing issue instead
    • To prevent auto-closure, add a comment or 👎 this comment

    🤖 Generated with Claude Code

  3. dulvac commented on Apr 8, 2026

    @dulvac
    Author

    Potential fix approach

    The simplest fix may be to omit the --model flag from the subagent spawn command when no explicit model override is specified (i.e., the agent should inherit the default).

    Currently, the spawner resolves the model alias and passes it explicitly:

    --model claude-opus-4-6    # [1m] stripped during resolution
    

    If the --model flag were omitted entirely, the subagent process would read ~/.claude/settings.json on startup and resolve "model": "opus[1m]" naturally — the same way the parent session does. This would give subagents 1M context without any changes to the alias resolution logic.

    When an explicit override IS specified (via Agent tool model parameter or agent frontmatter), the spawner should still pass --model but preserve the [1m] suffix through the resolution.

  4. dulvac commented on Apr 8, 2026

    @dulvac
    Author

    Additional findings — the [1m] suffix is actively stripped

    Further testing confirms the spawner explicitly removes the [1m] suffix regardless of how the model is specified. This is not an alias resolution issue — it's deliberate suffix stripping.

    Full test matrix

    Frontmatter model value Spawn --model flag Result
    (none — inherit from parent) claude-opus-4-6 Opus, no 1M
    opus[1m] claude-opus-4-6 Opus, no 1M
    default claude-opus-4-6 Opus, no 1M
    claude-opus-4-6[1m] (full ID) claude-opus-4-6 Opus, no 1M

    Key observation: spawner intercepts model values

    When model: default is set in agent frontmatter, the spawn command still shows --model claude-opus-4-6 (Opus). But running the CLI directly with --model default resolves to Sonnet (platform default). This proves the spawner resolves model values before constructing the CLI command — the literal string never reaches --model.

    Even when the full model ID claude-opus-4-6[1m] is specified in frontmatter, the spawner strips [1m] before passing it to --model. This points to explicit suffix-removal logic in the spawner, not a gap in alias resolution.

    Where the fix needs to happen

    The spawner's model resolution pipeline has a step that strips the [1m] context window suffix. This step needs to either:

    1. Preserve the suffix through to the --model flag
    2. Or omit --model entirely when no override is specified, letting the subprocess read settings.json
  5. oconnorjoseph commented on Apr 21, 2026

    @oconnorjoseph

    Seeing the identical stripping behavior on our team at BluMint — confirmed matches all three rows of your table. Parent runs claude-opus-4-7[1m], but spawned subagents (via Agent tool with model: "opus", via subagent frontmatter with model: claude-opus-4-7[1m], and with model: omitted entirely hoping for inheritance) all consistently resolve to the 200K variant.

    This actively blocks our multi-agent orchestration workflows — research subagents investigating hypotheses over large codebases cannot fit the full context and compact mid-task, losing reasoning chains we care about. Same root cause as #51254 and #36670 from what we can tell.

    Would very much appreciate preserving the [1m] suffix through model alias resolution in the subagent spawn path.

  6. added
    stale
    on May 13, 2026
  7. github-actions commented on May 28, 2026

    @github-actions

    Closing for now — inactive for too long. Please open a new issue if this is still relevant.

  8. github-actions commented on Jul 26, 2026

    @github-actions

    This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

  9. locked as resolved and limited conversation to collaborators on Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:agentsarea:corebughas reproplatform:macosstale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions