claude-code - 💡(How to fix) Fix opusplan plan mode skips Max-plan 1M auto-upgrade [2 comments, 2 participants]

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…
GitHub stats
anthropics/claude-code#49623Fetched 2026-04-17 08:35:56
View on GitHub
Comments
2
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×3commented ×2

The docs at https://code.claude.com/docs/en/model-config state: "On Max, Team, and Enterprise plans, Opus is automatically upgraded to 1M context with no additional configuration." This upgrade does not apply to opusplan plan mode.

Root Cause

Result: SD() === true (first-party Max user), but plan mode still resolves to 200K because om() returns bh() without passing through the auto-upgrade wrapper.

Fix Action

Workaround

Set ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-4-7[1m]" in ~/.claude/settings.json:

"env": {
  "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4-7[1m]"
}

bh() returns the env var verbatim; om() in plan mode then yields claude-opus-4-7[1m]. The subagent auto-upgrade wrapper no-ops (because pJ("...[1m]") is true), so no double [1m] occurs.

Trade-off: this loses auto-latest — the env var must be manually bumped when a new Opus version ships.

Code Example

if (ub() === "opusplan" && _ === "plan" && !K) return bh()

---

if (SD() && !pJ(H) && /opus-4-[67]/.test(H)) return H + "[1m]"

---

"env": {
  "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4-7[1m]"
}
RAW_BUFFERClick to expand / collapse

opusplan plan mode skips Max-plan 1M auto-upgrade

Version: claude 2.1.112 (also observed on 2.1.111)

Summary

The docs at https://code.claude.com/docs/en/model-config state: "On Max, Team, and Enterprise plans, Opus is automatically upgraded to 1M context with no additional configuration." This upgrade does not apply to opusplan plan mode.

Reproduction

  1. First-party Anthropic API user on a Max plan
  2. ~/.claude/settings.json has "model": "opusplan" and no ANTHROPIC_DEFAULT_OPUS_MODEL set
  3. Open a new Claude Code session and enter plan mode (Shift+Tab)
  4. Observed: the resolved model is claude-opus-4-7 (200K context)
  5. Expected: the resolved model is claude-opus-4-7[1m] (1M context)

Observable signals: the startup header suffix (1M context) is absent; /status shows claude-opus-4-7 without [1m].

Note: the "Welcome to Opus 4.7 xhigh!" welcome banner is a hardcoded string and is not a reliable signal — it does not reflect whether [1m] is active.

Code trace (2.1.112)

The opusplan router is om({permissionMode, mainLoopModel, exceeds200kTokens}). The plan-mode branch (verbatim from the binary):

if (ub() === "opusplan" && _ === "plan" && !K) return bh()

bh() is the opus model resolver. It returns ANTHROPIC_DEFAULT_OPUS_MODEL if set; otherwise returns the built-in claude-opus-4-7 constant. No [1m] is appended on either path.

The Max auto-upgrade function has the body pattern:

if (SD() && !pJ(H) && /opus-4-[67]/.test(H)) return H + "[1m]"

(SD() checks first-party Max eligibility; pJ(H) checks whether [1m] is already present.)

Grepping for call sites of this function in the 2.1.112 binary finds exactly 2 call sites, both on the subagent-resolution path. om() never calls it.

The main-loop default getter (dG()) does route through the Max auto-upgrade, but opusplan plan mode does not use dG() — it uses om() directly.

Result: SD() === true (first-party Max user), but plan mode still resolves to 200K because om() returns bh() without passing through the auto-upgrade wrapper.

Expected behavior

om() must wrap its opus return through the Max auto-upgrade function, consistent with how the /model opus, /model opus[1m], and subagent paths handle it.

Workaround

Set ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-4-7[1m]" in ~/.claude/settings.json:

"env": {
  "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4-7[1m]"
}

bh() returns the env var verbatim; om() in plan mode then yields claude-opus-4-7[1m]. The subagent auto-upgrade wrapper no-ops (because pJ("...[1m]") is true), so no double [1m] occurs.

Trade-off: this loses auto-latest — the env var must be manually bumped when a new Opus version ships.

extent analysis

TL;DR

To fix the issue where opusplan plan mode skips the Max-plan 1M auto-upgrade, modify the om() function to wrap its opus return through the Max auto-upgrade function.

Guidance

  • The issue arises because om() returns bh() without passing through the auto-upgrade wrapper, resulting in the resolved model being claude-opus-4-7 (200K context) instead of claude-opus-4-7[1m] (1M context).
  • To verify the issue, check the startup header suffix and the /status output to confirm that the resolved model is not using the 1M context.
  • A temporary workaround is to set ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-4-7[1m]" in ~/.claude/settings.json, which will force the use of the 1M context model.
  • Note that this workaround loses auto-latest, requiring manual updates to the env var when new Opus versions are released.

Example

"env": {
  "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4-7[1m]"
}

This sets the ANTHROPIC_DEFAULT_OPUS_MODEL env var to use the 1M context model.

Notes

The provided workaround is a temporary solution and may not be ideal for long-term use due to the loss of auto-latest functionality.

Recommendation

Apply the workaround by setting ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-4-7[1m]" in ~/.claude/settings.json, as it provides a functional solution to the issue, albeit with some trade-offs.

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

om() must wrap its opus return through the Max auto-upgrade function, consistent with how the /model opus, /model opus[1m], and subagent paths handle it.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix opusplan plan mode skips Max-plan 1M auto-upgrade [2 comments, 2 participants]