Skip to content

fix(cursor): send composer fast mode as model metadata, not a model id - #411

Open
r-uben wants to merge 3 commits into
pleaseai:mainfrom
r-uben:fix/cursor-composer-fast-404
Open

fix(cursor): send composer fast mode as model metadata, not a model id#411
r-uben wants to merge 3 commits into
pleaseai:mainfrom
r-uben:fix/cursor-composer-fast-404

Conversation

@r-uben

@r-uben r-uben commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Summary

cursor-agent models advertises composer-2.5-fast, but shunt returned Connect error 502 (not_found) for cursor:composer-2.5-fast while cursor:composer-2.5 worked. shunt was passing the picker name straight through as the wire model id.

Capturing what the official cursor-agent CLI sends for --model composer-2.5-fast shows it transmits the base name composer-2.5 together with fast=true model metadata — in both the selected model (field 9) and the catalog entry (field 14). fast is a model parameter, not part of the id. The CLI hints at this itself: it documents parameterized overrides such as --model 'claude-opus-4-8[context=1m,effort=high,fast=false]'.

This resolves composer-2.5-fast and the parameterized composer-2.5[fast=true] / [fast=false] forms to the composer-2.5 wire id plus a fast flag, and carries that flag to both encode_model_meta call sites. Legacy bare names keep their existing mode mapping.

Verification

Against the live upstream, isolated gateway on its own port:

model before after
cursor:composer-2.5 200 200
cursor:composer-2.5-fast 502 not_found 200
cursor:composer-2.5[fast=true] 502 not_found 200

A unit test asserts the metadata is encoded in both the selected-model and catalog positions, and pins fast=false as well as fast=true so a constant-true regression cannot pass.

Milestone / spec

None — a wire-encoding bug in the agent.v1 Cursor path.

