Skip to content

Commit 38f8a81

Browse files
lidge-junjun
andauthored
fix(cursor): keep the cursor/ slug in the picker for unbranded rows (#3330)
#3222 seeded a display label for every Cursor row, so the Codex picker lost the cursor/ prefix: cursor/kimi-k3 rendered as "Kimi K3", indistinguishable from the same model under another provider. Publish only the labels that carry Cursor's own product name (Cursor Grok 4.5/4.6); every other row keeps the routed cursor/<id> slug like its siblings from other providers. Operator modelDisplayNames still win; enrich remains per-model fill-only. Co-authored-by: jun <[email protected]>
1 parent ff1ac6b commit 38f8a81

2 files changed

Lines changed: 45 additions & 20 deletions

File tree

‎src/adapters/cursor/discovery.ts‎

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,14 +332,27 @@ export const CURSOR_STATIC_MODELS: readonly CursorModelInfo[] = normalizeCursorM
332332
...CURSOR_REAL_ID_EXCEPTIONS,
333333
]);
334334

335-
/** Picker labels for every seeded row, for providers.cursor.modelDisplayNames. */
335+
/**
336+
* Picker labels for providers.cursor.modelDisplayNames.
337+
*
338+
* Only labels that carry Cursor's own product name ("Cursor Grok 4.6") are published. Every
339+
* other row keeps the routed `cursor/<id>` slug that the rest of the picker uses, so a Cursor
340+
* row reads like its siblings from other providers instead of an unprefixed marketing name.
341+
* #3222 labeled every row and that dropped the `cursor/` prefix from the picker.
342+
*/
336343
export function cursorModelDisplayNames(): Record<string, string> {
337-
return Object.fromEntries([
344+
const labels: (readonly [string, string])[] = [
338345
...CURSOR_ROUTER_MODEL_IDS.map(id => [id, CURSOR_ROUTER_DISPLAY_NAMES[id] ?? id] as const),
339346
...cursorUmbrellaRows().map(row => [row.id, row.displayName] as const),
340347
...CURSOR_PRODUCT_MODELS.map(model => [model.id, model.displayName] as const),
341348
...CURSOR_REAL_ID_EXCEPTIONS.map(model => [model.id, model.displayName] as const),
342-
]);
349+
];
350+
return Object.fromEntries(labels.filter(([, label]) => isCursorBrandedLabel(label)));
351+
}
352+
353+
/** A label Cursor itself brands with its name, e.g. "Cursor Grok 4.6". */
354+
export function isCursorBrandedLabel(label: string): boolean {
355+
return /^cursor\b/i.test(label.trim());
343356
}
344357

