claude-code - 💡(How to fix) Fix [BUG] team config.json records wrong model for one subagent_type

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Under CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1, when a team is created via TeamCreate and populated with subagents via the Agent tool, the harness records an inconsistent model field in ~/.claude/teams/<team>/config.json:.members[] for at least one specific built-in subagent_type, while sibling agents with structurally identical frontmatter are recorded correctly. The agent's actual runtime model (per SendMessage self-report) is correct — only the persisted recording is wrong. This appears to be a regression-of-pattern from #7347 on a new surface (agent-teams), since the same class of bug was reported and closed for the /agents slash command.

Error Message

The 4 sonnet-intended agents on the same team (build-error-resolver,

Root Cause

Hence: runtime is right; persisted record is wrong; subagent_types that have never been "polluted" by an explicit --model X invocation read correctly because the cache is empty for them.

Code Example

parent-session-id <UUID> --agent-type 'TDD Guide' --dangerously-skip-permissions --model sonnet
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues
  • This is a single bug report
  • I am using the latest version of Claude Code

Summary

Under CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1, when a team is created via TeamCreate and populated with subagents via the Agent tool, the harness records an inconsistent model field in ~/.claude/teams/<team>/config.json:.members[] for at least one specific built-in subagent_type, while sibling agents with structurally identical frontmatter are recorded correctly. The agent's actual runtime model (per SendMessage self-report) is correct — only the persisted recording is wrong. This appears to be a regression-of-pattern from #7347 on a new surface (agent-teams), since the same class of bug was reported and closed for the /agents slash command.

Observed in this session

Three agents with identical frontmatter shape (model: opus[1m]):

subagent_typefrontmatter modelrecorded in team config.jsonruntime self-report
TDD Guideopus[1m]sonnetclaude-opus-4-7[1m]
Code Revieweropus[1m]opus[1m]claude-opus-4-7[1m]
Plan Exploreropus[1m]opus[1m]claude-opus-4-7[1m]

The 4 sonnet-intended agents on the same team (build-error-resolver, qa-verifier, doc-updater, e2e-runner) were recorded and self-reported as claude-sonnet-4-5 consistently — so the bug is specific to one subagent_type whose frontmatter declares opus[1m].

Repro (minimum)

  1. export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1
  2. From a previous session at any point, spawn TDD Guide once with explicit --model sonnet (e.g. via the CLI or via a paste-cache invocation). This may seed a per-subagent_type registration somewhere in Claude Code state.
  3. Edit ~/.claude/agents/tdd-guide.md so frontmatter says model: opus[1m] (already the default in the toolkit shipped with Claude Code).
  4. In a fresh session: TeamCreate({team_name: "t"}), then Agent({subagent_type: "TDD Guide", team_name: "t", name: "x"}). Do NOT pass model (the Agent tool's enum rejects opus[1m] anyway — see #31027 / #51060).
  5. cat ~/.claude/teams/t/config.json | jq '.members[] | {name, model}' → x → "sonnet"
  6. SendMessage to x asking what runtime model — replies claude-opus-4-7[1m]
  7. Repeat with subagent_type: "Code Reviewer" (also model: opus[1m] in frontmatter) — recorded correctly as opus[1m].

Smoking gun

A trace exists at ~/.claude/paste-cache/<hash>.txt containing:

parent-session-id <UUID> --agent-type 'TDD Guide' --dangerously-skip-permissions --model sonnet

This appears to be how the per-subagent_type stale registration was seeded. After this command ran historically, every subsequent spawn of TDD Guide in any team writes model: "sonnet" to the team config — even though the runtime correctly resolves to opus[1m] from the .md frontmatter.

Hypothesis

The team-config writer (the code path that builds .members[].model) and the runtime model resolver read from different sources:

  • Runtime resolver: reads ~/.claude/agents/<name>.md frontmatter at session start. Honors opus[1m]. Correct.
  • Team-config writer: reads from a cached per-subagent_type registration (likely the same source the /agents command read from before #7347's fix), not from the .md frontmatter.

Hence: runtime is right; persisted record is wrong; subagent_types that have never been "polluted" by an explicit --model X invocation read correctly because the cache is empty for them.

Expected

team config.json:.members[].model matches runtime self-report (which matches .md frontmatter).

Actual

For the polluted subagent_type (TDD Guide), the field disagrees with both — recorded as sonnet, runtime is opus[1m].

Impact

  • Cosmetic display bug in any UI / introspection tool that reads from team config.json (similar to the /agents command bug fixed in #7347).
  • Misleading for orchestrator agents that need to make routing decisions based on which teammates are running which model.
  • No runtime impact in this session — but suggests the team-config writer's source-of-truth is a stale cache that may produce wrong results in other contexts as Claude Code grows.

Related

  • #7347 — /agents displays wrong model (CLOSED 2026-01-08). Same symptom shape on different surface; this is effectively a regression-of-pattern.
  • #5206 — duplicate of #7347 (CLOSED).
  • #51060 — model: opus[1m] 1M context flag rejection at API layer (OPEN).
  • #31027 — Agent tool model enum locked to short aliases (OPEN).
  • #43869 — subagent model routing more severely broken at runtime (OPEN).
  • #47488 — Agent tool model parameter silently ignored (OPEN).
  • #18346 — Claude Code does not respect agent model definition (OPEN).

Suggested fix direction

Audit the team-config writer's source for .members[].model. Either:

  1. Read frontmatter directly (single source of truth); or
  2. Invalidate the per-subagent_type cache on .md frontmatter edits; or
  3. At minimum, surface the same fix that closed #7347 onto this surface.

Environment

  • Claude Code: 2.1.133
  • OS: macOS Darwin 25.3.0 arm64 (M-series)
  • Node: 25.2.1
  • Setting: CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 in ~/.claude/settings.json

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING