Skip to content

Commit dabdbb5

Browse files
medric-zclaude
andcommitted
fix(server): skip text generation fallbacks whose probe failed
A fallback candidate whose health check failed, such as a Claude version probe that timed out, reports installed with status "error" and unknown auth. The candidate filter accepted it, so text generation could switch to a provider that cannot run instead of a later healthy one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 0fed5a7 commit dabdbb5

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ const PREFLIGHT_PRIMARY_STATES = [
450450
"exhausted",
451451
"not installed",
452452
"signed out",
453+
"signed out, fallback failed",
453454
] as const;
454455

455456
it.effect.each(PREFLIGHT_PRIMARY_STATES)("text generation preflight: %s", (primaryState) =>
@@ -482,9 +483,12 @@ it.effect.each(PREFLIGHT_PRIMARY_STATES)("text generation preflight: %s", (prima
482483
...(primaryState === "not installed" && instanceId === primary
483484
? { installed: false, status: "error", auth: { status: "unknown" } }
484485
: {}),
485-
...(primaryState === "signed out" && instanceId === primary
486+
...(primaryState.startsWith("signed out") && instanceId === primary
486487
? { status: "error", auth: { status: "unauthenticated" } }
487488
: {}),
489+
...(primaryState === "signed out, fallback failed" && instanceId === fallback
490+
? { status: "error", auth: { status: "unknown" } }
491+
: {}),
488492
...(primaryState === "exhausted" && instanceId === primary
489493
? {
490494
usageLimits: {
@@ -543,7 +547,9 @@ it.effect.each(PREFLIGHT_PRIMARY_STATES)("text generation preflight: %s", (prima
543547
}),
544548
).toEqual({ title: "Generated title" });
545549
expect(calls).toEqual([
546-
primaryState === "ready" || primaryState === "pending"
550+
primaryState === "ready" ||
551+
primaryState === "pending" ||
552+
primaryState === "signed out, fallback failed"
547553
? selection
548554
: {
549555
instanceId: fallback,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ export const make = Effect.gen(function* () {
114114
resolveProjectProviderInstanceEnabled(settings, null, instanceId) &&
115115
provider.installed &&
116116
provider.auth.status !== "unauthenticated" &&
117+
provider.status !== "error" &&
117118
isProviderAvailable(provider) &&
118119
isProviderTextGenerationCapable(provider) &&
119120
(operation !== "generateReviewGuide" || INVESTIGATING_DRIVERS.has(driver)) &&

0 commit comments

Comments
 (0)