Skip to content

Commit ef68bd1

Browse files
author
jun
committed
fix(cursor): filter the prediction table by catalog visibility
The status route built its Model/Reasoning/Context prediction from the unfiltered catalog, so a model disabled in opencodex still appeared in the dashboard while the raw /v1/models list Cursor reads omitted it. Apply the same filterCatalogVisibleModels pass; regression test drives both endpoints with a disabled model.
1 parent b9e9974 commit ef68bd1

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

‎src/server/management/cursor-integration-routes.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* started — plus which active models will show Cursor's Reasoning and Context controls.
1010
*/
1111
import { readRuntimePort } from "../../config/process-state";
12-
import { nativeContextLimits, nativeOpenAiContextTier, uniqueCatalogModelsForRawPublicList, visibleNativeSlugs } from "../../codex/catalog";
12+
import { filterCatalogVisibleModels, nativeContextLimits, nativeOpenAiContextTier, uniqueCatalogModelsForRawPublicList, visibleNativeSlugs } from "../../codex/catalog";
1313
import { cursorLastSeen, type CursorSeen } from "../../integrations/cursor-seen";
1414
import { detectCursorInstalls, type CursorInstall } from "../../integrations/cursor-detect";
1515
import { configuredApiAuthToken, isApiAuthRequired, jsonResponse } from "../auth-cors";
@@ -55,7 +55,9 @@ export async function buildCursorIntegrationStatus(
5555
const apiKeyMode = isApiAuthRequired(config) || credentialConfigured ? "credential" : "placeholder";
5656

5757
const limits = nativeContextLimits(config);
58-
const goModels = await fetchAllModels(config);
58+
// Same visibility rules as the raw /v1/models list Cursor will read: disabled models and
59+
// provider allowlists drop out here too, or the prediction shows rows Cursor never gets.
60+
const goModels = filterCatalogVisibleModels(await fetchAllModels(config), config);
5961
const ids = [
6062
...visibleNativeSlugs(config),
6163
...uniqueCatalogModelsForRawPublicList(goModels).map(model => model.alias ?? `${model.provider}/${model.id}`),

‎tests/cursor-integration-status.test.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,4 +187,21 @@ describe("GET /api/native-integrations/cursor", () => {
187187
await server.stop(true);
188188
}
189189
});
190+
191+
test("a disabled model leaves the prediction the same way it leaves /v1/models", async () => {
192+
seedCodexModelEntitlementsForTests("main", ["gpt-5.6-sol"]);
193+
saveConfig({ ...statusConfig(), disabledModels: ["kimi/k3"] });
194+
const server = startServer(0);
195+
try {
196+
const adminToken = readFileSync(join(testHome, "admin-api-token"), "utf8").trim();
197+
const status = await fetch(new URL("/api/native-integrations/cursor", server.url), { headers: { "x-opencodex-api-key": adminToken } });
198+
const body = await status.json() as { models: Array<{ id: string }> };
199+
expect(body.models.some(model => model.id === "kimi/k3")).toBe(false);
200+
const raw = await fetch(new URL("/v1/models", server.url), { headers: { "user-agent": "Cursor/3.18.25" } });
201+
const list = await raw.json() as { data: Array<{ id: string }> };
202+
expect(list.data.some(model => model.id === "kimi/k3")).toBe(false);
203+
} finally {
204+
await server.stop(true);
205+
}
206+
});
190207
});

0 commit comments

Comments
 (0)