345358
export function cursorModelIds(models: readonly CursorModelInfo[] = CURSOR_STATIC_MODELS): string[] {

‎tests/cursor-display-names.test.ts‎

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
import { describe, expect, test } from "bun:test";
2-
import { cursorModelDisplayNames } from "../src/adapters/cursor/discovery";
2+
import { cursorModelDisplayNames, CURSOR_STATIC_MODELS, isCursorBrandedLabel } from "../src/adapters/cursor/discovery";
33
import { cursorUmbrellaRows } from "../src/adapters/cursor/catalog";
44
import { enrichProviderFromRegistry, providerConfigSeed } from "../src/providers/derive";
55
import { getProviderRegistryEntry } from "../src/providers/registry";
66
import { configuredModelDisplayName } from "../src/codex/catalog/provider-fetch";
77
import type { OcxProviderConfig } from "../src/types";
88

99
/**
10-
* The Codex picker showed raw slugs (`cursor/kimi-k3`) because `routedDisplayName`
11-
* (codex/catalog/sync.ts) passes a routed slug through unchanged, and nothing carried
12-
* Cursor's labels into `providers.cursor.modelDisplayNames` — the registry entry type had
13-
* no such field. These assert the full registry -> config -> catalog-hint path, not just
14-
* that a label table exists (devlog 260902_cursor_unified_identity).
10+
* `routedDisplayName` (codex/catalog/sync.ts) passes a routed slug through unchanged, so a
11+
* Cursor row reads `cursor/kimi-k3` like every other provider's rows. #3222 labeled every
12+
* seeded row and the picker lost its `cursor/` prefix, which made Cursor rows
13+
* indistinguishable from the same model under another provider. Only labels that carry
14+
* Cursor's own brand ("Cursor Grok 4.6") are published; the rest keep the routed slug.
15+
* These assert the full registry -> config -> catalog-hint path, not just that a label
16+
* table exists.
1517
*/
1618
describe("cursor picker labels reach the catalog", () => {
1719
const cursorEntry = () => {
@@ -20,24 +22,33 @@ describe("cursor picker labels reach the catalog", () => {
2022
return entry;
2123
};
2224

23-
test("the registry entry carries a label for every seeded row", () => {
25+
test("the registry entry labels only Cursor-branded rows", () => {
2426
const labels = cursorModelDisplayNames();
2527
expect(cursorEntry().modelDisplayNames).toEqual(labels);
28+
const seededIds = new Set(CURSOR_STATIC_MODELS.map(model => model.id));
29+
for (const [id, label] of Object.entries(labels)) {
30+
expect(seededIds.has(id)).toBe(true);
31+
expect(isCursorBrandedLabel(label)).toBe(true);
32+
}
2633
for (const row of cursorUmbrellaRows()) {
27-
expect(labels[row.id]).toBe(row.displayName);
34+
if (isCursorBrandedLabel(row.displayName)) expect(labels[row.id]).toBe(row.displayName);
35+
else expect(labels).not.toHaveProperty(row.id);
2836
}
29-
// The label is a human name, never the id echoed back.
30-
expect(labels["kimi-k3"]).toBe("Kimi K3");
37+
// Cursor's own product name stays; a third-party model keeps its `cursor/<id>` slug.
3138
expect(labels["grok-4.6"]).toBe("Cursor Grok 4.6");
32-
expect(labels["claude-opus-5"]).toBe("Claude Opus 5");
33-
expect(labels.auto).toBe("Auto");
39+
expect(labels["grok-4.5"]).toBe("Cursor Grok 4.5");
40+
expect(labels).not.toHaveProperty("kimi-k3");
41+
expect(labels).not.toHaveProperty("claude-opus-5");
42+
expect(labels).not.toHaveProperty("auto");
43+
expect(labels).not.toHaveProperty("composer-2.5");
3444
});
3545

36-
test("a fresh seed exposes the labels through configuredModelDisplayName", () => {
46+
test("a fresh seed exposes only the branded labels through configuredModelDisplayName", () => {
3747
const seeded = providerConfigSeed(cursorEntry());
38-
expect(configuredModelDisplayName(seeded, "kimi-k3")).toBe("Kimi K3");
39-
expect(configuredModelDisplayName(seeded, "claude-4-sonnet-1m")).toBe("Claude Sonnet 4 (1M)");
40-
expect(configuredModelDisplayName(seeded, "composer-2.5-fast")).toBe("Composer 2.5 Fast");
48+
expect(configuredModelDisplayName(seeded, "grok-4.6")).toBe("Cursor Grok 4.6");
49+
expect(configuredModelDisplayName(seeded, "kimi-k3")).toBeUndefined();
50+
expect(configuredModelDisplayName(seeded, "claude-4-sonnet-1m")).toBeUndefined();
51+
expect(configuredModelDisplayName(seeded, "composer-2.5-fast")).toBeUndefined();
4152
});
4253

4354
test("enrich backfills an existing install per model, preserving operator renames", () => {
@@ -49,7 +60,8 @@ describe("cursor picker labels reach the catalog", () => {
4960
enrichProviderFromRegistry("cursor", existing);
5061
// Operator value survives...
5162
expect(configuredModelDisplayName(existing, "kimi-k3")).toBe("My K3");
52-
// ...while every other row still gains its label instead of staying unlabeled.
63+
// ...the branded row gains its label, and an unbranded row stays on its routed slug.
5364
expect(configuredModelDisplayName(existing, "grok-4.6")).toBe("Cursor Grok 4.6");
65+
expect(configuredModelDisplayName(existing, "claude-opus-5")).toBeUndefined();
5466
});
5567
});

0 commit comments

Comments
 (0)