Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
4b87733
fix(acp-registry): Cursor offers a reasoning effort picker per model
only21mil Oct 24, 2026
4742a78
Merge remote-tracking branch 'github/main' into maria/takeover-pr-24729
maria-rcks Oct 26, 2026
391e70f
fix(acp-registry): preserve saved Cursor preset options
maria-rcks Oct 26, 2026
41f15c6
Merge remote-tracking branch 'github/main' into maria/takeover-pr-24729
maria-rcks Oct 30, 2026
61bf784
fix(acp-registry): retain native saved Cursor selections
maria-rcks Oct 30, 2026
02f104d
fix(web): limit saved ACP presets to Cursor
maria-rcks Oct 30, 2026
478e6ef
fix(acp): merge main and validate normalized cursor presets
maria-rcks Oct 31, 2026
507caef
Merge branch 'main' into fix/i24371-cursor-via-acp-registry-can-t-pic…
only21mil Nov 12, 2026
45a15f8
Merge branch 'main' into fix/i24371-cursor-via-acp-registry-can-t-pic…
only21mil Nov 12, 2026
b4068d5
Merge remote-tracking branch 'origin/main' into fix/i24371-cursor-via…
juliusmarminge Nov 12, 2026
e7e7a42
test(acp-registry): trim redundant Cursor preset cases
juliusmarminge Nov 12, 2026
eed68a8
Merge branch 'main' into fix/i24371-cursor-via-acp-registry-can-t-pic…
only21mil Nov 13, 2026
39ace1d
Merge branch 'main' into fix/i24371-cursor-via-acp-registry-can-t-pic…
only21mil Nov 14, 2026
d621b24
Merge branch 'main' into fix/i24371-cursor-via-acp-registry-can-t-pic…
only21mil Nov 15, 2026
2bafe26
Merge branch 'main' into fix/i24371-cursor-via-acp-registry-can-t-pic…
only21mil Nov 16, 2026
5512bb2
test(web): drop model selection rows main now covers
only21mil Nov 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions apps/server/scripts/acp-mock-agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ function configOptions(): ReadonlyArray<AcpSchema.SessionConfigOption> {
{ value: "composer-2", name: "Composer 2" },
{ value: "gpt-5.4", name: "GPT-5.4" },
{ value: "claude-opus-4-6", name: "Opus 4.6" },
{ value: "claude-sonnet-4-6", name: "Sonnet 4.6" },
],
},
];
Expand Down Expand Up @@ -258,10 +259,11 @@ function configOptions(): ReadonlyArray<AcpSchema.SessionConfigOption> {
},
];
case "claude-opus-4-6":
case "claude-sonnet-4-6":
return [
...baseOptions,
{
configId: "reasoning",
configId: currentModelId === "claude-opus-4-6" ? "effort" : "reasoning_effort",
name: "Reasoning",
category: "thought_level",
type: "select",
Expand Down Expand Up @@ -845,7 +847,10 @@ const program = Effect.gen(function* () {
if (request.configId === "agent" && typeof request.value === "string") {
currentAgent = request.value;
}
if (request.configId === "reasoning" && typeof request.value === "string") {
if (
["reasoning", "effort", "reasoning_effort"].includes(request.configId) &&
typeof request.value === "string"
) {
currentReasoning = request.value;
}
if (request.configId === "context" && typeof request.value === "string") {
Expand Down
118 changes: 118 additions & 0 deletions apps/server/src/orchestration-v2/Adapters/AcpRegistryAdapterV2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,124 @@ describe("AcpRegistryAdapterV2", () => {
}).pipe(Effect.provide(layerTest)),
);

// regression: #24371 Cursor lists only fixed effort presets unless asked for its picker
it.effect("opens Cursor on a plain model with the reasoning effort the thread picked", () =>
Effect.gen(function* () {
const path = yield* Path.Path;
const mockAgentPath = yield* path.fromFileUrl(
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
);
const instanceId = ProviderInstanceId.make("acp-registry-cursor");
const openCursor = Effect.fn("openCursor")(function* (stored: ModelSelection) {
let published: AcpRegistryLiveConfiguration | undefined;
const adapter = yield* makeAcpRegistryAdapterV2({
selfInvocation: yield* resolveSelfInvocation(),
instanceId,
settings: yield* decodeAcpRegistryAdapterSettings({ agentId: "cursor" }),
environment: {},
}).pipe(
Effect.provide(
Layer.mergeAll(
Layer.mock(AcpRegistrySupport.AcpRegistryCatalog)({
resolve: (_settings, cwd) =>
Effect.succeed({
distribution: "local" as const,
spawn: { command: process.execPath, args: [mockAgentPath], cwd },
}),
}),
Layer.mock(AcpRegistryRuntimeCoordinator.AcpRegistryRuntimeCoordinator)({
withForegroundStartup: (_startupKey, effect) => effect,
publishLiveConfiguration: (_instanceId, configuration) =>
Effect.sync(() => {
published = configuration;
}),
}),
),
),
);
const threadId = ThreadId.make("thread-acp-registry-cursor");
const runtimePolicy = ProviderAdapter.ProviderAdapterV2RuntimePolicy.make({
runtimeMode: "full-access",
interactionMode: "default",
cwd: process.cwd(),
});
yield* Effect.gen(function* () {
const runtime = yield* adapter.openSession({
threadId: ThreadId.make("thread-acp-registry-cursor"),
providerSessionId: ProviderSessionId.make("provider-session-acp-registry-cursor"),
modelSelection: stored,
runtimePolicy,
});
const providerThread = yield* runtime.ensureThread({
threadId,
modelSelection: stored,
runtimePolicy,
});
yield* runtime.startTurn(
makeTurnInput({
threadId,
providerThread,
instanceId,
runtimePolicy,
now: yield* DateTime.now,
ordinal: 1,
modelSelection: stored,
}),
);
yield* runtime.events.pipe(
Stream.takeUntil((event) => event.type === "turn.terminal"),
Stream.runForEach((event) =>
Effect.sync(() => {
if (event.type === "turn.terminal") {
assert.equal(event.status, "completed", event.failure?.message);
}
}),
),
);
}).pipe(Effect.scoped);
return published;
});

const picked = yield* openCursor({
instanceId,
model: "gpt-5.4",
options: [{ id: "reasoning", value: "extra-high" }],
});
assert.equal(picked?.currentModelId, "gpt-5.4");
assert.deepInclude(
picked?.configOptions.find((option) => option.id === "reasoning"),
{ currentValue: "extra-high" },
);
for (const [model, id] of [
["claude-opus-4-6", "effort"],
["claude-sonnet-4-6", "reasoning_effort"],
]) {
const native = yield* openCursor({ instanceId, model: `${model}[${id}=high]` });
assert.equal(native?.currentModelId, model);
assert.deepInclude(
native?.configOptions.find((option) => option.id === id),
{ currentValue: "high" },
);
}
const legacy = yield* openCursor({
instanceId,
model: "gpt-5.4[reasoning=high,context=1m,fast=true]",
options: [{ id: "reasoning", value: "extra-high" }],
});
assert.equal(legacy?.currentModelId, "gpt-5.4");
for (const [id, value] of [
["reasoning", "extra-high"],
["context", "1m"],
["fast", "true"],
]) {
assert.deepInclude(
legacy?.configOptions.find((option) => option.id === id),
{ currentValue: value },
);
}
}).pipe(Effect.provide(layerTest), Effect.scoped),
);

// regression: #26695 cancelling a Copilot prompt kills its background agents
it.effect("never steers Copilot by cancelling its prompt", () =>
Effect.gen(function* () {
Expand Down
39 changes: 39 additions & 0 deletions apps/server/src/provider/AcpRegistryProbe.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,45 @@ describe("ACP Registry probe", () => {
);
});

// regression: #24371 Cursor lists only fixed effort presets unless asked for its picker
// Live clock: the probe waits a short real grace for command advertisements.
it.live("lists Cursor's plain model ids so its effort stays a separate option", () => {
const catalog = AcpRegistrySupport.AcpRegistryCatalog.of({
search: () => Effect.die("unused search"),
prepare: () => Effect.die("unused prepare"),
inspect: () => Effect.die("unused inspect"),
uninstallManagedBinary: () => Effect.die("unused uninstall"),
resolve: () =>
Effect.succeed({
distribution: "local" as const,
spawn: { command: "node", args: [mockAgentPath] },
}),
});
const probedModels = (agentId: string) =>
probeAcpRegistryConfiguration({
instanceId,
settings: decodeSettings({ agentId }),
cwd: process.cwd(),
environment: process.env,
}).pipe(Effect.map((result) => result.probe.models.map((model) => model.id)));

return Effect.gen(function* () {
expect(yield* probedModels("cursor")).toEqual([
"default",
"composer-2",
"gpt-5.4",
"claude-opus-4-6",
"claude-sonnet-4-6",
]);
expect(yield* probedModels("mock-agent")).toContain(
"gpt-5.3-codex[reasoning=medium,fast=false]",
);
}).pipe(
Effect.provideService(AcpRegistrySupport.AcpRegistryCatalog, catalog),
Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer)),
);
});

it.live.each(["succeeds", "fails"] as const)(
"deletes its health-probe session when deletion is advertised and %s",
(deleteOutcome) =>
Expand Down
11 changes: 11 additions & 0 deletions packages/provider-acp-registry/src/server/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ import {
isCopilotLostSessionError,
makeCopilotSubagentRouting,
} from "./copilotAcp.ts";
import {
normalizeCursorModelSelection,
cursorClientCapabilitiesMeta,
isCursorAcpAgent,
} from "./cursorAcp.ts";
import { prefersHttpMcpTransport } from "./mcpTransport.ts";
import { defaultInstanceIdForDriver, ProviderDriverKind } from "@t3tools/contracts";
import { readCustomModelEntries } from "@t3tools/shared/model";
Expand Down Expand Up @@ -272,6 +277,12 @@ export const makeAcpRegistryAdapterV2 = Effect.fn("makeAcpRegistryAdapterV2")(fu
answerablePermissionOptions: devinAnswerablePermissionOptions,
}
: {}),
...(isCursorAcpAgent(options.settings)
? {
clientCapabilitiesMeta: cursorClientCapabilitiesMeta,
normalizeModelSelection: normalizeCursorModelSelection,
}
: {}),
...(copilotRouting === undefined
? {}
: {
Expand Down
33 changes: 33 additions & 0 deletions packages/provider-acp-registry/src/server/cursorAcp.ts

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we dont care about this. cursor sdk is the blessed path for cursor.

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import type { ModelSelection } from "@t3tools/contracts";
import type { AcpRegistrySettings } from "../settings.ts";

// Without this flag Cursor lists one fixed preset per model, such as
// `claude-opus-5-5[context=300k,effort=medium,fast=false]`. With it Cursor lists
// plain model ids and reports effort, context and fast as config options.
export const cursorClientCapabilitiesMeta = { parameterizedModelPicker: true };

// Local installs launch the `cursor-agent` binary directly with no registry id.
export function isCursorAcpAgent(settings: AcpRegistrySettings): boolean {
return (
(settings.source !== "local" && settings.agentId === "cursor") ||
(settings.source === "local" &&
/^cursor-agent(\.exe|\.cmd)?$/i.test(settings.commandPath.split(/[\\/]/).pop() ?? ""))
);
}

// Preserve preset values when opening threads saved before parameterized negotiation.
export function normalizeCursorModelSelection(selection: ModelSelection): ModelSelection {
const preset = /^(.*)\[([^\]]*)\]$/.exec(selection.model);
if (preset === null) return selection;
const explicit = selection.options ?? [];
const options = preset[2]!.split(",").flatMap((entry) => {
const [id, value] = entry.split("=");
return id !== undefined &&
["reasoning", "effort", "reasoning_effort", "context", "fast"].includes(id) &&
value &&
!explicit.some((option) => option.id === id)
? [{ id, value }]
: [];
});
return { ...selection, model: preset[1]!, options: [...options, ...explicit] };
}
3 changes: 3 additions & 0 deletions packages/provider-acp-registry/src/server/probe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
flattenSelectChoices,
} from "@t3tools/provider-acp/server/sessionConfig";
import * as AcpRegistryRuntimeCoordinator from "./AcpRegistryRuntimeCoordinator.ts";
import { cursorClientCapabilitiesMeta, isCursorAcpAgent } from "./cursorAcp.ts";
import * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime";

const MAX_AUTH_METHODS = 32;
Expand Down Expand Up @@ -424,6 +425,8 @@ export const probeAcpRegistryConfiguration = Effect.fn("AcpRegistryProbe.probeCo
elicitation: { url: {} },
fs: { readTextFile: false, writeTextFile: false },
terminal: false,
// The catalog has to list the same model ids the sessions will offer.
...(isCursorAcpAgent(input.settings) ? { _meta: cursorClientCapabilitiesMeta } : {}),
},
clientInfo: { name: "t3-code-provider-test", version: "0.0.0" },
authenticateOnAuthRequired: false,
Expand Down
3 changes: 3 additions & 0 deletions packages/provider-acp/src/server/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ export interface AcpAdapterV2Flavor {
ChildProcessSpawner.ChildProcessSpawner | SecureRandom.SecureRandom | Scope.Scope
>;
readonly customModels?: ReadonlyArray<string>;
readonly normalizeModelSelection?: (selection: ModelSelection) => ModelSelection;
/** The agent may run another model than session/new reports, so the model is always written. */
readonly alwaysSetModel?: boolean;
/** Values the client shows for options a new session's selection leaves unset. */
Expand Down Expand Up @@ -7584,6 +7585,7 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
const validateModelSelection = Effect.fn("AcpAdapterV2.validateModelSelection")(function* (
modelSelection: ModelSelection,
) {
modelSelection = flavor.normalizeModelSelection?.(modelSelection) ?? modelSelection;
const model = flavor.resolveModelId?.(modelSelection) ?? modelSelection.model;
if (
flavor.applyModelSelection !== undefined ||
Expand Down Expand Up @@ -7616,6 +7618,7 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
unsetOptionDefaults: NonNullable<ModelSelection["options"]> = [],
) {
yield* Ref.set(activeSelection, null);
modelSelection = flavor.normalizeModelSelection?.(modelSelection) ?? modelSelection;
yield* validateModelSelection(modelSelection);
const requestedModel = flavor.resolveModelId?.(modelSelection) ?? modelSelection.model;
// Invalid params is the agent refusing the value, and the runtime
Expand Down
Loading