Status line JSON reports wrong model after /model switch

Status Fixed / completed
Reported on v2.1.78
Maintainer reply ✓ Yes — ashwin-ant
Activity 4 comments · opened Mar 28, 2026 · closed Apr 18, 2026
💡 Likely answer: A maintainer (ashwin-ant, collaborator) responded on this thread — see the highlighted reply below.

Bug

After switching model via /model (e.g. selecting Opus 4.6), the status line JSON input still reports the previous model (Sonnet 4.6). The model.id and model.display_name fields in the JSON payload sent to the status line command do not reflect the currently selected model.

Steps to reproduce

  1. Start Claude Code (defaults to Sonnet 4.6)
  2. Run /model and select Opus 4.6
  3. Observe status line still shows Sonnet 4.6

Debug output

Dumped the raw JSON received by the status line command to a file. Result:

{
  "model": {
    "id": "claude-sonnet-4-6",
    "display_name": "Sonnet 4.6"
  }
}

The conversation itself confirms Opus 4.6 is active (system prompt says claude-opus-4-6), but the status line JSON still reports Sonnet.

Expected behavior

model.id and model.display_name in the status line JSON should reflect the model currently in use after a /model switch.

Environment

  • Claude Code version: 2.1.78
  • OS: macOS (Darwin 25.2.0)
  • Shell: zsh

View original on GitHub ↗

4 Comments

Astro-Han · 6 months ago

Fixed in v2.1.85. I verified on 3/27 that after /model switch, the stdin JSON correctly reports the new model.id and display_name. Updating from 2.1.78 should resolve it.

yurukusa · 6 months ago

A UserPromptSubmit hook can track model switches and provide the correct model to statusline:

INPUT=$(cat)
PROMPT=$(echo "$INPUT" | jq -r '.user_prompt // empty' 2>/dev/null)
if echo "$PROMPT" | grep -qiE '^/model'; then
    touch "$HOME/.claude/.model-switched"
fi
if [ -f "$HOME/.claude/.model-switched" ]; then
    echo "{\"switched_at\":\"$(date -Iseconds)\"}" > "$HOME/.claude/.current-model"
    rm -f "$HOME/.claude/.model-switched"
fi
exit 0
INPUT=$(cat)
MODEL=$(echo "$INPUT" | jq -r '.model.display_name // "unknown"' 2>/dev/null)
TRACKED="$HOME/.claude/.current-model"
if [ -f "$TRACKED" ]; then
    SWITCHED=$(jq -r '.switched_at' "$TRACKED" 2>/dev/null)
    echo "$MODEL (switched: $SWITCHED)"
else
    echo "$MODEL"
fi

Note: this is a partial workaround — the real fix needs the status line JSON to reflect the actual current model after /model switches.

ashwin-ant collaborator · 6 months ago

This was fixed in v2.1.86 — The status line JSON now reports the correct model immediately after switching with /model. If you're still seeing this in the latest version, please comment with your version and repro and we'll reopen.

github-actions[bot] · 5 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.