Skip to content

Commit fab45e1

Browse files
fix(server): text generation skips a saved model the provider cannot run
A selection saved before a model was marked unusable for text generation now falls back like an incapable provider does. AI-assisted; verified with the tests and tools listed above. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent cd85b8c commit fab45e1

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

‎apps/server/src/textGeneration/CodexTextGeneration.test.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,7 @@ const PREFLIGHT_PRIMARY_STATES = [
547547
"signed out",
548548
"signed out, fallback failed",
549549
"cannot generate text",
550+
"model cannot generate text",
550551
] as const;
551552

552553
it.effect.each(PREFLIGHT_PRIMARY_STATES)("text generation preflight: %s", (primaryState) =>
@@ -594,6 +595,19 @@ it.effect.each(PREFLIGHT_PRIMARY_STATES)("text generation preflight: %s", (prima
594595
...(primaryState === "cannot generate text" && instanceId === primary
595596
? { supportsTextGeneration: false }
596597
: {}),
598+
...(primaryState === "model cannot generate text" && instanceId === primary
599+
? {
600+
models: [
601+
{
602+
slug: selection.model,
603+
name: selection.model,
604+
isCustom: false,
605+
supportsTextGeneration: false,
606+
capabilities: null,
607+
},
608+
],
609+
}
610+
: {}),
597611
...(primaryState === "exhausted" && instanceId === primary
598612
? {
599613
usageLimits: {

‎apps/server/src/textGeneration/TextGeneration.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ export const make = Effect.gen(function* () {
109109
textGeneratorCannotRun ||
110110
(selected?.enabled === true &&
111111
(!isProviderTextGenerationCapable(selected) ||
112+
selected.models.find((model) => model.slug === selection.model)
113+
?.supportsTextGeneration === false ||
112114
(selected.status === "error" &&
113115
(!selected.installed || selected.auth.status === "unauthenticated"))));
114116
if (unusable || exhaustedUsageWindow(selected, now, selection.model)) {

0 commit comments

Comments
 (0)