Skip to content

Fix Cursor auto model Run routing#28

Open
chrythjin wants to merge 17 commits into
ephraimduncan:mainfrom
chrythjin:fix/cursor-auto-default-run-model
Open

Fix Cursor auto model Run routing#28
chrythjin wants to merge 17 commits into
ephraimduncan:mainfrom
chrythjin:fix/cursor-auto-default-run-model

Conversation

@chrythjin
Copy link
Copy Markdown

Summary

This fixes the OpenAI-compatible model: "auto" path so the proxy preserves Cursor's own Auto routing when building the AgentService/Run request.

Instead of resolving auto to the first discovered concrete Cursor model, the Run payload now sends:

  • requestedModel.modelId = "default"
  • modelDetails.modelId = "default"
  • modelDetails.displayModelId = "default"
  • modelDetails.displayName = "Auto"
  • modelDetails.displayNameShort = "Auto"

Explicit model requests, such as composer-2, are still forwarded unchanged through both requestedModel and modelDetails.

Why

The previous behavior collapsed OpenCode's auto request to the first discovered concrete model. That makes auto depend on discovery order and bypasses Cursor's native Auto model selection.

Cursor's CLI default model lookup is not the same thing as Auto routing: GetDefaultModelForCli returns a concrete CLI default, while the Run request's default model id lets Cursor perform its own routing decision server-side.

Changes

  • Removed the proxy-side auto -> first discovered model resolver.
  • Added requestedModel to the AgentRunRequest payload.
  • Encoded OpenAI model: "auto" as Cursor Run model id default with display name Auto.
  • Extended the smoke backend observer to assert both modelDetails and requestedModel ids.
  • Kept explicit model forwarding covered by the same smoke test.

Verification

  • bun install --frozen-lockfile
  • bun run build
  • bun test/smoke.ts

The smoke test now fails if auto is accidentally collapsed back to a discovered concrete model instead of being sent as Cursor's default Run model.

chrythjin and others added 17 commits April 25, 2026 20:15
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
- Add CURSOR_AUTO_MODEL constant and mergeAutoModel() in src/index.ts
  to ensure 'auto' is always registered in provider.models, deduplicated
- Add CURSOR_AUTO_PROXY_MODEL constant and mergeAutoProxyModel() in src/proxy.ts
  to keep auto in proxy /v1/models without duplication
- Update smoke tests: existence + single-occurrence assertions for auto
  across provider registration, refresh-before-discovery, and discovery fallback paths
- Smoke tests and TypeScript build pass
Previously, when modelId was 'auto', the proxy omitted modelDetails
from the Cursor RunRequest, causing 'Model details are required' errors
via the private ConnectRPC path.

This change adds resolveCursorRunModelId() which resolves 'auto' to
the first discovered non-auto Cursor model before building ModelDetails.
Explicit model IDs continue to pass through unchanged.

The fix preserves cursor/auto as the user-facing model while ensuring
the Cursor backend receives a valid explicit model ID.

PR ephraimduncan#2 (closed): explored cursor/auto model support
closes ephraimduncan#2
Capture recent Cursor auto-routing investigation notes and related memory for future reference.

Made-with: Cursor
Drop local Serena memory and temporary session notes that were unintentionally included in the upstream pull request.

Made-with: Cursor
Keep PR focused on cursor/auto runtime and smoke-test changes by dropping local docs/session artifacts and Serena project config files.

Made-with: Cursor
Encode OpenAI model auto as Cursor's default Run model instead of collapsing it to the first discovered concrete model.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
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.

1 participant