@devries-cameron20 / t3code Mirror · read-only / commits / 64a481c2af
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 12:15 UTC

fix(cursor): text generation retries without the sandbox when send rejects it (#34844)

Julius Marminge committed Nov 14, 2026 at 20:53 UTC 64a481c2af8e65b95679af7707726e1e59ce8d75
2 files changed +22 -11
packages/provider-cursor/src/server/textGeneration.test.ts
+12 -5
@@ -108,11 +108,18 @@ describe("CursorTextGeneration", () => {
108
109 it.effect("continues in the temp directory when the SDK cannot sandbox", () =>
110 Effect.gen(function* () {
111 - cursorSdkMock.create.mockImplementationOnce(async () => {
112 - throw new Error(
113 - "Local SDK sandboxing was requested, but sandboxing is not supported in this environment. Disable local.sandboxOptions.enabled or remove ~/.cursor/sandbox.json to run without sandboxing.",
114 - );
115 - });
111 + // The SDK checks sandbox support lazily, so create succeeds and send rejects.
112 + cursorSdkMock.create.mockImplementationOnce(async () => ({
113 + close: cursorSdkMock.close,
114 + [Symbol.asyncDispose]: async () => {
115 + cursorSdkMock.close();
116 + },
117 + send: async () => {
118 + throw new Error(
119 + "Local SDK sandboxing was requested, but sandboxing is not supported in this environment. Disable local.sandboxOptions.enabled or remove ~/.cursor/sandbox.json to run without sandboxing.",
120 + );
121 + },
122 + }));
123 const textGeneration = yield* makeCursorTextGeneration(cursorSettings, {
124 CURSOR_API_KEY: "test-cursor-key",
125 });
packages/provider-cursor/src/server/textGeneration.ts
+10 -6
@@ -152,12 +152,11 @@ export const makeCursorTextGeneration = Effect.fn("makeCursorTextGeneration")(fu
152 catch: sdkFailure("Cursor SDK agent could not be created."),
153 });
154
155 - const request = Effect.gen(function* () {
156 - // Empty cwd and setting sources isolate the run from user projects even if sandboxing fails.
155 + const runPrompt = Effect.fn("CursorTextGeneration.runPrompt")(function* (
156 + sandboxEnabled: boolean,
157 + ) {
158 const agent = yield* Effect.acquireRelease(
158 - createCursorAgent(true).pipe(
159 - Effect.catchIf(cursorSandboxUnsupported, () => createCursorAgent(false)),
160 - ),
159 + createCursorAgent(sandboxEnabled),
160 (agent) =>
161 Effect.tryPromise({
162 try: () => agent[Symbol.asyncDispose](),
@@ -185,7 +184,12 @@ export const makeCursorTextGeneration = Effect.fn("makeCursorTextGeneration")(fu
184 try: () => run.wait(),
185 catch: sdkFailure("Cursor SDK run failed."),
186 });
188 - }).pipe(Effect.scoped);
187 + }, Effect.scoped);
188 + // The SDK may reject sandboxing in create or lazily in send. Empty cwd and setting
189 + // sources isolate the unsandboxed retry from user projects.
190 + const request = runPrompt(true).pipe(
191 + Effect.catchIf(cursorSandboxUnsupported, () => runPrompt(false)),
192 + );
193 const promptResult = yield* request.pipe(
194 Effect.timeoutOption(CURSOR_TIMEOUT_MS),
195 Effect.flatMap(