The best way to control Claude Code, Codex and more from any computer or phone
fix(server): thread titles no longer fail when the text generation provider can't run (#29607)
Co-authored-by: medric-z <180440015+medric-z@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
medric committed
Nov 6, 2026 at 07:30 UTC
6b84d2caaebb9d2528841f252ba1a304cfb0867f
2 files changed
+37
-12
apps/server/src/textGeneration/CodexTextGeneration.test.ts
+29
-6
@@ -519,7 +519,16 @@ it.layer(layerCodexTextGenerationTest)("CodexTextGeneration", (it) => {
519
);
520
});
521
522
-it.effect.each([false, true])("text generation preflight: exhausted=%s", (exhausted) =>
522
+const PREFLIGHT_PRIMARY_STATES = [
523
+ "ready",
524
+ "pending",
525
+ "exhausted",
526
+ "not installed",
527
+ "signed out",
528
+ "signed out, fallback failed",
529
+] as const;
530
+
531
+it.effect.each(PREFLIGHT_PRIMARY_STATES)("text generation preflight: %s", (primaryState) =>
532
Effect.gen(function* () {
533
const primary = ProviderInstanceId.make("codex");
534
const fallback = ProviderInstanceId.make("claude_work");
@@ -543,7 +552,19 @@ it.effect.each([false, true])("text generation preflight: exhausted=%s", (exhaus
552
models: [],
553
slashCommands: [],
554
skills: [],
546
- ...(exhausted && instanceId === primary
555
+ ...(primaryState === "pending" && instanceId === primary
556
+ ? { installed: false, status: "warning", auth: { status: "unknown" } }
557
+ : {}),
558
+ ...(primaryState === "not installed" && instanceId === primary
559
+ ? { installed: false, status: "error", auth: { status: "unknown" } }
560
+ : {}),
561
+ ...(primaryState.startsWith("signed out") && instanceId === primary
562
+ ? { status: "error", auth: { status: "unauthenticated" } }
563
+ : {}),
564
+ ...(primaryState === "signed out, fallback failed" && instanceId === fallback
565
+ ? { status: "error", auth: { status: "unknown" } }
566
+ : {}),
567
+ ...(primaryState === "exhausted" && instanceId === primary
568
? {
569
usageLimits: {
570
checkedAt: "1970-01-01T00:00:00Z",
@@ -602,13 +623,15 @@ it.effect.each([false, true])("text generation preflight: exhausted=%s", (exhaus
623
}),
624
).toEqual({ title: "Generated title" });
625
expect(calls).toEqual([
605
- exhausted
606
- ? {
626
+ primaryState === "ready" ||
627
+ primaryState === "pending" ||
628
+ primaryState === "signed out, fallback failed"
629
+ ? selection
630
+ : {
631
instanceId: fallback,
632
model:
633
DEFAULT_TEXT_GENERATION_MODEL_BY_PROVIDER[ProviderDriverKind.make("claudeAgent")],
610
- }
611
- : selection,
634
+ },
635
]);
636
}),
637
);
apps/server/src/textGeneration/TextGeneration.ts
+8
-6
@@ -89,12 +89,13 @@ export const make = Effect.gen(function* () {
89
),
90
);
91
const now = DateTime.toEpochMillis(yield* DateTime.now);
92
- const limited = exhaustedUsageWindow(
93
- snapshots.find((provider) => provider.instanceId === selection.instanceId),
94
- now,
95
- selection.model,
96
- );
97
- if (limited) {
92
+ const selected = snapshots.find((provider) => provider.instanceId === selection.instanceId);
93
+ // Only a failed probe counts: a pending one is also not installed yet.
94
+ const unusable =
95
+ selected?.enabled === true &&
96
+ selected.status === "error" &&
97
+ (!selected.installed || selected.auth.status === "unauthenticated");
98
+ if (unusable || exhaustedUsageWindow(selected, now, selection.model)) {
99
const settings = yield* serverSettings.getSettings.pipe(
100
Effect.mapError(
101
(cause) =>
@@ -116,6 +117,7 @@ export const make = Effect.gen(function* () {
117
resolveProjectProviderInstanceEnabled(settings, null, instanceId) &&
118
provider.installed &&
119
provider.auth.status !== "unauthenticated" &&
120
+ provider.status !== "error" &&
121
isProviderAvailable(provider) &&
122
isProviderTextGenerationCapable(provider) &&
123
(operation !== "generateReviewGuide" || INVESTIGATING_DRIVERS.has(driver)) &&