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, 22:15 UTC
fix(cursor): retry a timed-out catalog read before reporting an error (#34553)
Julius Marminge committed
Nov 11, 2026 at 13:24 UTC
80d8623fc3435e3ec5f62d5f40d8aed8ca00b7c9
2 files changed
+40
-3
packages/provider-cursor/src/server/status.test.ts
+32
@@ -1,7 +1,9 @@
1
import type { SDKModel } from "@cursor/sdk";
2
import { describe, expect, it } from "@effect/vitest";
3
import * as Effect from "effect/Effect";
4
+import * as Fiber from "effect/Fiber";
5
import * as Schema from "effect/Schema";
6
+import * as TestClock from "effect/testing/TestClock";
7
import type { CursorSettings } from "../settings.ts";
8
import { CursorSettings as CursorSettingsSchema } from "../settings.ts";
9
import { createModelCapabilities } from "@t3tools/shared/model";
@@ -354,6 +356,36 @@ describe("checkCursorProviderStatus", () => {
356
}),
357
);
358
359
+ it.effect("does not report a single slow catalog read as a provider error", () =>
360
+ Effect.gen(function* () {
361
+ let reads = 0;
362
+ const fiber = yield* checkCursorProviderStatus(baseCursorSettings, {
363
+ CURSOR_API_KEY: "test-cursor-key",
364
+ }).pipe(
365
+ Effect.provide(
366
+ CursorSdkCatalog.layerTest(() => {
367
+ reads += 1;
368
+ return reads === 1
369
+ ? Effect.never
370
+ : Effect.succeed({
371
+ user: {
372
+ apiKeyName: "test-key",
373
+ userEmail: "cursor@example.com",
374
+ createdAt: "2026-01-01T00:00:00.000Z",
375
+ },
376
+ models: [sdkParameterizedModel],
377
+ });
378
+ }),
379
+ ),
380
+ Effect.forkChild({ startImmediately: true }),
381
+ );
382
+ yield* TestClock.adjust("1 minute");
383
+ const provider = yield* Fiber.join(fiber);
384
+
385
+ expect(provider.status).not.toBe("error");
386
+ }),
387
+ );
388
+
389
it.effect("requires a Cursor API key without probing any external Cursor binary", () =>
390
Effect.gen(function* () {
391
const provider = yield* checkCursorProviderStatus(baseCursorSettings).pipe(
packages/provider-cursor/src/server/status.ts
+8
-3
@@ -286,9 +286,14 @@ export const checkCursorProviderStatus = Effect.fn("checkCursorProviderStatus")(
286
}
287
288
const sdkCatalog = yield* CursorSdkCatalog.CursorSdkCatalog;
289
- const catalogResult = yield* sdkCatalog
290
- .read(sdkApiKey)
291
- .pipe(Effect.timeoutOption(CURSOR_SDK_CATALOG_TIMEOUT_MS), Effect.result);
289
+ const readCatalog = Effect.suspend(() => sdkCatalog.read(sdkApiKey)).pipe(
290
+ Effect.timeoutOption(CURSOR_SDK_CATALOG_TIMEOUT_MS),
291
+ );
292
+ // api.cursor.com latency is intermittent; one slow read should not flip the provider to error.
293
+ const catalogResult = yield* readCatalog.pipe(
294
+ Effect.filterOrElse(Option.isSome, () => readCatalog),
295
+ Effect.result,
296
+ );
297
298
if (Result.isFailure(catalogResult)) {
299
yield* Effect.logWarning("Cursor SDK catalog probe failed", {