Skip to content

Commit 8b10fb9

Browse files
fix(cursor): text generation sends catalog parameters too
Thread titles and commit or PR text built through Cursor sent a bare model id, which Cursor Plus rejects the same way it rejects chat runs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent f85838f commit 8b10fb9

3 files changed

Lines changed: 65 additions & 2 deletions

File tree

‎packages/provider-cursor/src/server/driver.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ export const CursorDriver: ProviderDriver<
211211
processEnv,
212212
auth.requireApiKey,
213213
auth.withAccess,
214+
() => catalogModels,
214215
);
215216

216217
const checkProvider = auth.readApiKey.pipe(

‎packages/provider-cursor/src/server/textGeneration.test.ts‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import * as Schema from "effect/Schema";
99
import { createModelSelection } from "@t3tools/shared/model";
1010
import { beforeEach, vi } from "vite-plus/test";
1111

12+
import { buildCursorDiscoveredModelsFromSdk } from "./status.ts";
1213
import { makeCursorTextGeneration } from "./textGeneration.ts";
1314
import * as CursorSdk from "./CursorSdk.ts";
1415

@@ -103,6 +104,62 @@ describe("CursorTextGeneration", () => {
103104
}).pipe(Effect.provide(layerTest)),
104105
);
105106

107+
it.effect("sends every catalog parameter when the selection leaves them unset", () =>
108+
Effect.gen(function* () {
109+
const models = buildCursorDiscoveredModelsFromSdk([
110+
{
111+
id: "grok-4.5",
112+
displayName: "Grok 4.5",
113+
parameters: [
114+
{
115+
id: "effort",
116+
displayName: "Effort",
117+
values: [{ value: "low" }, { value: "medium" }, { value: "high" }],
118+
},
119+
{ id: "fast", displayName: "Fast", values: [{ value: "false" }, { value: "true" }] },
120+
],
121+
variants: [
122+
{
123+
displayName: "Grok 4.5 High Fast",
124+
isDefault: true,
125+
params: [
126+
{ id: "effort", value: "high" },
127+
{ id: "fast", value: "true" },
128+
],
129+
},
130+
],
131+
},
132+
]);
133+
const generation = yield* makeCursorTextGeneration(
134+
cursorSettings,
135+
{ CURSOR_API_KEY: "test-cursor-key" },
136+
undefined,
137+
undefined,
138+
() => models,
139+
);
140+
141+
yield* generation.generateCommitMessage({
142+
cwd: process.cwd(),
143+
branch: "feature/cursor",
144+
stagedSummary: "M file.ts",
145+
stagedPatch: "diff",
146+
modelSelection: createModelSelection(ProviderInstanceId.make("cursor"), "grok-4.5"),
147+
});
148+
149+
expect(cursorSdkMock.create).toHaveBeenLastCalledWith(
150+
expect.objectContaining({
151+
model: {
152+
id: "grok-4.5",
153+
params: [
154+
{ id: "effort", value: "high" },
155+
{ id: "fast", value: "false" },
156+
],
157+
},
158+
}),
159+
);
160+
}).pipe(Effect.provide(layerTest)),
161+
);
162+
106163
it.effect("continues in the temp directory when the SDK cannot sandbox", () =>
107164
Effect.gen(function* () {
108165
cursorSdkMock.create.mockImplementationOnce(async () => {

‎packages/provider-cursor/src/server/textGeneration.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ import * as Effect from "effect/Effect";
55
import * as Option from "effect/Option";
66
import * as Schema from "effect/Schema";
77

8-
import { type ProviderSetupError, TextGenerationError } from "@t3tools/contracts";
8+
import {
9+
type ProviderSetupError,
10+
type ServerProviderModel,
11+
TextGenerationError,
12+
} from "@t3tools/contracts";
913
import type { CursorSettings } from "../settings.ts";
1014

1115
import * as TextGenerationOperations from "@t3tools/provider-core/server/textGenerationOperations";
@@ -48,6 +52,7 @@ export const makeCursorTextGeneration = Effect.fn("makeCursorTextGeneration")(fu
4852
environment?: NodeJS.ProcessEnv,
4953
resolveApiKey?: Effect.Effect<string, ProviderSetupError>,
5054
withAccess?: CursorAuth["withAccess"],
55+
getModels?: () => ReadonlyArray<ServerProviderModel>,
5156
) {
5257
const fs = yield* FileSystem.FileSystem;
5358
const { Agent, SqliteLocalAgentStore } = yield* CursorSdk.CursorSdk;
@@ -101,7 +106,7 @@ export const makeCursorTextGeneration = Effect.fn("makeCursorTextGeneration")(fu
101106
const agentOptions = {
102107
apiKey,
103108
mode: "plan",
104-
model: cursorSdkModelSelection(modelSelection),
109+
model: cursorSdkModelSelection(modelSelection, getModels?.() ?? []),
105110
local: {
106111
cwd,
107112
store,

0 commit comments

Comments
 (0)