The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 03:37 UTC
fix(server): text generation no longer runs a disabled provider (#39870)
Julius Marminge committed
Nov 20, 2026 at 12:38 UTC
6f5293fbdca476cddbc37466450983ba1dd2ada2
2 files changed
+25
-5
apps/server/src/textGeneration/CodexTextGeneration.test.ts
+16
-5
@@ -664,6 +664,8 @@ const PREFLIGHT_PRIMARY_STATES = [
664
"signed out, fallback failed",
665
"cannot generate text",
666
"model cannot generate text",
667
+ "disabled",
668
+ "disabled, fallback disabled for project",
669
] as const;
670
671
it.effect.each(PREFLIGHT_PRIMARY_STATES)("text generation preflight: %s", (primaryState) =>
@@ -724,6 +726,9 @@ it.effect.each(PREFLIGHT_PRIMARY_STATES)("text generation preflight: %s", (prima
726
],
727
}
728
: {}),
729
+ ...(primaryState.startsWith("disabled") && instanceId === primary
730
+ ? { enabled: false, status: "disabled" }
731
+ : {}),
732
...(primaryState === "exhausted" && instanceId === primary
733
? {
734
usageLimits: {
@@ -771,7 +776,7 @@ it.effect.each(PREFLIGHT_PRIMARY_STATES)("text generation preflight: %s", (prima
776
},
777
},
778
defaultModelSelection: threadDefault,
774
- ...(primaryState === "not installed, fallback disabled for project"
779
+ ...(primaryState.endsWith("fallback disabled for project")
780
? {
781
projectSettingsOverrides: {
782
[projectId]: { providerInstances: { [fallback]: { enabled: false } } },
@@ -787,15 +792,21 @@ it.effect.each(PREFLIGHT_PRIMARY_STATES)("text generation preflight: %s", (prima
792
),
793
),
794
);
790
- expect(
791
- yield* service.generateThreadTitle({
795
+ const generated = yield* service
796
+ .generateThreadTitle({
797
cwd: "/tmp",
798
message: "hello",
799
linkedContext: "",
800
modelSelection: selection,
801
projectId,
797
- }),
798
- ).toEqual({ title: "Generated title" });
802
+ })
803
+ .pipe(Effect.exit);
804
+ if (primaryState === "disabled, fallback disabled for project") {
805
+ expect(Exit.isFailure(generated)).toBe(true);
806
+ expect(calls).toEqual([]);
807
+ return;
808
+ }
809
+ expect(generated).toEqual(Exit.succeed({ title: "Generated title" }));
810
expect(calls).toEqual([
811
primaryState === "ready" ||
812
primaryState === "pending" ||
apps/server/src/textGeneration/TextGeneration.ts
+9
@@ -104,9 +104,11 @@ export const make = Effect.gen(function* () {
104
);
105
const now = DateTime.toEpochMillis(yield* DateTime.now);
106
const selected = snapshots.find((provider) => provider.instanceId === selection.instanceId);
107
+ const selectedDisabled = selected?.enabled === false;
108
// Only a failed probe counts: a pending one is also not installed yet.
109
const unusable =
110
textGeneratorCannotRun ||
111
+ selectedDisabled ||
112
(selected?.enabled === true &&
113
(!isProviderTextGenerationCapable(selected) ||
114
selected.models.find((model) => model.slug === selection.model)
@@ -152,6 +154,13 @@ export const make = Effect.gen(function* () {
154
"Review guides need a coding agent that can read the checkout. None is ready. Pick Codex or Claude as the review guide model in Settings → Source control & issues.",
155
});
156
}
157
+ if (selectedDisabled && selection.instanceId === selected.instanceId) {
158
+ return yield* new TextGenerationError({
159
+ operation,
160
+ detail:
161
+ "No text generation provider is available. Enable a provider that can generate text in Settings → Providers.",
162
+ });
163
+ }
164
return yield* installationGate.execute(
165
selection.instanceId,
166
resolveInstance(registry, operation, selection.instanceId).pipe(