@devries-cameron20 / t3code-1 / commits / 7f443ab635
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(server): provider updates no longer time out mid-download (#28132)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

ABDUL RAHMAN JAMSHID NASSER AL RASHDI committed Nov 1, 2026 at 06:46 UTC 7f443ab6359dc3771f2c2fed70ce8a7a659e3c21
2 files changed +43 -2
apps/server/src/provider/providerMaintenanceRunner.test.ts
+37
@@ -7,6 +7,7 @@ import {
7 } from "@t3tools/contracts";
8 import { ServerProviderUpdateError } from "@t3tools/contracts";
9 import * as Cause from "effect/Cause";
10 +import * as Deferred from "effect/Deferred";
11 import * as Effect from "effect/Effect";
12 import * as Exit from "effect/Exit";
13 import * as Fiber from "effect/Fiber";
@@ -15,6 +16,7 @@ import * as Ref from "effect/Ref";
16 import * as Schema from "effect/Schema";
17 import * as Sink from "effect/Sink";
18 import * as Stream from "effect/Stream";
19 +import * as TestClock from "effect/testing/TestClock";
20 import { HttpClient, HttpClientResponse } from "effect/http";
21 import { ChildProcessSpawner } from "effect/process";
22 import * as HostProcess from "@t3tools/shared/HostProcess";
@@ -755,6 +757,41 @@ describe("providerMaintenanceRunner", () => {
757 ),
758 );
759
760 + // A native updater such as `claude update` downloads a ~300 MB binary and
761 + // prints nothing while it does. Killed mid-download, it leaves a truncated
762 + // binary behind that later updates mistake for an install.
763 + it.effect.each([
764 + { runFor: "6 minutes", status: "succeeded", message: "Provider updated." },
765 + { runFor: "31 minutes", status: "failed", message: "Update timed out after 30 minutes." },
766 + ] as const)("lets a slow installer run for $runFor", ({ runFor, status, message }) => {
767 + const started = Deferred.makeUnsafe<void>();
768 + return Effect.gen(function* () {
769 + const { registry } = yield* makeRegistry(baseNativeCliProvider);
770 + const updater = yield* makeTestRunner(registry);
771 +
772 + const update = yield* updater.updateProvider(NATIVE_CLI_DRIVER).pipe(Effect.forkScoped);
773 + yield* Deferred.await(started);
774 + yield* TestClock.adjust(runFor);
775 + const result = yield* Fiber.join(update);
776 +
777 + assert.strictEqual(result.providers[0]?.updateState?.status, status);
778 + assert.strictEqual(result.providers[0]?.updateState?.message, message);
779 + }).pipe(
780 + Effect.provide(
781 + Layer.mergeAll(
782 + layerNonWindowsPlatform,
783 + layerLatestVersionHttpClient("1.0.0"),
784 + layerMockSpawner(() => ({
785 + exitCode: Deferred.succeed(started, undefined).pipe(
786 + Effect.andThen(Effect.sleep(runFor)),
787 + Effect.as(ChildProcessSpawner.ExitCode(0)),
788 + ),
789 + })),
790 + ),
791 + ),
792 + );
793 + });
794 +
795 it.effect("prevents concurrent updates for the same provider", () => {
796 const startedLatch: { resolve: () => void } = { resolve: () => {} };
797 const releaseLatch: { resolve: () => void } = { resolve: () => {} };
apps/server/src/provider/providerMaintenanceRunner.ts
+6 -2
@@ -41,7 +41,11 @@ import type { ProviderMaintenanceCapabilities } from "@t3tools/provider-core/ser
41 import { collectUint8StreamText } from "@t3tools/provider-core/server/collectStreamText";
42 const isServerProviderUpdateError = Schema.is(ServerProviderUpdateError);
43
44 -const UPDATE_TIMEOUT_MS = 5 * 60_000;
44 +// Native updaters (`claude update`) download a ~300 MB binary without printing
45 +// progress, and killing one mid-download leaves a truncated binary that the
46 +// next run treats as installed. Allow a slow connection to finish.
47 +const UPDATE_TIMEOUT_MINUTES = 30;
48 +const UPDATE_TIMEOUT_MS = UPDATE_TIMEOUT_MINUTES * 60_000;
49 const UPDATE_OUTPUT_MAX_BYTES = 10_000;
50 // Sample installer output because every progress update resends the provider list to all clients.
51 const UPDATE_PROGRESS_INTERVAL = Duration.seconds(1);
@@ -260,7 +264,7 @@ function lastOutputLine(result: ProviderMaintenanceCommandResult): string | null
264
265 function failureMessage(result: ProviderMaintenanceCommandResult): string {
266 if (result.timedOut) {
263 - return "Update timed out.";
267 + return `Update timed out after ${UPDATE_TIMEOUT_MINUTES} minutes.`;
268 }
269 const summary =
270 result.exitCode !== null && result.exitCode !== 0