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 23, 03:00 UTC
fix(server): disabled providers no longer report missing executables (#18109)
Ranga Prasath S R committed
Oct 19, 2026 at 01:22 UTC
b497d129ef5021df362a7c30c2d7c4bcf7759969
2 files changed
+167
-22
apps/server/src/mcp/OrchestratorMcpService.test.ts
+160
-20
@@ -798,10 +798,11 @@ describe("OrchestratorMcpService provider resolution", () => {
798
instanceId: input.instanceId,
799
driver: input.driver,
800
enabled: input.enabled ?? true,
801
- installed: true,
802
- version: "test",
803
- status: "ready",
804
- auth: { status: "authenticated" },
801
+ installed: input.enabled !== false,
802
+ version: input.enabled === false ? null : "test",
803
+ status: input.enabled === false ? "disabled" : "ready",
804
+ auth: { status: input.enabled === false ? "unknown" : "authenticated" },
805
+ ...(input.enabled === false ? { message: "Provider is disabled in T3 Code settings." } : {}),
806
checkedAt: "2026-09-13T00:00:00.000Z",
807
models:
808
input.model === undefined
@@ -882,6 +883,7 @@ describe("OrchestratorMcpService provider resolution", () => {
883
() =>
884
Effect.gen(function* () {
885
const disabledAntigravityInstanceId = ProviderInstanceId.make("antigravity-alt");
886
+ const disabledWithoutAdapterInstanceId = ProviderInstanceId.make("codex-without-adapter");
887
const forkOnlyInstanceId = ProviderInstanceId.make("forkOnly");
888
const forkShadow = yield* buildUnavailableProviderSnapshot({
889
driverKind: "forkOnly",
@@ -921,6 +923,12 @@ describe("OrchestratorMcpService provider resolution", () => {
923
model: "ant-model",
924
enabled: false,
925
}),
926
+ providerSnapshot({
927
+ instanceId: disabledWithoutAdapterInstanceId,
928
+ driver: ProviderDriverKind.make("codex"),
929
+ model: "gpt-5.4",
930
+ enabled: false,
931
+ }),
932
forkShadow,
933
];
934
const layerDependencies = Layer.mergeAll(
@@ -1000,18 +1008,27 @@ describe("OrchestratorMcpService provider resolution", () => {
1008
const disabled = byId.get(disabledAntigravityInstanceId);
1009
assert.isDefined(disabled);
1010
assert.isFalse(disabled!.canRunChildTask);
1011
+ assert.isFalse(disabled!.canRunCrossProviderChildTask);
1012
assert.deepEqual(disabled!.constraints, ["Provider instance is disabled."]);
1013
1014
+ const disabledWithoutAdapter = byId.get(disabledWithoutAdapterInstanceId);
1015
+ assert.isDefined(disabledWithoutAdapter);
1016
+ assert.isFalse(disabledWithoutAdapter!.canRunChildTask);
1017
+ assert.isFalse(disabledWithoutAdapter!.canRunCrossProviderChildTask);
1018
+ assert.deepEqual(disabledWithoutAdapter!.constraints, [
1019
+ "No V2 provider adapter is registered.",
1020
+ "Provider instance is disabled.",
1021
+ ]);
1022
+
1023
const fork = byId.get(forkOnlyInstanceId);
1024
assert.isDefined(fork);
1025
assert.isFalse(fork!.canRunChildTask);
1008
- assert.isTrue(
1009
- fork!.constraints.includes("No V2 provider adapter is registered."),
1010
- `expected missing-adapter constraint, got ${fork!.constraints.join(" | ")}`,
1011
- );
1012
- assert.isTrue(
1013
- fork!.constraints.includes("Driver 'forkOnly' is not registered in this build."),
1014
- );
1026
+ assert.isFalse(fork!.canRunCrossProviderChildTask);
1027
+ assert.deepEqual(fork!.constraints, [
1028
+ "No V2 provider adapter is registered.",
1029
+ "Driver 'forkOnly' is not registered in this build.",
1030
+ "Provider instance is disabled.",
1031
+ ]);
1032
}).pipe(Effect.provide(layerOrchestratorService.pipe(Layer.provide(layerDependencies))));
1033
}),
1034
);
@@ -1060,6 +1077,85 @@ describe("OrchestratorMcpService provider resolution", () => {
1077
}),
1078
);
1079
1080
+ it.effect.each([
1081
+ {
1082
+ name: "installation",
1083
+ snapshot: { installed: false, version: null, status: "warning", auth: { status: "unknown" } },
1084
+ constraints: ["Provider executable is not installed."],
1085
+ },
1086
+ {
1087
+ name: "health",
1088
+ snapshot: { status: "error", message: "Provider health check failed." },
1089
+ constraints: ["Provider health check failed."],
1090
+ },
1091
+ {
1092
+ name: "authentication",
1093
+ snapshot: { auth: { status: "unauthenticated" } },
1094
+ constraints: ["Provider is not authenticated."],
1095
+ },
1096
+ {
1097
+ name: "combined installation and health",
1098
+ snapshot: {
1099
+ installed: false,
1100
+ version: null,
1101
+ status: "error",
1102
+ message: "Provider executable could not be found.",
1103
+ auth: { status: "unknown" },
1104
+ },
1105
+ constraints: [
1106
+ "Provider executable is not installed.",
1107
+ "Provider executable could not be found.",
1108
+ ],
1109
+ },
1110
+ {
1111
+ name: "disabled with stale probe failures",
1112
+ snapshot: {
1113
+ enabled: false,
1114
+ installed: false,
1115
+ version: null,
1116
+ status: "error",
1117
+ message: "Stale provider health failure.",
1118
+ auth: { status: "unauthenticated" },
1119
+ },
1120
+ constraints: ["Provider instance is disabled."],
1121
+ },
1122
+ ] as const)("reports $name provider constraints", (testCase) =>
1123
+ Effect.gen(function* () {
1124
+ const provider: ServerProvider = {
1125
+ ...providerSnapshot({
1126
+ instanceId: codexInstanceId,
1127
+ driver: ProviderDriverKind.make("codex"),
1128
+ model: "gpt-5.4",
1129
+ }),
1130
+ ...testCase.snapshot,
1131
+ };
1132
+ const layerDependencies = Layer.mergeAll(
1133
+ NodeServices.layer,
1134
+ Layer.mock(ThreadManagementService.ThreadManagementService)({
1135
+ getThreadRecords: () => Effect.succeed(parentProjection([])),
1136
+ }),
1137
+ ServerSettings.layerTest(),
1138
+ providerRegistryLayer([provider]),
1139
+ adapterRegistryLayer([codexInstanceId]),
1140
+ Layer.mock(ProjectService.ProjectService)({}),
1141
+ Layer.mock(SecretRequests.SecretRequests)({}),
1142
+ Layer.mock(ScheduledTaskService.ScheduledTaskService)({}),
1143
+ );
1144
+
1145
+ yield* Effect.gen(function* () {
1146
+ const service = yield* OrchestratorMcpService.OrchestratorMcpService;
1147
+ const capabilities = yield* service.capabilities(scope);
1148
+ const entry = capabilities.providers.find(
1149
+ (candidate) => candidate.providerInstanceId === codexInstanceId,
1150
+ );
1151
+ assert.isDefined(entry);
1152
+ assert.isFalse(entry!.canRunChildTask);
1153
+ assert.isFalse(entry!.canRunCrossProviderChildTask);
1154
+ assert.deepEqual(entry!.constraints, testCase.constraints);
1155
+ }).pipe(Effect.provide(layerOrchestratorService.pipe(Layer.provide(layerDependencies))));
1156
+ }),
1157
+ );
1158
+
1159
it.effect(
1160
"delegates to an Antigravity instance whose adapter resolves through the registry",
1161
() =>
@@ -1758,6 +1854,22 @@ describe("OrchestratorMcpService provider resolution", () => {
1854
selectedInstanceId: null,
1855
candidateDriver: driver,
1856
},
1857
+ {
1858
+ name: "inherited-unavailable",
1859
+ inheritedEnabled: false,
1860
+ peerEnabled: true,
1861
+ explicit: false,
1862
+ selectedInstanceId: null,
1863
+ candidateDriver: driver,
1864
+ },
1865
+ {
1866
+ name: "explicit-disabled-without-adapter",
1867
+ inheritedEnabled: false,
1868
+ peerEnabled: true,
1869
+ explicit: true,
1870
+ selectedInstanceId: null,
1871
+ candidateDriver: driver,
1872
+ },
1873
{
1874
name: "explicit-healthy",
1875
inheritedEnabled: true,
@@ -1817,7 +1929,11 @@ describe("OrchestratorMcpService provider resolution", () => {
1929
enabled: testCase.peerEnabled,
1930
}),
1931
]),
1820
- adapterRegistryLayer([codexInstanceId, codexAltInstanceId]),
1932
+ adapterRegistryLayer(
1933
+ testCase.name === "explicit-disabled-without-adapter"
1934
+ ? [codexAltInstanceId]
1935
+ : [codexInstanceId, codexAltInstanceId],
1936
+ ),
1937
Layer.mock(ProjectService.ProjectService)({}),
1938
Layer.mock(SecretRequests.SecretRequests)({}),
1939
Layer.mock(ScheduledTaskService.ScheduledTaskService)({}),
@@ -1825,14 +1941,17 @@ describe("OrchestratorMcpService provider resolution", () => {
1941
1942
yield* Effect.gen(function* () {
1943
const service = yield* OrchestratorMcpService.OrchestratorMcpService;
1828
- const target = testCase.explicit
1829
- ? ({
1830
- providerInstanceId:
1831
- testCase.selectedInstanceId === null
1832
- ? codexInstanceId
1833
- : testCase.selectedInstanceId,
1834
- } as const)
1835
- : ({ driverKind: testCase.candidateDriver } as const);
1944
+ const target =
1945
+ testCase.name === "inherited-unavailable"
1946
+ ? undefined
1947
+ : testCase.explicit
1948
+ ? ({
1949
+ providerInstanceId:
1950
+ testCase.selectedInstanceId === null
1951
+ ? codexInstanceId
1952
+ : testCase.selectedInstanceId,
1953
+ } as const)
1954
+ : ({ driverKind: testCase.candidateDriver } as const);
1955
if (testCase.selectedInstanceId === null) {
1956
const error = yield* service
1957
.delegateTask(scope, {
@@ -1843,6 +1962,27 @@ describe("OrchestratorMcpService provider resolution", () => {
1962
})
1963
.pipe(Effect.flip);
1964
assert.equal(error.code, "provider_unavailable", testCase.name);
1965
+ if (
1966
+ testCase.name === "explicit-unavailable" ||
1967
+ testCase.name === "inherited-unavailable" ||
1968
+ testCase.name === "explicit-disabled-without-adapter"
1969
+ ) {
1970
+ const expectedMessage =
1971
+ `Provider ${codexInstanceId} cannot run a child task: ` +
1972
+ (testCase.name === "explicit-disabled-without-adapter"
1973
+ ? "No V2 provider adapter is registered. "
1974
+ : "") +
1975
+ "Provider instance is disabled.";
1976
+ assert.equal(error.message, expectedMessage);
1977
+ const threadError = yield* service
1978
+ .createThreads(scope, {
1979
+ threads: [{ prompt: "Summarize the diff.", target }],
1980
+ clientRequestId: `disabled-threads-${testCase.name}`,
1981
+ })
1982
+ .pipe(Effect.flip);
1983
+ assert.equal(threadError.code, "provider_unavailable");
1984
+ assert.equal(threadError.message, expectedMessage);
1985
+ }
1986
if (testCase.name === "cross-driver-no-available-candidate") {
1987
assert.isTrue(error.message.includes("driver claudeAgent"), testCase.name);
1988
const threadError = yield* service
apps/server/src/mcp/OrchestratorMcpService.ts
+7
-2
@@ -284,11 +284,16 @@ function providerConstraints(
284
constraints.push("No V2 provider adapter is registered.");
285
}
286
if (provider === undefined) return constraints;
287
- if (!provider.enabled) constraints.push("Provider instance is disabled.");
288
- if (!provider.installed) constraints.push("Provider executable is not installed.");
287
+ // Driver availability comes from the registry, even when health probes are skipped.
288
if (!isProviderAvailable(provider)) {
289
constraints.push(provider.unavailableReason ?? "Provider driver is unavailable.");
290
}
291
+ if (!provider.enabled) {
292
+ constraints.push("Provider instance is disabled.");
293
+ // Disabled snapshots contain placeholders for installation, health, and auth.
294
+ return constraints;
295
+ }
296
+ if (!provider.installed) constraints.push("Provider executable is not installed.");
297
if (provider.status === "error" || provider.status === "disabled") {
298
constraints.push(provider.message ?? `Provider status is ${provider.status}.`);
299
}