[BUG] team config.json records wrong model for one subagent_type

Resolved 💬 1 comment Opened May 8, 2026 by JohnDigitalCarpenters Closed Jun 5, 2026

Preflight Checklist

  • [x] I have searched existing issues
  • [x] This is a single bug report
  • [x] 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_type | frontmatter model | recorded in team config.json | runtime self-report |
|---|---|---|---|
| TDD Guide | opus[1m] | sonnet ❌ | claude-opus-4-7[1m] ✓ |
| Code Reviewer | opus[1m] | opus[1m] ✓ | claude-opus-4-7[1m] ✓ |
| Plan Explorer | opus[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.

  1. Edit ~/.claude/agents/tdd-guide.md so frontmatter says model: opus[1m]

(already the default in the toolkit shipped with Claude Code).

  1. 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).

  1. cat ~/.claude/teams/t/config.json | jq '.members[] | {name, model}'

x → "sonnet"

  1. SendMessage to x asking what runtime model — replies claude-opus-4-7[1m]
  2. 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

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