Skip to content

Commit 13069a5

Browse files
only21milclaude
andcommitted
fix(server): text generation skips a saved provider that cannot generate text
A provider snapshot with supportsTextGeneration: false was only skipped when picking a fallback. A saved selection that already pointed at it, such as Pi whose launch arguments name an extension-only provider, still dispatched there and failed. The dispatch gate now treats that snapshot as unusable and uses the existing fallback. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent f68ddf0 commit 13069a5

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

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

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

552553
it.effect.each(PREFLIGHT_PRIMARY_STATES)("text generation preflight: %s", (primaryState) =>
@@ -586,6 +587,9 @@ it.effect.each(PREFLIGHT_PRIMARY_STATES)("text generation preflight: %s", (prima
586587
...(primaryState === "signed out, fallback failed" && instanceId === fallback
587588
? { status: "error", auth: { status: "unknown" } }
588589
: {}),
590+
...(primaryState === "cannot generate text" && instanceId === primary
591+
? { supportsTextGeneration: false }
592+
: {}),
589593
...(primaryState === "exhausted" && instanceId === primary
590594
? {
591595
usageLimits: {

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,9 @@ export const make = Effect.gen(function* () {
111111
const unusable =
112112
textGeneratorCannotRun ||
113113
(selected?.enabled === true &&
114-
selected.status === "error" &&
115-
(!selected.installed || selected.auth.status === "unauthenticated"));
114+
(!isProviderTextGenerationCapable(selected) ||
115+
(selected.status === "error" &&
116+
(!selected.installed || selected.auth.status === "unauthenticated"))));
116117
if (unusable || exhaustedUsageWindow(selected, now, selection.model)) {
117118
const settings = yield* serverSettings.getSettings.pipe(
118119
Effect.mapError(

0 commit comments

Comments
 (0)