Subagents ignore `switchModelsOnFlag: false`: after a safety refusal, an Agent-tool subagent silently continues on claude-opus-4-8

Status Open
Reported on v2.1.281
Maintainer reply None cached
Activity 0 comments · opened Sep 30, 2026

Environment

  • Claude Code inside Claude Desktop (macOS), bundled 2.1.281 and 2.1.284; the same logic is present in the CLI 2.1.285.
  • ~/.claude/settings.json has "switchModelsOnFlag": false, no availableModels, no model env vars.
  • Subagents started with the Agent tool (subagent_type: "general-purpose", model: "opus"); main conversation on claude-opus-5-5.

What happened (metadata from the subagent transcripts only)

  • Twice: a subagent's turn ended with stop_reason: "refusal" two turns in a row on claude-opus-5-5. The transcript then recorded a thinking_drop attachment with model: "claude-opus-4-8", and the subagent continued on claude-opus-4-8 for several answers, including a Write tool call.
  • Once, on 2.1.281 before the setting was changed: after a refusal in the cyber category, a subagent's answer switched from claude-opus-5-5 to claude-opus-4-8 partway through a single message, and its next 20 answers were on 4.8. Nothing in the transcript marks the switch except the model field on each answer.
  • No dialog or notice appeared, and the parent agent was not told.

Expected
The docs (model-config, "Ask before switching"; settings reference, switchModelsOnFlag) say that with false, a flagged request pauses for a choice, or ends with the refusal where no dialog can show. A subagent can't show a dialog, so we expected its turn to end with the refusal and the parent to be told, or at least "a notice in the transcript".

Actual
The subagent switched to claude-opus-4-8 on its own and carried on, including writing files, with no notice.

Likely cause (from the shipped 2.1.285 bundle)

  • The function that decides whether to skip the switch dialog (Oan in 2.1.285) returns "subagent" for any non-main-thread query before it reads switchModelsOnFlag: if(!e.isMainThread)return"subagent"; comes before if(Do("switchModelsOnFlag",!0).value)return"setting";.
  • The arming check only suppresses the fallback when isMainThread is true.
  • So the setting can never apply to subagents. The continuation prompt also tells the fallback model not to mention the interruption, which is why the switch is silent.

Requests

  1. Honour switchModelsOnFlag: false in subagents and workflow agents: end the subagent's turn with the refusal, as for -p, and tell the parent.
  2. Until then, document the subagent behaviour on the model-config and settings-reference pages.
  3. Always write a visible marker in the subagent's transcript, and notify the parent, when a subagent changes model.
  4. Say whether CLAUDE_CODE_NO_MODEL_FALLBACK and CLAUDE_CODE_DISABLE_REFUSAL_FALLBACK are supported (see #83043).

Related: #91923, #83043, #82319, #96322.

View original on GitHub ↗