@devries-cameron20 / t3code Mirror · read-only / commits / 26ccb935ab
Fork 0

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, 23:30 UTC

fix(server): failed provider updates show the updater's error, not its closing hint (#26298)

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

Julius Marminge committed Nov 11, 2026 at 11:51 UTC 26ccb935ab1f9e879cbf1de27422a71376f9de4d
2 files changed +72 -11
apps/server/src/provider/providerMaintenanceRunner.test.ts
+59
@@ -713,6 +713,65 @@ describe("providerMaintenanceRunner", () => {
713 ),
714 );
715
716 + it.effect("reports the updater's error rather than a trailing hint after it", () =>
717 + Effect.forEach(
718 + [
719 + {
720 + stdout: "Current version: 2.1.310\nChecking for updates to latest version...\n",
721 + stderr: [
722 + "Error: Failed to install native update",
723 + "TelemetrySafeError: Failed to fetch version from https://downloads.claude.ai/claude-code-releases/latest after 3 attempt(s): Request failed with status code 403",
724 + 'Try running "claude doctor" for diagnostics',
725 + "",
726 + ].join("\n"),
727 + reason: "Request failed with status code 403",
728 + hint: "claude doctor",
729 + },
730 + {
731 + stdout: "",
732 + stderr: [
733 + "Failed to check for updates",
734 + "Unable to fetch latest version from npm registry",
735 + "",
736 + "Possible causes:",
737 + " • Network connectivity issues",
738 + " • npm registry is unreachable",
739 + " • Corporate proxy/firewall blocking npm",
740 + "",
741 + "Try:",
742 + " • Check your internet connection",
743 + " • Run with --debug flag for more details",
744 + " • Manually check: npm view @anthropic-ai/claude-code version",
745 + " • Check if you need to login: npm whoami",
746 + "",
747 + ].join("\n"),
748 + reason: "Failed to check for updates",
749 + hint: "npm whoami",
750 + },
751 + ],
752 + ({ stdout, stderr, reason, hint }) =>
753 + Effect.gen(function* () {
754 + const { registry } = yield* makeRegistry(baseNativeCliProvider);
755 + const updater = yield* makeTestRunner(registry);
756 +
757 + const result = yield* updater.updateProvider(NATIVE_CLI_DRIVER);
758 + const message = result.providers[0]?.updateState?.message ?? "";
759 +
760 + assert.include(message, reason);
761 + assert.notInclude(message, hint);
762 + }).pipe(
763 + Effect.provide(
764 + Layer.mergeAll(
765 + layerNonWindowsPlatform,
766 + layerLatestVersionHttpClient("0.0.0"),
767 + layerMockSpawner(() => ({ stdout, stderr, code: 1 })),
768 + ),
769 + ),
770 + ),
771 + { discard: true },
772 + ),
773 + );
774 +
775 it.effect("keeps the exit code message when a failed command prints nothing", () =>
776 Effect.gen(function* () {
777 const { registry } = yield* makeRegistry();
apps/server/src/provider/providerMaintenanceRunner.ts
+13 -11
@@ -262,18 +262,20 @@ function commandOutput(result: ProviderMaintenanceCommandResult): string | null
262 return truncateText(output, UPDATE_OUTPUT_MAX_BYTES);
263 }
264
265 -// Updaters print their reason last, usually on stderr.
266 -function lastOutputLine(result: ProviderMaintenanceCommandResult): string | null {
267 - for (const output of [result.stderr, result.stdout]) {
268 - const line = output
265 +// Updaters report on stderr, but may follow their error with hints (`claude update`
266 +// ends with "Try running claude doctor"), so prefer the last line naming an error.
267 +function failureReason(result: ProviderMaintenanceCommandResult): string | null {
268 + const streams = [result.stderr, result.stdout].map((output) =>
269 + output
270 .split(/\r\n|\r|\n/)
271 .map(toProgressLine)
271 - .findLast(Boolean);
272 - if (line) {
273 - return line;
274 - }
275 - }
276 - return null;
272 + .filter((line) => line !== null),
273 + );
274 + return (
275 + streams.map((lines) => lines.findLast((line) => /error|fail/i.test(line))).find(Boolean) ??
276 + streams.map((lines) => lines.at(-1)).find(Boolean) ??
277 + null
278 + );
279 }
280
281 function failureMessage(result: ProviderMaintenanceCommandResult): string {
@@ -284,7 +286,7 @@ function failureMessage(result: ProviderMaintenanceCommandResult): string {
286 result.exitCode !== null && result.exitCode !== 0
287 ? `Update command exited with code ${result.exitCode}`
288 : "Update command failed";
287 - const reason = lastOutputLine(result);
289 + const reason = failureReason(result);
290 return reason ? `${summary}: ${reason}` : `${summary}.`;
291 }
292