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, 04:15 UTC
fix(server): keep WinGet Claude installs manual-only instead of running claude update (#19517)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Scott Norteman committed
Oct 18, 2026 at 15:13 UTC
1ffa2cbb44ee62cfe5ad0991f66ae0b110e6c204
2 files changed
+150
packages/provider-core/src/server/maintenanceResolver.test.ts
+129
@@ -30,6 +30,7 @@ import {
30
resolveLatestProviderVersion,
31
resolvePackageManagedProviderMaintenance,
32
resolveProviderMaintenanceCapabilitiesEffect,
33
+ type PackageManagedProviderMaintenanceDefinition,
34
type ProviderMaintenanceCapabilities,
35
} from "./maintenanceResolver.ts";
36
import { symlinksSupported } from "@t3tools/shared/testing/symlinks";
@@ -339,6 +340,134 @@ it.layer(NodeServices.layer)("providerMaintenance", (it) => {
340
}),
341
);
342
343
+ const claudeUpdate = {
344
+ provider: driver("claudeAgent"),
345
+ npmPackageName: "@anthropic-ai/claude-code",
346
+ nativeUpdate: {
347
+ args: ["update"],
348
+ isCommandPath: isNativeTestCommandPath("/.local/bin/claude"),
349
+ },
350
+ };
351
+ const otherProviderUpdate = {
352
+ provider: driver("nativePackageTool"),
353
+ npmPackageName: "@example/native-package-tool",
354
+ nativeUpdate: {
355
+ args: ["update"],
356
+ isCommandPath: isNativeTestCommandPath("/.local/bin/native-package-tool"),
357
+ },
358
+ };
359
+ const resolveInstall = (input: {
360
+ readonly definition: PackageManagedProviderMaintenanceDefinition;
361
+ readonly resolved: string;
362
+ readonly real: string;
363
+ readonly platform?: NodeJS.Platform;
364
+ }) =>
365
+ resolvePackageManagedProviderMaintenance(input.definition, {
366
+ binaryPath: "claude",
367
+ resolvedCommandPath: input.resolved,
368
+ realCommandPath: input.real,
369
+ env: {},
370
+ platform: input.platform ?? "win32",
371
+ }).pipe(
372
+ Effect.provideService(HostProcess.Platform, input.platform ?? "win32"),
373
+ Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, noSpawn),
374
+ );
375
+ const userWinGetLink = "C:\\Users\\me\\AppData\\Local\\Microsoft\\WinGet\\Links\\claude.exe";
376
+ const userWinGetPackage =
377
+ "C:\\Users\\me\\AppData\\Local\\Microsoft\\WinGet\\Packages\\Anthropic.ClaudeCode_Microsoft.Winget.Source_8wekyb3d8bbwe\\claude.exe";
378
+ const machineWinGetLink = "C:\\Program Files\\WinGet\\Links\\claude.exe";
379
+ const machineWinGetPackage =
380
+ "C:\\Program Files\\WinGet\\Packages\\Anthropic.ClaudeCode_Microsoft.Winget.Source_8wekyb3d8bbwe\\claude.exe";
381
+ const nativeClaude = "C:\\Users\\me\\.local\\bin\\claude.exe";
382
+
383
+ it.effect.each([
384
+ { name: "a user-scope link", resolved: userWinGetLink, real: userWinGetPackage },
385
+ { name: "a user-scope package", resolved: userWinGetPackage, real: userWinGetPackage },
386
+ { name: "a machine-scope package", resolved: machineWinGetPackage, real: machineWinGetPackage },
387
+ { name: "a machine-scope link alone", resolved: machineWinGetLink, real: machineWinGetLink },
388
+ {
389
+ name: "a mixed-case link",
390
+ resolved: "c:\\USERS\\me\\appdata\\local\\MICROSOFT\\winget\\links\\Claude.EXE",
391
+ real: userWinGetPackage.toUpperCase(),
392
+ },
393
+ { name: "a native-looking alias", resolved: nativeClaude, real: userWinGetPackage },
394
+ ] as const)("keeps a WinGet Claude install manual-only through $name", (fixture) =>
395
+ Effect.gen(function* () {
396
+ const capabilities = yield* resolveInstall({ definition: claudeUpdate, ...fixture });
397
+
398
+ expect(capabilities.update).toBeNull();
399
+ }),
400
+ );
401
+
402
+ it.effect("hides update actions for a WinGet Claude install", () =>
403
+ Effect.gen(function* () {
404
+ const capabilities = yield* resolveInstall({
405
+ definition: claudeUpdate,
406
+ resolved: userWinGetLink,
407
+ real: userWinGetPackage,
408
+ });
409
+
410
+ expect(
411
+ createProviderVersionAdvisory({
412
+ driver: driver("claudeAgent"),
413
+ currentVersion: "2.1.0",
414
+ latestVersion: "2.2.0",
415
+ maintenanceCapabilities: capabilities,
416
+ }),
417
+ ).toMatchObject({ canUpdate: false, canInstallVersion: false, updateCommand: null });
418
+ }),
419
+ );
420
+
421
+ it.effect.each([
422
+ {
423
+ name: "a native install",
424
+ definition: claudeUpdate,
425
+ resolved: nativeClaude,
426
+ real: nativeClaude,
427
+ },
428
+ {
429
+ name: "a WinGet-shaped path off Windows",
430
+ definition: claudeUpdate,
431
+ resolved: "/home/me/winget/links/claude.exe",
432
+ real: "/home/me/winget/links/claude.exe",
433
+ platform: "linux",
434
+ },
435
+ {
436
+ name: "a WinGet-named folder outside the WinGet roots",
437
+ definition: claudeUpdate,
438
+ resolved: "C:\\Work\\WinGet\\Links\\claude.exe",
439
+ real: "C:\\Work\\WinGet\\Links\\claude.exe",
440
+ },
441
+ {
442
+ name: "a WinGet-named folder inside another directory",
443
+ definition: claudeUpdate,
444
+ resolved: "C:\\Work\\Microsoft\\WinGet\\Links\\claude.exe",
445
+ real: "C:\\Work\\Microsoft\\WinGet\\Links\\claude.exe",
446
+ },
447
+ {
448
+ name: "another provider in WinGet",
449
+ definition: otherProviderUpdate,
450
+ resolved: userWinGetLink,
451
+ real: userWinGetPackage,
452
+ },
453
+ {
454
+ name: "another WinGet package",
455
+ definition: claudeUpdate,
456
+ resolved: userWinGetPackage.replace("ClaudeCode_", "ClaudeCodeOther_"),
457
+ real: userWinGetPackage.replace("ClaudeCode_", "ClaudeCodeOther_"),
458
+ },
459
+ ] as const)("keeps the native updater for $name", (fixture) =>
460
+ Effect.gen(function* () {
461
+ const capabilities = yield* resolveInstall(fixture);
462
+
463
+ expect(capabilities.update).toMatchObject({
464
+ executable: fixture.resolved,
465
+ args: ["update"],
466
+ lockKey: `${fixture.definition.provider}-native`,
467
+ });
468
+ }),
469
+ );
470
+
471
it.effect("proves Windows npm ownership from the package manifest beside the shim", () =>
472
Effect.gen(function* () {
473
const tempDir = yield* makeTempDir("t3-npm-windows-capabilities");
packages/provider-core/src/server/maintenanceResolver.ts
+21
@@ -211,6 +211,18 @@ function isMiseCommandPath(commandPath: string): boolean {
211
return normalized.includes("/mise/installs/") || normalized.includes("/mise/shims/");
212
}
213
214
+/**
215
+ * WinGet's Claude Code install under its user root (`<drive>:\Users\<name>\AppData\Local\Microsoft\WinGet`)
216
+ * or machine root (`<drive>:\Program Files\WinGet`): the `Links\claude.exe` link or the binary in the
217
+ * `Packages\Anthropic.ClaudeCode_…` directory.
218
+ */
219
+const winGetClaudeCommandPath =
220
+ /^[a-z]:\/(?:users\/[^/]+\/appdata\/local\/microsoft|program files(?: \(x86\))?)\/winget\/(?:links|packages\/anthropic\.claudecode_[^/]+)\/claude\.exe$/;
221
+
222
+function isWinGetClaudeCommandPath(commandPath: string): boolean {
223
+ return winGetClaudeCommandPath.test(normalizeCommandPath(commandPath));
224
+}
225
+
226
function isPnpmGlobalCommandPath(commandPath: string): boolean {
227
const normalized = normalizeCommandPath(commandPath);
228
return (
@@ -341,6 +353,15 @@ export const resolvePackageManagedProviderMaintenance = Effect.fn(
353
}
354
const commandPaths = [context.resolvedCommandPath, context.realCommandPath];
355
const packageName = definition.npmPackageName;
356
+ // WinGet owns these files: `claude update` only reports "managed by winget"
357
+ // and exits 0, and T3 Code does not run `winget upgrade` itself.
358
+ if (
359
+ definition.provider === "claudeAgent" &&
360
+ context.platform === "win32" &&
361
+ commandPaths.some(isWinGetClaudeCommandPath)
362
+ ) {
363
+ return manual;
364
+ }
365
366
const nativeUpdate = definition.nativeUpdate;
367
const native = nativeUpdate