Skip to content

Commit 4e2cb26

Browse files
committed
fix: Normalize casing of model display names
1 parent f799cc8 commit 4e2cb26

3 files changed

Lines changed: 58 additions & 3 deletions

File tree

src/CodexAcpServer.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ interface PendingMcpStartupSession {
6666
}
6767

6868
export class CodexAcpServer implements acp.Agent {
69+
private static readonly MODEL_NAME_TOKEN_OVERRIDES: Record<string, string> = {
70+
gpt: "GPT",
71+
mini: "Mini",
72+
codex: "Codex",
73+
};
74+
6975
private readonly codexAcpClient: CodexAcpClient;
7076
private readonly connection: acp.AgentSideConnection;
7177
private readonly defaultAuthRequest: CodexAuthRequest | null;
@@ -403,12 +409,19 @@ export class CodexAcpServer implements acp.Agent {
403409
return models.find(m => m.id === modelId.model);
404410
}
405411

412+
private normalizeModelDisplayName(displayName: string): string {
413+
return displayName
414+
.split("-")
415+
.map((token) => CodexAcpServer.MODEL_NAME_TOKEN_OVERRIDES[token.toLowerCase()] ?? token)
416+
.join("-");
417+
}
418+
406419
private createModelState(availableModels: Model[], selectedModelId: string): SessionModelState {
407420
const allowedModels = availableModels
408421
.flatMap((model) =>
409422
model.supportedReasoningEfforts.map((effort) => ({
410423
modelId: ModelId.fromComponents(model, effort.reasoningEffort).toString(),
411-
name: `${model.displayName} (${effort.reasoningEffort})`,
424+
name: `${this.normalizeModelDisplayName(model.displayName)} (${effort.reasoningEffort})`,
412425
description: `${model.description} ${effort.description}`,
413426
}))
414427
);

src/__tests__/CodexACPAgent/data/model-filtering.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
},
1212
{
1313
"modelId": "other-id[medium]",
14-
"name": "gpt-5.2 (medium)",
14+
"name": "GPT-5.2 (medium)",
1515
"description": "Allowed Default effort."
1616
},
1717
{
@@ -21,7 +21,17 @@
2121
},
2222
{
2323
"modelId": "gpt-4o[medium]",
24-
"name": "gpt-4o (medium)",
24+
"name": "GPT-4o (medium)",
2525
"description": "Allowed. Default effort."
26+
},
27+
{
28+
"modelId": "gpt-5.3-codex[medium]",
29+
"name": "GPT-5.3-Codex (medium)",
30+
"description": "Codex suffix lowercased. Default effort."
31+
},
32+
{
33+
"modelId": "gpt-5.4-mini[medium]",
34+
"name": "GPT-5.4-Mini (medium)",
35+
"description": "Mini suffix lowercased. Default effort."
2636
}
2737
]

src/__tests__/CodexACPAgent/model-filtering.test.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,38 @@ describe("Model filtering", () => {
7777
isDefault: false,
7878
inputModalities: []
7979
},
80+
{
81+
id: "gpt-5.3-codex",
82+
model: "gpt-5.3-codex",
83+
upgrade: null,
84+
upgradeInfo: null,
85+
availabilityNux: null,
86+
displayName: "gpt-5.3-codex",
87+
description: "Codex suffix lowercased.",
88+
hidden: false,
89+
supportedReasoningEfforts: [defaultEffort],
90+
defaultReasoningEffort: "medium",
91+
supportsPersonality: false,
92+
additionalSpeedTiers: [],
93+
isDefault: false,
94+
inputModalities: []
95+
},
96+
{
97+
id: "gpt-5.4-mini",
98+
model: "gpt-5.4-mini",
99+
upgrade: null,
100+
upgradeInfo: null,
101+
availabilityNux: null,
102+
displayName: "gpt-5.4-mini",
103+
description: "Mini suffix lowercased.",
104+
hidden: false,
105+
supportedReasoningEfforts: [defaultEffort],
106+
defaultReasoningEffort: "medium",
107+
supportsPersonality: false,
108+
additionalSpeedTiers: [],
109+
isDefault: false,
110+
inputModalities: []
111+
},
80112
];
81113

82114
vi.spyOn(codexAcpClient, "authRequired").mockResolvedValue(false);

0 commit comments

Comments
 (0)