claude-code - 💡(How to fix) Fix Model switch to Opus not preserved after /compact — session restarts on previous model

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

After switching to Opus mid-session and running /compact, the new context window opened on Sonnet 4.6 instead of Opus. The model switch did not survive the compaction boundary.

Root Cause

After switching to Opus mid-session and running /compact, the new context window opened on Sonnet 4.6 instead of Opus. The model switch did not survive the compaction boundary.

RAW_BUFFERClick to expand / collapse

Summary

After switching to Opus mid-session and running /compact, the new context window opened on Sonnet 4.6 instead of Opus. The model switch did not survive the compaction boundary.

Steps to reproduce

  1. Start a Claude Code session (opens on Sonnet 4.6 by default)
  2. Switch to Opus model (via model selector / /model command)
  3. Run /compact to compress context
  4. Observe: new context window is back on Sonnet 4.6, not Opus

Expected behavior

The selected model should persist across /compact context boundaries. If I switched to Opus before compacting, the session should resume on Opus.

Actual behavior

Session restarts on Sonnet 4.6 after /compact, ignoring the prior model selection.

Environment

  • Session UID: 20260515T192400Z-master-1fe68a4b
  • Platform: Windows 11 Home (10.0.26200)
  • Claude Code version: current (as of 2026-05-15)
  • Model intended: claude-opus-4-7 (or latest Opus)
  • Model actually running after compact: claude-sonnet-4-6

Impact

Users lose their model selection silently on every compaction. In long agentic sessions where Opus is chosen specifically for its 1M context window and orchestration quality, this causes the coordinator to run on a lower-capability model without realizing it.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The selected model should persist across /compact context boundaries. If I switched to Opus before compacting, the session should resume on Opus.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING