Skip to content

fix(cursor): make Auto's Optimize For selectable as Thinking - #568

Merged
BytePioneer-AI merged 1 commit into
BytePioneer-AI:mainfrom
ump45nose:fix/cursor-auto-optimize-for
Oct 21, 2026
Merged

BytePioneer-AI merged 1 commit into
BytePioneer-AI:mainfrom
ump45nose:fix/cursor-auto-optimize-for

Conversation

@ump45nose

Copy link
Copy Markdown
Contributor

Summary

新版 Cursor CLI(实测 cursor-agent 2026.10.01,启用了 Smart Auto 的账号)里,Auto 模型的 ACP 原生值变成 auto-smart,并且只带一个参数:

{ "id": "optimize_for", "name": "Optimize For", "category": "model_config",
  "currentValue": "balanced",
  "options": [{ "value": "intelligence", "name": "Intelligence" },
              { "value": "balanced", "name": "Balance" },
              { "value": "cost", "name": "Cost" }] }

它没有任何 thought_level 参数。Cursor 原生 UI 把它作为 Auto 的 “Optimize For” 选项(Intelligence / Balance / Cost)。

根因:Cursor adapter 只把 thought_level 参数映射为 Thinking,model_config 参数则写进 Model Ref。因此:

  1. Auto 在 Composer 中没有任何 Thinking 选项,无法切换 Optimize For;
  2. 当前值被固化进 Model Ref(auto-smart[optimize_for=balanced])。即使原生值被改动,生成的 Ref 也不在 catalog 中,选择无法被确认。

直接用 ACP session/set_config_option 设置 optimize_for=intelligence / cost,Cursor 均正常确认,说明问题在 Host 侧的映射。

改动(只改 packages/adapters/cursor-cli):

  • thinking.ts:新增 isCursorThinkingOption。除 thought_level 外,model_config 中按 id 列出的 optimize_for 也作为 Thinking 选项提供(标签沿用原生名称 Intelligence / Balance / Cost)。
  • models.ts:cursorConfiguredModelRef 不再把作为 Thinking 的参数写进 Model Ref,Auto 的 Ref 为 auto-smart。context、fast 等其他 model_config 参数仍保留在 Ref 中,行为不变。
  • 旧的 auto-smart[optimize_for=…] Ref 仍可通过已有的 legacy 解析恢复。

说明:

  • 这里按 id 显式列出 optimize_for,没有把所有 model_config 参数泛化为 Thinking,避免 context / fast 这类参数改变语义。
  • 新对话选中 Auto 时,如果 Auto 当前的 Cursor 原生值不是 catalog 的默认 Thinking,草稿会使用第一个选项(Intelligence)。这与其他模型现有的草稿 Thinking 规则一致,本 PR 没有改动这部分逻辑。

Related issues

N/A

Test plan

自动测试:

  • npx vitest run --config tests/vitest.config.js packages/adapters/cursor-cli:18 个文件、183 个测试通过。capabilities.test.ts 新增 3 个用例(fixture 取自 cursor-agent 2026.10.01 实际返回的 Auto 参数):
    • Auto 提供 Intelligence / Balance / Cost 三个 Thinking 选项,Ref 为 auto-smart,默认 Thinking 为当前原生值;其他 model_config 参数仍在 Ref 中。
    • thinking.select 写入 optimize_for=intelligence,确认后 effectiveModel 仍是 catalog 中的 auto-smart。
    • legacy Ref auto-smart[optimize_for=cost] 仍解析为 model=auto-smart + optimize_for=cost。
    • 去掉源码改动后,前两个新用例失败。
  • npm run typecheck、npx eslint packages/adapters/cursor-cli、node tools/check-boundaries.mjs、prettier --check:通过。

实机(macOS arm64):

  • cursor-agent 2026.10.01-e373342(Smart Auto 账号),codexhost 0.13.3 + 本 PR 的 cursor-cli plugin,调用 adapter inspect()(只读取模型列表,不发送 prompt):
    • 原 0.13.3 plugin:Auto Ref auto-smart[optimize_for=…],Thinking 选项为空。
    • 本 PR:Auto Ref auto-smart,Thinking ["Intelligence","Balance","Cost"],默认值与原生 currentValue 一致;其余 45 个模型的 Ref 和 Thinking 不变。
  • cursor-agent 2026.10.19-6bbf2c4,未启用 Smart Auto 的账号:Auto 仍为 default 且没有参数,新旧 plugin 输出一致(无回归)。
  • 未验证:Smart Auto 是否开放取决于 Cursor 账号,而不只是 CLI 版本。本 PR 尚未附 Composer UI 截图,也没有发送真实 Turn。

cursor-agent 2026.10 reports Auto as `auto-smart` with one `model_config`
parameter, `optimize_for` (Intelligence / Balance / Cost), and no
`thought_level` parameter. Host therefore offered Auto no Thinking choices
and baked the current value into the Model Ref
(`auto-smart[optimize_for=balanced]`), so the router preference could not be
changed from the Composer.

Present `optimize_for` as Auto's Thinking options and keep it out of the
Model Ref so a changed preference still resolves to a catalog model. Legacy
Refs that carried the parameter are still accepted.

Signed-off-by: Vincent <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: BytePioneer-AI/codex-host/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b28f5301-be48-4b86-8521-be9525bbdcae
📥 Commits

Reviewing files that changed from the base of the PR and between a8adb78 and cd96d52.

📒 Files selected for processing: 3
  • packages/adapters/cursor-cli/src/models.ts
  • packages/adapters/cursor-cli/src/thinking.ts
  • packages/adapters/cursor-cli/test/capabilities.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout: 3
  • GitHub Check: Check ubuntu-22.04
  • GitHub Check: Check macos-14
  • GitHub Check: Check windows-latest
🔇 Additional comments: 3
packages/adapters/cursor-cli/src/thinking.ts: 1

13-27: LGTM!

Also applies to: 31-31

packages/adapters/cursor-cli/src/models.ts: 1

8-8: LGTM!

Also applies to: 204-205, 207-209

packages/adapters/cursor-cli/test/capabilities.test.ts: 1

213-260: LGTM!

Also applies to: 261-292, 294-303

📝 Summary

Summary by CodeRabbit

  • 新功能
    • Cursor Auto 模型新增“优化目标(Optimize For)”选项,并将其作为 Thinking 配置提供。
    • 选择优化目标后,相关设置会应用到 Cursor 原生配置中,同时保留已确认模型的可选性。
  • 兼容性
    • 继续支持包含“优化目标”配置的旧版模型引用,确保现有设置可正常使用。

Cursor 适配器现在将 thought_level 和 optimize_for 识别为 Thinking 选项,并从配置模型引用中排除这些参数。新增测试覆盖选项公开、会话配置更新、模型有效性及旧版引用解析。

Changes: Cursor Thinking 选项处理

Layer / File(s) Summary
识别 Thinking 选项并验证配置流程
packages/adapters/cursor-cli/src/thinking.ts, packages/adapters/cursor-cli/src/models.ts, packages/adapters/cursor-cli/test/capabilities.test.ts
thought_level 和 optimize_for 会作为 Thinking 选项处理,且不再写入配置模型引用。测试覆盖选项公开、原生配置更新、已确认模型有效性,以及携带 optimize_for 的旧版模型引用解析。

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: bytepioneer-ai

Merge Risk: ⚪ Minimal · up to cd96d

No actionable issue remains in the reviewed change. It is ready to merge after normal checks.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed 标题准确概括了主要变更:让 Cursor Auto 的 Optimize For 选项作为 Thinking 选项可选择。
Description check Passed 描述与变更内容一致,说明了 Auto 的 optimize_for 映射、Model Ref 行为、兼容性处理和测试结果。
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@BytePioneer-AI
BytePioneer-AI merged commit 04e8b8f into BytePioneer-AI:main Oct 21, 2026
5 checks passed
@BytePioneer-AI

Copy link
Copy Markdown
Owner

已合并(04e8b8ff),感谢 @ump45nose!

把 Auto 的 optimize_for 作为 Thinking 提供、并让 Ref 保持 auto-smart,改动小而准:只按 id 显式列出,没有泛化到 context / fast,旧 Ref 也保留了兼容;测试用的是真实返回数据,实机验证也写得很清楚。

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