Skip to content

Agents panel shows the parent session's model/effort for every subagent instead of the subagent's own #7281

Description

@lnieuwenhuis

Summary

Every row in the Agents panel displays the parent session's model and effort rather than what the subagent actually ran on. With a session on opus-5 · xhigh, eight subagents spanning four different models all rendered as opus-5 · xhigh.

The token counts and titles on those rows are correct — only model/effort are wrong — so it reads as authoritative rather than as a placeholder. That's what makes it costly: it silently misreports model routing, and anyone reasoning from the panel will draw wrong conclusions about which model handled what.

Reproduction

Requires custom subagents that declare model:/effort: in frontmatter (~/.claude/agents/*.md).

  1. Run a session on a model/effort distinct from your agents' — here opus-5 at xhigh.
  2. Spawn agent types whose definitions pin different models, e.g. model: haiku / effort: low, model: sonnet / effort: medium, model: fable / effort: high.
  3. Open the Agents panel.

Expected — each row shows that agent's own model/effort.
Actual — every row shows opus-5 · xhigh.

Evidence

Eight probes, each Reply with the single word ACK. "Panel" is what the sidebar rendered; "actual" is from the SDK's own run records at ~/.claude/projects/<project>/<session>/subagents/agent-*.jsonl, where message.model on each assistant record is the API's report of which model served the request:

agent type agent definition panel showed actually ran
lookup-fast haiku / low opus-5 · xhigh claude-haiku-4-5-20251001, no effort
implement-fast opus / low opus-5 · xhigh claude-opus-5 / low
general sonnet / medium opus-5 · xhigh claude-sonnet-5 / medium
review-standard sonnet / high opus-5 · xhigh claude-sonnet-5 / high
deep-reasoning opus / high opus-5 · xhigh claude-opus-5 / high
critical-review opus / xhigh opus-5 · xhigh claude-opus-5 / xhigh
long-horizon fable / high opus-5 · xhigh claude-fable-5 / high
inherit (inherits parent) opus-5 · xhigh claude-opus-5 / xhigh

The two correct rows are the two that coincidentally match the session — critical-review happens to share it, and inherit is supposed to.

Same eight agents in both columns: panel token counts match the records exactly (8.8k↔8895, 16.7k↔16684, 22.2k↔22151, 12.0k↔11960, 16.5k↔16537, 7.7k↔7707, 16.7k↔16729, 16.4k↔16421). Two independent signals confirm different models really ran: the haiku probe emitted out=73 tokens where every Opus/Sonnet probe emitted out=5, and it carries no effort field at all — Haiku 4.5 doesn't take reasoning effort, yet the panel labels it xhigh.

Cause

apps/server/src/provider/Layers/ClaudeAdapter.ts:3194-3202 seeds both fields at launch:

const model =
  trimmedString(launchInput?.model) ?? trimmedString(context.session.model ?? undefined);
const rawLaunchEffort = launchInput?.effort;
const effort =
  trimmedString(rawLaunchEffort) ??
  (typeof rawLaunchEffort === "number" && Number.isFinite(rawLaunchEffort)
    ? String(rawLaunchEffort)
    : context.currentEffort);

The comment above it — "absent ones inherit the session's selection (SDK behavior)" — holds only for agent types that genuinely inherit (general-purpose, claude, inherit). For a file-defined agent, the SDK resolves model and effort from the agent's own frontmatter and pushes an effort layer for that subagent; the Agent tool input carries no override, so this fallback attributes the session's values to an agent that never used them. The adapter can't see the agent definition, so the launch-time seed is unavoidably a guess — the issue is that the guess is presented as fact.

Effort is never corrected. The model has a refinement path at ClaudeAdapter.ts:2876-2883, which overwrites owningAgent.model from the authoritative message.model on subagent assistant snapshots, and taskLinkageFor (:1034-1035) propagates both onward. There is no equivalent for effort anywhere — context.currentEffort is the only source it ever has.

For model, the refinement path exists but did not land for these direct spawns (all eight kept the seeded value). I haven't diagnosed why; the agentIdForParentToolUse(…, assistantParentToolUseId) lookup at :2878 seems the place to look, and these probes were short-lived (1–2s), so a snapshot ordering or matching issue is plausible. Flagging it as observed rather than asserting the mechanism.

Suggested direction

  • Give effort the same snapshot-refinement treatment model has, or read both from the subagent run records, which are authoritative.
  • Render unknown-until-refined as absent rather than falling back to session values — a blank is honest, a wrong model is not.
  • Don't synthesize an effort for models that don't support one: the lookup-fast record has no effort field, and xhigh on Haiku 4.5 is not a value that can exist.
  • Worth a regression test that a subagent whose definition pins a model differing from the session renders the pinned one.

Environment

t3code on macOS 26 (Darwin 27.0.0) · Claude Code 2.1.233 · session claude-opus-5 at xhigh

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions