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 22, 19:30 UTC
fix(server): failed provider updates say why (#22506)
Koushik_xd committed
Oct 22, 2026 at 02:40 UTC
f08781009f741891a263772ec959e38f69fefccf
2 files changed
+59
-7
apps/server/src/provider/providerMaintenanceRunner.test.ts
+32
-3
@@ -454,14 +454,43 @@ describe("providerMaintenanceRunner", () => {
454
const updateState = result.providers[0]?.updateState;
455
456
assert.strictEqual(updateState?.status, "failed");
457
- assert.strictEqual(updateState?.message, "Update command exited with code 1.");
458
- assert.include(updateState?.output ?? "", "permission denied");
457
+ assert.strictEqual(
458
+ updateState?.message,
459
+ "Update command exited with code 1: Error: Could not detect the Codex installation method.",
460
+ );
461
+ assert.include(updateState?.output ?? "", "checking install");
462
+ }).pipe(
463
+ Effect.provide(
464
+ Layer.mergeAll(
465
+ layerNonWindowsPlatform,
466
+ layerLatestVersionHttpClient("0.0.0"),
467
+ layerMockSpawner(() => ({
468
+ stdout: "checking install\n",
469
+ stderr: "Error: Could not detect the Codex installation method.\n\n",
470
+ code: 1,
471
+ })),
472
+ ),
473
+ ),
474
+ ),
475
+ );
476
+
477
+ it.effect("keeps the exit code message when a failed command prints nothing", () =>
478
+ Effect.gen(function* () {
479
+ const { registry } = yield* makeRegistry();
480
+ const updater = yield* makeTestRunner(registry);
481
+
482
+ const result = yield* updater.updateProvider(CODEX_DRIVER);
483
+
484
+ assert.strictEqual(
485
+ result.providers[0]?.updateState?.message,
486
+ "Update command exited with code 1.",
487
+ );
488
}).pipe(
489
Effect.provide(
490
Layer.mergeAll(
491
layerNonWindowsPlatform,
492
layerLatestVersionHttpClient("0.0.0"),
464
- layerMockSpawner(() => ({ stderr: "permission denied", code: 1 })),
493
+ layerMockSpawner(() => ({ code: 1 })),
494
),
495
),
496
),
apps/server/src/provider/providerMaintenanceRunner.ts
+27
-4
@@ -242,14 +242,30 @@ function commandOutput(result: ProviderMaintenanceCommandResult): string | null
242
return truncateText(output, UPDATE_OUTPUT_MAX_BYTES);
243
}
244
245
+// Updaters print their reason last, usually on stderr.
246
+function lastOutputLine(result: ProviderMaintenanceCommandResult): string | null {
247
+ for (const output of [result.stderr, result.stdout]) {
248
+ const line = output
249
+ .split(/\r\n|\r|\n/)
250
+ .map(toProgressLine)
251
+ .findLast(Boolean);
252
+ if (line) {
253
+ return line;
254
+ }
255
+ }
256
+ return null;
257
+}
258
+
259
function failureMessage(result: ProviderMaintenanceCommandResult): string {
260
if (result.timedOut) {
261
return "Update timed out.";
262
}
249
- if (result.exitCode !== null && result.exitCode !== 0) {
250
- return `Update command exited with code ${result.exitCode}.`;
251
- }
252
- return "Update command failed.";
263
+ const summary =
264
+ result.exitCode !== null && result.exitCode !== 0
265
+ ? `Update command exited with code ${result.exitCode}`
266
+ : "Update command failed";
267
+ const reason = lastOutputLine(result);
268
+ return reason ? `${summary}: ${reason}` : `${summary}.`;
269
}
270
271
function isOutdatedProvider(provider: ServerProvider | undefined): boolean {
@@ -474,6 +490,13 @@ export const make = Effect.fn("ProviderMaintenanceRunner.make")(function* () {
490
const result = yield* runMaintenanceCommand(command, setRunningMessage);
491
const finishedAt = yield* nowIso;
492
if (result.timedOut || result.exitCode !== 0) {
493
+ yield* Effect.logWarning("Provider update command failed", {
494
+ provider,
495
+ command: describeCommand(command),
496
+ exitCode: result.exitCode,
497
+ timedOut: result.timedOut,
498
+ output: commandOutput(result),
499
+ });
500
return yield* finish(
501
makeUpdateState({
502
status: "failed",