claude-sonnet-5 added to model compatibility list#
What's wrong with this entry?
The identifier "claude-sonnet-5" was appended to the hardcoded model-name list inside function ALn (within the tw lazy-init block, line ~162348–162370). ALn is the sole gatekeeper for whether the mid-conversation-system-2026-04-07 API beta header (BX) is included in outgoing requests. When ALn returns true the header is pushed onto the beta-header array and sent to the API; when it returns false the header is omitted. The function evaluates candidates in strict priority order: (1) HIPAA mode (hipaa runtime flag) → unconditionally false; (2) the CLAUDE_CODE_FORCE_MID_CONVERSATION_SYSTEM environment variable → forces true when set; (3) a per-model capability override read from ANTHROPIC_CUSTOM_MODEL_OPTION environment variables → returns that value if present; (4) the hardcoded model-name list — now including claude-sonnet-5 alongside claude-3-, claude-opus-4-0 through claude-opus-4-7, claude-sonnet-4-0, claude-sonnet-4-5, claude-sonnet-4-6, and claude-haiku-4-5 — → returns false; (5) model registry capability check (OF(n, "mid_conv_system")) or the special case claude-mythos-5 → returns true; (6) provider-based fallback. Because claude-sonnet-5 carries mid_conv_system in its capabilities array in the model registry (line ~113995), path (5) would have returned true and activated the beta header absent the explicit suppression; adding claude-sonnet-5 to the hardcoded list at step (4) overrides that.
Users who configure Claude Code with claude-sonnet-5 will no longer have the mid-conversation-system-2026-04-07 beta header sent with their API requests. In concrete terms, mid-conversation system-prompt updates — such as reminder injections from hooks or context-management refreshes — are delivered as <system-reminder> text embedded inside user messages rather than as native role: "system" API turns. This also eliminates a failure path that would otherwise fire: when the server rejects the beta header with an HTTP 400 containing the header name alongside "anthropic-beta", the phrase "Unexpected role" in an input message, or a "not supported … role … system" pattern, the code (zWn, line ~354273) detects the rejection, strips BX from the active header list, sticky-rejects it for the remainder of the session (until the user runs /clear or /compact), logs a [mid-conv-system] server rejected role:"system" warning, fires the tengu_mid_conv_system_fallback_retry telemetry event, and retries with the <system-reminder> format. By suppressing the header up-front, Claude Code avoids that entire error-detect-strip-retry cycle for claude-sonnet-5 users.
ALn function in the tw lazy-init block (lines ~162348–162370); BX beta-header constant definition (line ~122337, "mid-conversation-system-2026-04-07"); mid-conv-system rejection handler (lines ~593496–593508); rejection detector zWn (lines ~354273–354280); claude-sonnet-5 model capability definition showing mid_conv_system (lines ~113969–113999)
Strings lifted out of the shipped bundle, so the claim above can be checked against them.