[Bug]: With switchModelsOnFlag off, Claude safeguard flags end the turn instead of pausing to ask about the fallback model#24043

opened22d agobyTtaham8875

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. In ~/.claude/settings.json, set "switchModelsOnFlag": false. Claude Code describes this setting as: "When safeguards flag a message, automatically switch to a different model to keep chatting. When off, your session will pause instead."
  2. In T3 Code, use the Claude provider with claude-opus-5-5.
  3. Send a message that the safeguards classifier flags (any [cyber] false positive works).

Expected behavior

The session pauses and asks what to do, like the Claude Code CLI and the Claude apps do: retry the message on the fallback model (Opus 4.8) or stop.

Actual behavior

The turn ends with the plain refusal error and no way to continue:

1API Error: Opus 5.5's safeguards flagged this session (https://www.anthropic.com/legal/aup). ...
2Claude Code can't respond to your last message with Opus 5.5.
3Try rephrasing the request in a new session or change your model.
4Details: [cyber]

Root cause: the CLI only pauses with a request_user_dialog of kind refusal_fallback_prompt when the SDK host declares that kind in supportedDialogKinds. Without it, the CLI falls back to the plain refusal error (SDK Options.supportedDialogKinds docs: "for 'refusal_fallback_prompt', the classic refusal error message ends the turn"). ClaudeAdapterV2 declares only ["resume_return"], so the pause the setting promises can never happen in T3.

The dialog payload already carries originalModel and fallbackModel, and the result is one of retry_fallback, edit_prompt or cancelled, so T3 doesn't have to guess the fallback model.

With the default switchModelsOnFlag: true, the CLI switches models silently and T3 shows the notice from #8853, so this only affects users who turned automatic switching off.

Impact

Blocks work completely

Version or commit

main @ d7a8d6f3, Claude Code 2.1.309, @anthropic-ai/claude-agent-sdk 0.3.276

Environment

Linux, Claude provider, claude-opus-5-5

Logs or stack traces

shell
1API Error: Opus 5.5's safeguards flagged this session (https://www.anthropic.com/legal/aup).
2Details: [cyber]

Workaround

Set switchModelsOnFlag back to true so the CLI switches models without asking, or switch the thread to Opus 4.8 by hand and resend.