@devries-cameron20 / t3code-1 / commits / 8046e1d8cd
Fork 0

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

fix(provider-cursor): say when Cursor rejects a free-plan account (#19771)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Ali Younes committed Oct 20, 2026 at 00:15 UTC 8046e1d8cdaacd50bf1e4a2257a1a02eaec3d8bf
6 files changed +75 -10
docs/user/cursor.md
+1
@@ -8,6 +8,7 @@ TypeScript package. It does not use Cursor's ACP transport for V2 execution.
8 - Node.js 22.13 or newer. The repository's supported Node version satisfies this requirement.
9 - Sign in with Cursor in **Settings > Providers > Cursor**, or provide a Cursor API key in
10 `CURSOR_API_KEY`.
11 +- A paid Cursor plan on the account used for browser sign-in or `CURSOR_API_KEY`.
12 - A model accepted by the Cursor SDK. `auto` is sent to the SDK as its `default` model selection.
13
14 The adapter currently uses the SDK's local-agent runtime so runs operate in the selected T3 Code
packages/provider-cursor/src/server/CursorSdkCatalog.ts
+4
@@ -26,6 +26,10 @@ export class CursorSdkCatalogError extends Schema.TaggedError<CursorSdkCatalogEr
26 ? "Cursor SDK authentication failed."
27 : "Cursor SDK catalog request failed.";
28 }
29 +
30 + get planRequired(): boolean {
31 + return this.cause instanceof CursorSdkError && this.cause.code === "plan_required";
32 + }
33 }
34
35 export class CursorSdkCatalog extends Context.Service<
packages/provider-cursor/src/server/auth.test.ts
+5 -2
@@ -234,6 +234,8 @@ it.layer(NodeServices.layer)("CursorAuth", (it) => {
234
235 it.effect("discards a credential rejected by verification and permits a fresh login", () =>
236 Effect.gen(function* () {
237 + const rejectionMessage =
238 + "Cursor needs a paid plan to run in T3 Code. Upgrade this account or sign in with a different one.";
239 let rejected = true;
240 const harness = yield* makeHarness({
241 onChanged: (signedIn) =>
@@ -242,7 +244,7 @@ it.layer(NodeServices.layer)("CursorAuth", (it) => {
244 new ProviderSetupError({
245 instanceId,
246 operation: "start",
245 - detail: "Could not verify the Cursor sign-in.",
247 + detail: rejectionMessage,
248 }),
249 )
250 : Effect.void,
@@ -250,7 +252,8 @@ it.layer(NodeServices.layer)("CursorAuth", (it) => {
252 yield* harness.auth.controller.start(owner);
253 yield* phase(harness.auth, "waiting");
254 yield* Effect.sync(() => harness.complete.resolve());
253 - yield* phase(harness.auth, "failed");
255 + const failed = yield* phase(harness.auth, "failed");
256 + expect(failed.message).toBe(rejectionMessage);
257 expect(yield* Effect.promise(() => harness.store.load())).toBeUndefined();
258 expect(yield* harness.auth.readApiKey).toBeUndefined();
259 expect(Exit.isFailure(yield* Effect.exit(harness.auth.requireApiKey))).toBe(true);
packages/provider-cursor/src/server/auth.ts
+6 -1
@@ -4,12 +4,14 @@ import {
4 type ProviderAuthState,
5 type ProviderInstanceId,
6 } from "@t3tools/contracts";
7 +import * as Cause from "effect/Cause";
8 import * as Clock from "effect/Clock";
9 import * as Crypto from "effect/Crypto";
10 import * as DateTime from "effect/DateTime";
11 import * as Effect from "effect/Effect";
12 import * as Exit from "effect/Exit";
13 import * as Fiber from "effect/Fiber";
14 +import * as Option from "effect/Option";
15 import * as Queue from "effect/Queue";
16 import * as Scope from "effect/Scope";
17 import * as Semaphore from "effect/Semaphore";
@@ -271,7 +273,10 @@ export const makeCursorAuth = Effect.fn("makeCursorAuth")(function* (options: Cu
273 expiresAt: null,
274 message: Exit.isSuccess(result)
275 ? "Signed in with Cursor."
274 - : "Cursor sign-in failed or expired. Start sign-in again.",
276 + : Option.match(Cause.findErrorOption(result.cause), {
277 + onNone: () => "Cursor sign-in failed or expired. Start sign-in again.",
278 + onSome: (error) => error.detail,
279 + }),
280 });
281 }),
282 ),
packages/provider-cursor/src/server/status.test.ts
+44
@@ -14,6 +14,7 @@ import {
14 checkCursorProviderStatus,
15 } from "./status.ts";
16 import * as CursorSdkCatalog from "./CursorSdkCatalog.ts";
17 +import { CursorSdkError } from "./sdk.ts";
18
19 const decodeCursorSettings = Schema.decodeSync(CursorSettingsSchema);
20
@@ -231,6 +232,49 @@ describe("checkCursorProviderStatus", () => {
232 }),
233 );
234
235 + it.effect.each([
236 + {
237 + authenticationType: "browser" as const,
238 + message:
239 + "Cursor needs a paid plan to run in T3 Code. Upgrade this account or sign in with a different one.",
240 + },
241 + {
242 + authenticationType: "api-key" as const,
243 + message:
244 + "Cursor needs a paid plan to run in T3 Code. Upgrade the account that owns CURSOR_API_KEY or use a key from a paid account.",
245 + },
246 + ])(
247 + "explains a rejected plan for $authenticationType authentication",
248 + ({ authenticationType, message }) =>
249 + Effect.gen(function* () {
250 + const provider = yield* checkCursorProviderStatus(
251 + baseCursorSettings,
252 + { CURSOR_API_KEY: "free-plan-key" },
253 + authenticationType,
254 + ).pipe(
255 + Effect.provide(
256 + CursorSdkCatalog.layerTest(() =>
257 + Effect.fail(
258 + new CursorSdkCatalog.CursorSdkCatalogError({
259 + authenticationFailure: false,
260 + cause: new CursorSdkError(
261 + "[plan_required] Cloud Agent is not available for free users. Please upgrade to Pro.",
262 + { code: "plan_required", status: 403 },
263 + ),
264 + }),
265 + ),
266 + ),
267 + ),
268 + );
269 +
270 + expect(provider).toMatchObject({
271 + status: "error",
272 + auth: { status: "unknown" },
273 + message,
274 + });
275 + }),
276 + );
277 +
278 it.effect("requires a Cursor API key without probing any external Cursor binary", () =>
279 Effect.gen(function* () {
280 const provider = yield* checkCursorProviderStatus(baseCursorSettings).pipe(
packages/provider-cursor/src/server/status.ts
+15 -7
@@ -294,7 +294,19 @@ export const checkCursorProviderStatus = Effect.fn("checkCursorProviderStatus")(
294 yield* Effect.logWarning("Cursor SDK catalog probe failed", {
295 cause: catalogResult.failure.cause,
296 });
297 - const authenticationFailure = catalogResult.failure.authenticationFailure;
297 + const failure = catalogResult.failure;
298 + let message = "Cursor SDK catalog request failed. Check server logs for details.";
299 + if (failure.authenticationFailure) {
300 + message =
301 + authenticationType === "browser"
302 + ? "Cursor sign-in expired or was rejected. Sign in again in provider settings."
303 + : "Cursor SDK authentication failed. Check CURSOR_API_KEY.";
304 + } else if (failure.planRequired) {
305 + message =
306 + authenticationType === "browser"
307 + ? "Cursor needs a paid plan to run in T3 Code. Upgrade this account or sign in with a different one."
308 + : "Cursor needs a paid plan to run in T3 Code. Upgrade the account that owns CURSOR_API_KEY or use a key from a paid account.";
309 + }
310 return buildServerProvider({
311 presentation: CURSOR_PRESENTATION,
312 enabled: cursorSettings.enabled,
@@ -304,12 +316,8 @@ export const checkCursorProviderStatus = Effect.fn("checkCursorProviderStatus")(
316 installed: true,
317 version: null,
318 status: "error",
307 - auth: { status: authenticationFailure ? "unauthenticated" : "unknown" },
308 - message: authenticationFailure
309 - ? authenticationType === "browser"
310 - ? "Cursor sign-in expired or was rejected. Sign in again in provider settings."
311 - : "Cursor SDK authentication failed. Check CURSOR_API_KEY."
312 - : "Cursor SDK catalog request failed. Check server logs for details.",
319 + auth: { status: failure.authenticationFailure ? "unauthenticated" : "unknown" },
320 + message,
321 },
322 });
323 }