@devries-cameron20 / t3code Mirror · read-only / commits / 3083d712ee
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 24, 21:30 UTC

[codex] fix: clarify Cursor CLI setup error (#3519)

Co-authored-by: Codex <codex@openai.com>

Wout Stiens committed Jun 23, 2026 at 07:33 UTC 3083d712eefb8009f7366ba53040eb2d477bfa33
2 files changed +61 -12
apps/server/src/provider/Layers/CursorProvider.test.ts
+44 -10
@@ -4,6 +4,7 @@ import * as NodeServices from "@effect/platform-node/NodeServices";
4 import * as Effect from "effect/Effect";
5 import * as FileSystem from "effect/FileSystem";
6 import * as Path from "effect/Path";
7 +import type * as ChildProcessSpawner from "effect/unstable/process/ChildProcessSpawner";
8 import { describe, expect, it } from "vite-plus/test";
9 import type * as EffectAcpSchema from "effect-acp/schema";
10 import type { CursorSettings } from "@t3tools/contracts";
@@ -24,7 +25,11 @@ import {
25 } from "./CursorProvider.ts";
26
27 const runNode = <A, E>(
27 - effect: Effect.Effect<A, E, FileSystem.FileSystem | Path.Path>,
28 + effect: Effect.Effect<
29 + A,
30 + E,
31 + ChildProcessSpawner.ChildProcessSpawner | FileSystem.FileSystem | Path.Path
32 + >,
33 ): Promise<A> => Effect.runPromise(effect.pipe(Effect.provide(NodeServices.layer)));
34
35 const resolveMockAgentPath = Effect.fn("resolveMockAgentPath")(function* () {
@@ -293,6 +298,18 @@ const baseCursorSettings: CursorSettings = {
298 apiEndpoint: "",
299 customModels: [],
300 };
301 +const cursorAcpDiscoveryFailedMessage = [
302 + "Cursor ACP model discovery failed.",
303 + "Cursor CLI setup may be incomplete; install or enable the Cursor CLI, restart T3 Code, and try again.",
304 + "See https://cursor.com/docs/cli/installation.",
305 + "Check server logs for ACP details.",
306 +].join(" ");
307 +const missingCursorBinaryPath = "/definitely/not/installed/t3-cursor-agent";
308 +const cursorCliCommandMissingMessage = [
309 + `Cursor CLI command \`${missingCursorBinaryPath}\` was not found.`,
310 + `Install or enable the Cursor CLI, make sure \`${missingCursorBinaryPath}\` is on PATH, then restart T3 Code.`,
311 + "See https://cursor.com/docs/cli/installation.",
312 +].join(" ");
313
314 describe("getCursorFallbackModels", () => {
315 it("does not publish any built-in cursor models before ACP discovery", () => {
@@ -338,12 +355,11 @@ describe("buildCursorProviderSnapshot", () => {
355 auth: { status: "unauthenticated" },
356 message: "Cursor Agent is not authenticated. Run `agent login` and try again.",
357 },
341 - discoveryWarning: "Cursor ACP model discovery failed. Check server logs for details.",
358 + discoveryWarning: cursorAcpDiscoveryFailedMessage,
359 }),
360 ).toMatchObject({
361 status: "error",
345 - message:
346 - "Cursor Agent is not authenticated. Run `agent login` and try again. Cursor ACP model discovery failed. Check server logs for details.",
362 + message: `Cursor Agent is not authenticated. Run \`agent login\` and try again. ${cursorAcpDiscoveryFailedMessage}`,
363 models: [
364 {
365 slug: "claude-sonnet-4-6",
@@ -411,10 +427,28 @@ describe("buildCursorCapabilitiesFromConfigOptions", () => {
427 });
428
429 describe("checkCursorProviderStatus", () => {
430 + it("reports the install docs when the Cursor CLI command is missing", async () => {
431 + const provider = await runNode(
432 + checkCursorProviderStatus({
433 + enabled: true,
434 + binaryPath: missingCursorBinaryPath,
435 + apiEndpoint: "",
436 + customModels: [],
437 + }),
438 + );
439 +
440 + expect(provider).toMatchObject({
441 + installed: false,
442 + status: "error",
443 + auth: { status: "unknown" },
444 + message: cursorCliCommandMissingMessage,
445 + });
446 + });
447 +
448 it("passes the injected environment to ACP model discovery", async () => {
449 const { requestLogPath, wrapperPath } = await runNode(makeProviderStatusEnvFixture());
450
417 - const provider = await Effect.runPromise(
451 + const provider = await runNode(
452 checkCursorProviderStatus(
453 {
454 enabled: true,
@@ -426,7 +460,7 @@ describe("checkCursorProviderStatus", () => {
460 ...process.env,
461 T3_ACP_REQUEST_LOG_PATH: requestLogPath,
462 },
429 - ).pipe(Effect.provide(NodeServices.layer)),
463 + ),
464 );
465
466 expect(provider.models.map((model) => model.slug)).toEqual([
@@ -443,13 +477,13 @@ describe("discoverCursorModelsViaAcp", () => {
477 it("keeps the ACP probe runtime alive long enough to discover models", async () => {
478 const wrapperPath = await runNode(makeMockAgentWrapper());
479
446 - const models = await Effect.runPromise(
480 + const models = await runNode(
481 discoverCursorModelsViaAcp({
482 enabled: true,
483 binaryPath: wrapperPath,
484 apiEndpoint: "",
485 customModels: [],
452 - }).pipe(Effect.provide(NodeServices.layer), Effect.scoped),
486 + }).pipe(Effect.scoped),
487 );
488
489 expect(models.map((model) => model.slug)).toEqual([
@@ -465,13 +499,13 @@ describe("discoverCursorModelsViaAcp", () => {
499 makeExitLogFixture("cursor-provider-exit-log-"),
500 );
501
468 - await Effect.runPromise(
502 + await runNode(
503 discoverCursorModelsViaAcp({
504 enabled: true,
505 binaryPath: wrapperPath,
506 apiEndpoint: "",
507 customModels: [],
474 - }).pipe(Effect.provide(NodeServices.layer)),
508 + }),
509 );
510
511 const exitLog = await runNode(waitForFileContent(exitLogPath));
apps/server/src/provider/Layers/CursorProvider.ts
+17 -2
@@ -62,6 +62,13 @@ const EMPTY_CAPABILITIES: ModelCapabilities = createModelCapabilities({
62
63 const CURSOR_ACP_MODEL_DISCOVERY_TIMEOUT_MS = 15_000;
64 const CURSOR_PARAMETERIZED_MODEL_PICKER_MIN_VERSION_DATE = 2026_04_08;
65 +const CURSOR_CLI_INSTALLATION_DOCS_URL = "https://cursor.com/docs/cli/installation";
66 +const CURSOR_ACP_MODEL_DISCOVERY_FAILED_MESSAGE = [
67 + "Cursor ACP model discovery failed.",
68 + "Cursor CLI setup may be incomplete; install or enable the Cursor CLI, restart T3 Code, and try again.",
69 + `See ${CURSOR_CLI_INSTALLATION_DOCS_URL}.`,
70 + "Check server logs for ACP details.",
71 +].join(" ");
72 export const CURSOR_PARAMETERIZED_MODEL_PICKER_CAPABILITIES = {
73 _meta: {
74 parameterizedModelPicker: true,
@@ -608,6 +615,14 @@ function joinProviderMessages(...messages: ReadonlyArray<string | undefined>): s
615 return parts.length > 0 ? parts.join(" ") : undefined;
616 }
617
618 +function buildCursorCliCommandMissingMessage(binaryPath: string): string {
619 + return [
620 + `Cursor CLI command \`${binaryPath}\` was not found.`,
621 + `Install or enable the Cursor CLI, make sure \`${binaryPath}\` is on PATH, then restart T3 Code.`,
622 + `See ${CURSOR_CLI_INSTALLATION_DOCS_URL}.`,
623 + ].join(" ");
624 +}
625 +
626 export function buildCursorProviderSnapshot(input: {
627 readonly checkedAt: string;
628 readonly cursorSettings: CursorSettings;
@@ -1020,7 +1035,7 @@ export const checkCursorProviderStatus = Effect.fn("checkCursorProviderStatus")(
1035 status: "error",
1036 auth: { status: "unknown" },
1037 message: isCommandMissingCause(error)
1023 - ? "Cursor Agent CLI (`agent`) is not installed or not on PATH."
1038 + ? buildCursorCliCommandMissingMessage(cursorSettings.binaryPath)
1039 : "Failed to execute Cursor Agent CLI health check.",
1040 },
1041 });
@@ -1079,7 +1094,7 @@ export const checkCursorProviderStatus = Effect.fn("checkCursorProviderStatus")(
1094 yield* Effect.logWarning("Cursor ACP model discovery failed", {
1095 errorTag: causeErrorTag(discoveryExit.cause),
1096 });
1082 - discoveryWarning = "Cursor ACP model discovery failed. Check server logs for details.";
1097 + discoveryWarning = CURSOR_ACP_MODEL_DISCOVERY_FAILED_MESSAGE;
1098 } else if (Option.isNone(discoveryExit.value)) {
1099 discoveryWarning = `Cursor ACP model discovery timed out after ${CURSOR_ACP_MODEL_DISCOVERY_TIMEOUT_MS}ms.`;
1100 } else if (discoveryExit.value.value.length === 0) {