Skip to content

fix(server): Cursor long-context tiers turn on Max Mode - #171

Merged
adampeterhiggins merged 1 commit into
mainfrom
fix/cursor-long-context-max-mode
Oct 6, 2026
Merged

adampeterhiggins merged 1 commit into
mainfrom
fix/cursor-long-context-max-mode

Conversation

@adampeterhiggins

@adampeterhiggins adampeterhiggins commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

Problem

Choosing Grok 4.7 at 500K on Cursor fails every turn with AI Model Not Found Invalid parameters for registry model: "grok-4.7", and the thread shows only "Provider turn failed." @cursor/sdk (1.0.31) never sets RequestedModel.maxMode (proto field 2), and Cursor serves context tiers above its standard window only in Max Mode. The 1M tiers on other models don't fail, but they silently run at about 300K.

This isn't a regression from the ACP → SDK switch. The old ACP CLI only offered Grok 4.7 at 256K and had no context setting, so the old adapter dropped the 500K choice without saying so.

Fix

This ports upstream pingdotgg/t3code#15884 (still open, fixes pingdotgg#15788) unchanged, so a future upstream sync merges cleanly. cursorSdk.ts hooks proto3.util.initPartial in the SDK's own disk-backed @bufbuild/protobuf before the SDK loads. It sets maxMode only on agent.v1.RequestedModel messages whose context parameter is above 300K. Every other message, standard tiers, and requests that already set Max Mode are left alone. Turns, resumes and text generation all go through this loader.

I checked it independently rather than relying on the upstream PR:

  • Threshold: I pulled the live Cursor.models.list() catalog. Every model with a context option has a standard tier ≤ 300K (200K, 256K, 272K, 300K) and a long tier above it (500K or 1M), so the cutoff fits today's catalog. The SDK drops Cursor's per-variant is_max_mode flag, so this can't be read from the catalog.
  • Packaging: the SDK loads @bufbuild/protobuf as an external module, and scripts/lib/cli-external-packages.ts already ships it beside the SDK, so packaged builds share the same runtime.

Cost: Max Mode is billed per token on usage-based plans, the same as picking the long tier in Cursor's own apps. It only applies when a long tier is actually sent. Options left at their default aren't sent at all today (upstream #16149), so an untouched composer still runs at the standard window. This PR doesn't change that.

docs/fork-differences.md gets a section to remove once upstream merges pingdotgg#15884.

Verification

  • vp test run apps/server/src/provider/cursorSdk.test.ts: 27 passed. The two new tests run the real SDK send path and the generated protobuf request, and both fail with the hook removed.
  • vp test run scripts/lib/cursor-sdk-packaging.test.ts: passed.
  • vp lint and vp fmt --check on the changed files: clean. tsc --noEmit for apps/server: 0 errors.
  • Live, real Cursor account, @cursor/sdk 1.0.31, macOS, prompt Reply with exactly: pong:
Grok 4.7, High, Fast Unpatched SDK Through cursorSdk.ts
context=500k Invalid parameters for registry model: "grok-4.7" pong
context=256k pong pong

Not exercised: a full T3 Code turn through the UI, or Linux/Windows.

Model: Claude Opus 5.5 (1M context). Harness: Claude Code.

🤖 Generated with Claude Code

Cursor's SDK never sets RequestedModel.maxMode, so Grok 4.7 at 500K is
rejected with "Invalid parameters for registry model" and 1M tiers
silently run at ~300K. Hook the SDK's own protobuf runtime to set Max
Mode on requests whose context tier is above 300K, as Cursor's CLI does.

Ported from upstream PR pingdotgg#15884 (fixes pingdotgg#15788).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@adampeterhiggins
adampeterhiggins force-pushed the fix/cursor-long-context-max-mode branch from a9f80dd to fa3f1cc Compare October 6, 2026 09:20
@adampeterhiggins
adampeterhiggins merged commit abc9968 into main Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Cursor 1M and 500K context tiers are ignored or rejected because the SDK request never sets Max Mode

1 participant