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.jsonhas"switchModelsOnFlag": false, noavailableModels, no model env vars.- Subagents started with the Agent tool (
subagent_type: "general-purpose",model: "opus"); main conversation onclaude-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 onclaude-opus-5-5. The transcript then recorded athinking_dropattachment withmodel: "claude-opus-4-8", and the subagent continued onclaude-opus-4-8for several answers, including a Write tool call. - Once, on 2.1.281 before the setting was changed: after a refusal in the
cybercategory, a subagent's answer switched fromclaude-opus-5-5toclaude-opus-4-8partway 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 (
Oanin 2.1.285) returns"subagent"for any non-main-thread query before it readsswitchModelsOnFlag:if(!e.isMainThread)return"subagent";comes beforeif(Do("switchModelsOnFlag",!0).value)return"setting";. - The arming check only suppresses the fallback when
isMainThreadis 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
- Honour
switchModelsOnFlag: falsein subagents and workflow agents: end the subagent's turn with the refusal, as for-p, and tell the parent. - Until then, document the subagent behaviour on the model-config and settings-reference pages.
- Always write a visible marker in the subagent's transcript, and notify the parent, when a subagent changes model.
- Say whether
CLAUDE_CODE_NO_MODEL_FALLBACKandCLAUDE_CODE_DISABLE_REFUSAL_FALLBACKare supported (see #83043).
Related: #91923, #83043, #82319, #96322.