@devries-cameron20 / t3code Mirror · read-only / commits / 25c599839a
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, 21:00 UTC

fix(provider-core): Nix store provider installs no longer offer an update that can't run (#27706)

Julius Marminge committed Nov 11, 2026 at 15:47 UTC 25c599839a591df095c1a82048590e79a5c745b1
5 files changed +77 -2
docs/internals/providers.md
+1 -1
@@ -97,7 +97,7 @@ mise tool; mise must resolve the binary and list it in an active install of that
97 path must be a shim or under the tool's `latest` link, which the upgrade repoints: a version
98 directory (including one `mise activate` put on `PATH`) would keep running the old binary until mise
99 prunes it. Everything else mise touches (fixed version paths, pinned tools, wrappers, OpenCode 1.x,
100 -whose mise tool crosses into 2.x) stays manual-only, so T3 Code never edits mise config. `mise latest` supplies the version, because settings such as
100 +whose mise tool crosses into 2.x) stays manual-only, so T3 Code never edits mise config. Nix store installs stay manual-only too, since the store is read-only. `mise latest` supplies the version, because settings such as
101 `minimum_release_age` can hold mise behind npm. A Grok cask whose Homebrew prefix
102 cannot be verified also stays manual-only: `grok update` would install a second copy. npm updates pin `--prefix` because the
103 `npm` on `PATH` can belong to a different Node than the one that owns the provider. Homebrew
docs/user/install.md
+1
@@ -220,6 +220,7 @@ installer you used. T3 Code runs `mise upgrade`
220 only for a tool your mise config requests as `latest` when the provider's binary
221 path is a mise shim or under the tool's `installs/<tool>/latest` link; update a
222 pinned version, or a path into one version's directory, through mise yourself.
223 +Update a CLI installed with Nix through Nix.
224 Cursor and Antigravity update with T3 Code. Homebrew and Chocolatey installs
225 compare against the version their package manager offers, which can trail the
226 npm release; update Claude installed with Chocolatey through Chocolatey.
packages/provider-core/src/server/maintenanceResolver.test.ts
+57
@@ -1016,6 +1016,63 @@ it.layer(
1016 }),
1017 );
1018
1019 + it.effect.each([
1020 + {
1021 + name: "a home-manager link in the native location",
1022 + definition: claudeUpdate,
1023 + resolved: "/home/me/.local/bin/claude",
1024 + real: "/nix/store/0c2kbzqz3m0m4hcx2g7hq1n5wfs9a6xd-claude-code-with-bun/bin/claude",
1025 + },
1026 + {
1027 + name: "another provider's profile link",
1028 + definition: otherProviderUpdate,
1029 + resolved: "/etc/profiles/per-user/me/bin/native-package-tool",
1030 + real: "/nix/store/0c2kbzqz3m0m4hcx2g7hq1n5wfs9a6xd-native-package-tool-1.0.0/bin/native-package-tool",
1031 + },
1032 + ] as const)("keeps a Nix store install manual-only through $name", (fixture) =>
1033 + Effect.gen(function* () {
1034 + const capabilities = yield* resolveInstall({ ...fixture, platform: "linux" });
1035 +
1036 + expect(capabilities.update).toBeNull();
1037 + }),
1038 + );
1039 +
1040 + it.effect.skipIf(windowsHost)("upgrades a mise tool through a shim of a Nix-installed mise", () =>
1041 + Effect.gen(function* () {
1042 + const tempDir = yield* makeTempDir("t3-nix-mise-shim");
1043 + const mise = miseFixture(tempDir, { misePresent: false });
1044 + const nixMise = "/nix/store/0c2kbzqz3m0m4hcx2g7hq1n5wfs9a6xd-mise-2026.1.0/bin/mise";
1045 + const spawned: Array<ReadonlyArray<string>> = [];
1046 +
1047 + const capabilities = yield* resolvePackageManagedProviderMaintenance(
1048 + {
1049 + provider: driver("packageTool"),
1050 + npmPackageName: "@example/package-tool",
1051 + mise: { tool: "package-tool" },
1052 + nativeUpdate: null,
1053 + },
1054 + {
1055 + binaryPath: "package-tool",
1056 + resolvedCommandPath: NodePath.join(tempDir, "mise", "shims", "package-tool"),
1057 + realCommandPath: nixMise,
1058 + env: { PATH: "" },
1059 + platform: "linux",
1060 + },
1061 + ).pipe(
1062 + Effect.provideService(HostProcess.Platform, "linux"),
1063 + Effect.provideService(
1064 + ChildProcessSpawner.ChildProcessSpawner,
1065 + miseSpawner({ which: mise.binaryPath, installed: mise.installed() }, spawned),
1066 + ),
1067 + );
1068 +
1069 + expect(capabilities.update).toMatchObject({
1070 + executable: nixMise,
1071 + args: ["upgrade", "package-tool"],
1072 + });
1073 + }),
1074 + );
1075 +
1076 it.effect("proves Windows npm ownership from the package manifest beside the shim", () =>
1077 Effect.gen(function* () {
1078 const tempDir = yield* makeTempDir("t3-npm-windows-capabilities");
packages/provider-core/src/server/maintenanceResolver.ts
+9
@@ -269,6 +269,11 @@ function isMiseExecutablePath(commandPath: string): boolean {
269 return /(?:^|\/)mise(?:\.exe)?$/.test(normalizeCommandPath(commandPath));
270 }
271
272 +/** The Nix store is read-only, so no updater can replace a CLI that lives there. */
273 +export function isNixStoreCommandPath(commandPath: string): boolean {
274 + return normalizeCommandPath(commandPath).startsWith("/nix/store/");
275 +}
276 +
277 const winGetClaudeCommandPath =
278 /^[a-z]:\/(?:users\/[^/]+\/appdata\/local\/microsoft|program files(?: \(x86\))?)\/winget\/(?:links|packages\/anthropic\.claudecode_[^/]+)\/claude\.exe$/;
279
@@ -672,6 +677,10 @@ export const resolvePackageManagedProviderMaintenance = Effect.fn(
677 context,
678 );
679 if (mise) return mise;
680 + // After mise: a shim of a Nix-installed mise resolves into the store, yet its installs are writable.
681 + if (commandPaths.some(isNixStoreCommandPath)) {
682 + return manual;
683 + }
684
685 const nativeUpdate = definition.nativeUpdate;
686 const nativeEnv = nativeUpdate?.env;
packages/provider-grok/src/server/driver.ts
+9 -1
@@ -32,6 +32,7 @@ import { mergeProviderInstanceEnvironment } from "@t3tools/provider-core/server/
32 import { discoverGrokSkills } from "./skills.ts";
33 import {
34 homebrewOwnershipFromCommandPath,
35 + isNixStoreCommandPath,
36 makeCachedProviderMaintenanceResolution,
37 makeManualOnlyProviderMaintenanceCapabilities,
38 makeProviderMaintenanceCapabilities,
@@ -53,7 +54,7 @@ const GROK_NPM_PACKAGE = "@xai-official/grok";
54 // `grok update` installs under `GROK_HOME` from the resolved executable and instance environment.
55 // npm 12 blocks the postinstall that moves the new binary in, yet exits 0, so allow it by env.
56 // Mise and Homebrew casks upgrade through their manager; `grok update` would install a second
56 -// copy, so a cask its brew cannot vouch for stays manual.
57 +// copy, so a cask its brew cannot vouch for stays manual, as does a Nix store install.
58 const UPDATE: ProviderMaintenanceCapabilitiesResolver = {
59 resolve: Effect.fn("resolveGrokMaintenance")(function* (context) {
60 if (!context) {
@@ -68,6 +69,13 @@ const UPDATE: ProviderMaintenanceCapabilitiesResolver = {
69 context,
70 );
71 if (mise) return mise;
72 + if ([context.resolvedCommandPath, context.realCommandPath].some(isNixStoreCommandPath)) {
73 + return makeManualOnlyProviderMaintenanceCapabilities({
74 + provider: DRIVER_KIND,
75 + packageName: GROK_NPM_PACKAGE,
76 + installPath: context.realCommandPath,
77 + });
78 + }
79 const homebrew = homebrewOwnershipFromCommandPath(context.realCommandPath);
80 // Only a cask is Grok's: a formula keg such as `node` holding an npm global is not.
81 if (homebrew?.kind === "cask") {