Skip to content
TypeScript

fix(cursor): honor auto and full access modes (#9283)

maria994bd7373cf3
diff --git a/apps/server/src/provider/Layers/CursorAdapter.test.ts b/apps/server/src/provider/Layers/CursorAdapter.test.ts
index cd5cdb7f01a..edc9cfc7ec2 100644
--- a/apps/server/src/provider/Layers/CursorAdapter.test.ts
+++ b/apps/server/src/provider/Layers/CursorAdapter.test.ts
@@ -820,6 +820,9 @@ cursorAdapterTestLayer("CursorAdapterLive", (it) => {
);
assert.isDefined(permissionResponse);
+ const argvRuns = yield* Effect.promise(() => readArgvLog(argvLogPath));
+ assert.deepStrictEqual(argvRuns, [["--force", "acp"]]);
+
yield* adapter.stopSession(threadId);
}),
);
@@ -1260,7 +1263,7 @@ cursorAdapterTestLayer("CursorAdapterLive", (it) => {
const argvRuns = yield* Effect.promise(() => readArgvLog(argvLogPath));
assert.lengthOf(argvRuns, 1, "session should not restart — only one spawn");
- assert.deepStrictEqual(argvRuns[0], ["acp"]);
+ assert.deepStrictEqual(argvRuns[0], ["--force", "acp"]);
const requests = yield* Effect.promise(() => readJsonLines(requestLogPath));
const setConfigRequests = requests.filter(
diff --git a/apps/server/src/provider/Layers/CursorAdapter.ts b/apps/server/src/provider/Layers/CursorAdapter.ts
index 818fe567b9b..2dba46d8126 100644
--- a/apps/server/src/provider/Layers/CursorAdapter.ts
+++ b/apps/server/src/provider/Layers/CursorAdapter.ts
@@ -537,6 +537,7 @@ export function makeCursorAdapter(
...(options?.environment ? { environment: options.environment } : {}),
childProcessSpawner,
cwd,
+ runtimeMode: input.runtimeMode,
...(resumeSessionId ? { resumeSessionId } : {}),
clientInfo: { name: "t3-code", version: "0.0.0" },
...(mcpSession
diff --git a/apps/server/src/provider/acp/CursorAcpSupport.test.ts b/apps/server/src/provider/acp/CursorAcpSupport.test.ts
index a095fdd679b..93c1da9c588 100644
--- a/apps/server/src/provider/acp/CursorAcpSupport.test.ts
+++ b/apps/server/src/provider/acp/CursorAcpSupport.test.ts
@@ -74,6 +74,33 @@ describe("buildCursorAcpSpawnInput", () => {
cwd: "/tmp/project",
});
});
+
+ it("forces approval in full-access mode", () => {
+ expect(buildCursorAcpSpawnInput(undefined, "/tmp/project", undefined, "full-access")).toEqual({
+ command: "cursor-agent",
+ args: ["--force", "acp"],
+ cwd: "/tmp/project",
+ });
+ });
+
+ it("uses Cursor auto-review in auto mode", () => {
+ expect(buildCursorAcpSpawnInput(undefined, "/tmp/project", undefined, "auto")).toEqual({
+ command: "cursor-agent",
+ args: ["--auto-review", "acp"],
+ cwd: "/tmp/project",
+ });
+ });
+
+ it.each(["approval-required", "auto-accept-edits"] as const)(
+ "does not relax approval in %s mode",
+ (runtimeMode) => {
+ expect(buildCursorAcpSpawnInput(undefined, "/tmp/project", undefined, runtimeMode)).toEqual({
+ command: "cursor-agent",
+ args: ["acp"],
+ cwd: "/tmp/project",
+ });
+ },
+ );
});
describe("applyCursorAcpModelSelection", () => {
diff --git a/apps/server/src/provider/acp/CursorAcpSupport.ts b/apps/server/src/provider/acp/CursorAcpSupport.ts
index 30203ad77b1..e3f741d3426 100644
--- a/apps/server/src/provider/acp/CursorAcpSupport.ts
+++ b/apps/server/src/provider/acp/CursorAcpSupport.ts
@@ -1,4 +1,8 @@
-import { type CursorSettings, type ProviderOptionSelection } from "@t3tools/contracts";
+import {
+ type CursorSettings,
+ type ProviderOptionSelection,
+ type RuntimeMode,
+} from "@t3tools/contracts";
import * as Crypto from "effect/Crypto";
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
@@ -15,6 +19,17 @@ import * as AcpSessionRuntime from "./AcpSessionRuntime.ts";
type CursorAcpRuntimeCursorSettings = Pick<CursorSettings, "apiEndpoint" | "binaryPath">;
+function cursorAcpPermissionArgs(runtimeMode?: RuntimeMode): ReadonlyArray<string> {
+ switch (runtimeMode) {
+ case "auto":
+ return ["--auto-review"];
+ case "full-access":
+ return ["--force"];
+ default:
+ return [];
+ }
+}
+
export interface CursorAcpRuntimeInput extends Omit<
AcpSessionRuntime.AcpSessionRuntimeOptions,
"authMethodId" | "clientCapabilities" | "spawn"
@@ -22,6 +37,7 @@ export interface CursorAcpRuntimeInput extends Omit<
readonly childProcessSpawner: ChildProcessSpawner.ChildProcessSpawner["Service"];
readonly cursorSettings: CursorAcpRuntimeCursorSettings | null | undefined;
readonly environment?: NodeJS.ProcessEnv;
+ readonly runtimeMode?: RuntimeMode;
}
export interface CursorAcpModelSelectionErrorContext {
@@ -34,11 +50,13 @@ export function buildCursorAcpSpawnInput(
cursorSettings: CursorAcpRuntimeCursorSettings | null | undefined,
cwd: string,
environment?: NodeJS.ProcessEnv,
+ runtimeMode?: RuntimeMode,
): AcpSessionRuntime.AcpSpawnInput {
return {
command: cursorSettings?.binaryPath || "cursor-agent",
args: [
...(cursorSettings?.apiEndpoint ? (["-e", cursorSettings.apiEndpoint] as const) : []),
+ ...cursorAcpPermissionArgs(runtimeMode),
"acp",
],
cwd,
@@ -57,7 +75,12 @@ export const makeCursorAcpRuntime = (
const acpContext = yield* Layer.build(
AcpSessionRuntime.layer({
...input,
- spawn: buildCursorAcpSpawnInput(input.cursorSettings, input.cwd, input.environment),
+ spawn: buildCursorAcpSpawnInput(
+ input.cursorSettings,
+ input.cwd,
+ input.environment,
+ input.runtimeMode,
+ ),
authMethodId: "cursor_login",
clientCapabilities: CURSOR_PARAMETERIZED_MODEL_PICKER_CAPABILITIES,
}).pipe(
diff --git a/docs/user/permission-modes.md b/docs/user/permission-modes.md
index 9bf9c10b20f..f8448400c52 100644
--- a/docs/user/permission-modes.md
+++ b/docs/user/permission-modes.md
@@ -17,8 +17,8 @@ without prompting; commands and anything else still stop for approval.
**Auto**: routine actions proceed without you; risky ones still ask. How this is enforced depends
on the provider: Codex delegates routine approvals to an AI reviewer, Claude uses its own auto
-permission mode, and providers without an equivalent (such as OpenCode) fall back to asking, like
-Supervised.
+permission mode, Cursor uses Smart Auto review, and providers without an equivalent (such as
+OpenCode) fall back to asking, like Supervised.
**Full access**: allow commands and edits without prompts. The default. The agent runs
unattended until it finishes or asks a question of its own.