Checklist

  • cargo build passes
  • cargo test passes (1693 passed, 0 failed; run independently of the author)
  • cargo clippy --all-targets --all-features -- -D warnings clean
  • cargo fmt --all --check clean
  • Source files stay under 500 lines (model.rs is 260 lines; agent.rs was already oversized before this change, tracked by Split oversized Cursor adapter files (>500 lines) into focused modules #59)
  • English only; matches surrounding style
  • Frozen spec in docs/ updated if this change deviates from it (n/a)
  • User-facing docs updated — site/src/content/docs/providers/cursor.mdx plus README.md and its ja / ko / zh-CN translations
  • Any new GitHub Action is pinned to a full commit SHA (n/a)

Notes for reviewers

  • Scope is deliberately narrow. Only the three exact alias strings above are recognized. A general parameter parser ([context=1m,effort=high,fast=false]) was not attempted, because only the fast encoding was confirmed by capture.
  • Other model families are unverified. Cursor's catalog lists many -fast variants (cursor-grok-4.6-high-fast, claude-opus-5-thinking-high-fast, …). These are not covered here. On the test account cursor-grok-4.6-high fails with not_found at the base id too, so whether -fast handling generalizes to them could not be evaluated — it may need a different id namespace or an entitlement this account lacks.
  • The legacy bare-name mode mappings (composer-2.5 → PLAN, composer-2.5-fast → ASK) are pre-existing compatibility behavior and intentionally unchanged.

Summary by cubic

Fixes Cursor Composer fast mode routing by sending the base model id with a fast flag instead of a separate wire id. Previously cursor:composer-2.5-fast returned 502 not_found; now we send composer-2.5 with fast=true in both the selected model and catalog entries, matching the official CLI.

Bug Fixes

  • Resolve composer-2.5-fast and composer-2.5[fast=true|false] to composer-2.5 plus a fast flag.
  • Thread fast through AgentRunParams to metadata encoding at fields 9 and 14; default is fast=false.
  • Keep legacy bare-name mode mappings unchanged; docs and READMEs now document the alias behavior.

Migration

  • If you construct AgentRunParams, add the new fast: bool field (set false unless you need fast mode).

Written for commit 1864a4b. Summary will update on new commits.

`cursor-agent models` advertises `composer-2.5-fast`, but the AgentService
answered `not_found` for it: shunt passed the picker name through as the wire
model id. Capturing what the official CLI sends for `--model composer-2.5-fast`
shows it transmits the base name `composer-2.5` with `fast=true` model
metadata, in both the selected model (field 9) and the catalog entry (field 14)
-- `fast` is a model parameter, not part of the id.

Resolve `composer-2.5-fast` and the parameterized `composer-2.5[fast=true]` /
`[fast=false]` forms to the `composer-2.5` wire id plus a `fast` flag, and
carry that flag through to both `encode_model_meta` call sites. The legacy bare
names keep their existing mode mapping.

Verified against the live upstream: before, `cursor:composer-2.5` -> 200 and
`cursor:composer-2.5-fast` -> 502 not_found; after, the base, `-fast`, and
`[fast=true]` forms all return 200.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for Cursor's parameterized composer-2.5-fast model alias and its explicit [fast=true/false] variants. The model resolution logic in src/adapters/cursor/model.rs has been updated to map these aliases to the base composer-2.5 wire ID while extracting a new fast boolean flag. This flag is propagated through AgentRunParams and encoded into the request frames. Comprehensive unit tests, benchmarks, and multi-language documentation have been updated accordingly. No review comments were provided, and the implementation is clean, well-tested, and adheres to the project's standards; therefore, I have no additional feedback to provide.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f2fa9ae593

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +63 to +65
Cursor's `composer-2.5-fast` picker entry is a parameterized alias rather than a wire id. Route
`cursor:composer-2.5-fast` (or `cursor:composer-2.5[fast=true]`) and shunt sends the
`composer-2.5` wire id with `fast=true` model metadata, matching the official CLI.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add the localized Cursor provider pages

This user-facing model behavior is added only to the English site page. A repo-wide search of site/src/content/docs/{ko,ja,zh-cn} finds no corresponding providers/cursor.mdx files, so the maintained site translations do not receive the new alias and metadata instructions. Add the Korean, Japanese, and Simplified Chinese copies alongside this change.

AGENTS.md reference: AGENTS.md:L57-L64

Useful? React with 👍 / 👎.

@greptile-apps

greptile-apps Bot commented Aug 20, 2026

Copy link
Copy Markdown

Greptile Summary

The PR normalizes the supported Cursor Composer fast aliases to the composer-2.5 wire ID and carries the requested fast-mode flag in both model metadata positions.

  • Adds exact resolution for composer-2.5-fast and the documented [fast=true|false] forms.
  • Propagates fast mode through request construction while preserving existing agent-mode mappings.
  • Adds wire-encoding tests and updates provider documentation and translated READMEs.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains.

No blocking failure remains.

Important Files Changed

Filename Overview
src/adapters/cursor/model.rs Adds exact Composer alias normalization and a fast-mode value while preserving the existing mode selection behavior.
src/adapters/cursor/agent.rs Propagates fast mode consistently to selected-model and catalog metadata and tests both boolean values.
src/adapters/cursor/mod.rs Connects the resolved fast-mode value to production request construction.
site/src/content/docs/providers/cursor.mdx Documents the Composer fast alias and its base-ID-plus-metadata wire representation.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    Input[Cursor model selection] --> Resolve{Recognized Composer fast alias?}
    Resolve -->|Yes| Base[Wire ID: composer-2.5]
    Resolve -->|No| Original[Keep original wire ID]
    Base --> Metadata[Encode fast metadata]
    Original --> Default[Encode fast=false metadata]
    Metadata --> Selected[Selected model field 9]
    Metadata --> Catalog[Catalog entry field 14]
    Default --> Selected
    Default --> Catalog
Loading

Reviews (2): Last reviewed commit: "Merge branch 'main' into fix/cursor-comp..." | Re-trigger Greptile

@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.46154% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/adapters/cursor/mod.rs 66.66% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 9 files

Architecture diagram
sequenceDiagram
    participant Client as Client Application
    participant Resolver as Cursor Model Resolver
    participant Agent as Cursor Agent Adapter
    participant Gateway as Shunt Gateway
    participant API as Cursor AgentService API

    Note over Client,API: Cursor Composer Model Resolution and Encoding Flow

    Client->>Resolver: resolve_cursor_model("cursor:composer-2.5-fast")
    
    alt Suffix-prefixed form (cursor:<id>)
        Resolver->>Resolver: Extract rest = "composer-2.5-fast"
        Resolver->>Resolver: Look up in CURSOR_MODEL_ALIASES
        alt Alias found (composer-2.5-fast / [fast=true] / [fast=false])
            Resolver-->>Client: CursorModelResolution(model_id="composer-2.5", fast=true/false)
        else No alias match
            Resolver-->>Client: CursorModelResolution(model_id=original, fast=false)
        end
    else Legacy bare name
        Resolver->>Resolver: Match legacy mapping (e.g. composer-2.5-fast)
        Resolver->>Resolver: Check CURSOR_MODEL_ALIASES
        Resolver-->>Client: CursorModelResolution(wire_id + fast flag)
    end

    Client->>Agent: AgentRunParams(model_id, fast, mode)
    
    Note over Agent: build_run_frames() constructs wire frames
    
    Agent->>Agent: Encode frame fields
    Note right of Agent: Field 9: selected model<br/>Field 14: catalog entry
    
    Agent->>Agent: encode_model_meta(model_id, fast)
    Agent->>Agent: Field 9 = encode_model_meta("composer-2.5", fast)
    Agent->>Agent: Field 14 = encode_model_meta("composer-2.5", fast)
    
    Agent->>Gateway: Send connect frame with encoded model metadata
    Gateway->>API: Forward Cursor AgentService request
    
    alt Successful resolution
        API-->>Gateway: 200 OK (composer-2.5 with fast metadata)
        Gateway-->>Agent: Stream response
        Agent-->>Client: Assistant text/reasoning
    else Unresolved model (e.g. cursor:composer-2.5-fast sent as wire id)
        API-->>Gateway: 502 not_found (composer-2.5-fast)
        Gateway-->>Client: Error response
    end

    Note over API: Legacy behavior preserved:<br/>bare composer-2.5 -> PLAN mode<br/>bare composer-2.5-fast -> ASK mode
Loading

Re-trigger cubic

@codspeed-hq

codspeed-hq Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 83 untouched benchmarks


Comparing r-uben:fix/cursor-composer-fast-404 (1864a4b) with main (83ab560)

Open in CodSpeed

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-31T11:38:18.972466Z 1864a4b New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

2 participants