@devries-cameron20 / t3code Mirror · read-only / commits / 896e64f82d
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): only offer claude update for native Claude installs (#14170)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Ahmed Ibrahem committed Nov 11, 2026 at 15:41 UTC 896e64f82da835533f797468150be0624d129458
4 files changed +53 -15
apps/server/src/provider/Drivers/ClaudeMaintenance.test.ts
+41 -9
@@ -42,19 +42,31 @@ const snapshot: ServerProvider = {
42 };
43
44 const fixture = Effect.fn("ClaudeMaintenance.test.fixture")(function* (
45 - npm = false,
45 + install: "native" | "xdgNative" | "npm" | "wrapper" = "native",
46 platform: NodeJS.Platform = "linux",
47 programFiles?: string,
48 ) {
49 const fs = yield* FileSystem.FileSystem;
50 const path = yield* Path.Path;
51 const directory = yield* fs.makeTempDirectoryScoped();
52 - const binaryPath = npm
53 - ? path.join(directory, "lib/node_modules/@anthropic-ai/claude-code/cli.js")
54 - : path.join(directory, ".local/bin", platform === "win32" ? "claude.exe" : "claude");
55 - yield* fs.makeDirectory(path.dirname(binaryPath), { recursive: true });
56 - yield* fs.writeFileString(binaryPath, "#!/bin/sh\n");
57 - yield* fs.chmod(binaryPath, 0o755);
52 + const binaryPath =
53 + install === "npm"
54 + ? path.join(directory, "lib/node_modules/@anthropic-ai/claude-code/cli.js")
55 + : path.join(directory, ".local/bin", platform === "win32" ? "claude.exe" : "claude");
56 + // Unix native installs link the launcher to a versioned binary; Windows places a real .exe.
57 + const realBinaryPath =
58 + install === "native" && platform !== "win32"
59 + ? path.join(directory, ".local/share/claude/versions/2.1.314")
60 + : install === "xdgNative"
61 + ? path.join(directory, "xdg/data/claude/versions/2.1.314")
62 + : binaryPath;
63 + yield* fs.makeDirectory(path.dirname(realBinaryPath), { recursive: true });
64 + yield* fs.writeFileString(realBinaryPath, "#!/bin/sh\n");
65 + yield* fs.chmod(realBinaryPath, 0o755);
66 + if (realBinaryPath !== binaryPath) {
67 + yield* fs.makeDirectory(path.dirname(binaryPath), { recursive: true });
68 + yield* fs.symlink(realBinaryPath, binaryPath);
69 + }
70 const configDirectory = path.join(directory, "config");
71 yield* fs.makeDirectory(configDirectory);
72 const settingsPath = path.join(configDirectory, "settings.json");
@@ -194,7 +206,7 @@ it.layer(NodeServices.layer)("ClaudeMaintenance", (it) => {
206 },
207 ])("advertises the installable version for $name", (row) =>
208 Effect.gen(function* () {
197 - const f = yield* fixture(row.npm);
209 + const f = yield* fixture(row.npm ? "npm" : "native");
210 if (row.settings) yield* f.fs.writeFileString(f.settingsPath, row.settings);
211 const requests: string[] = [];
212 const client = HttpClient.make((request) => {
@@ -239,7 +251,7 @@ it.layer(NodeServices.layer)("ClaudeMaintenance", (it) => {
251 "separates channel caches and honors $name managed overrides and feed invalidation",
252 (row) =>
253 Effect.gen(function* () {
242 - const f = yield* fixture(false, row.platform, row.programFiles);
254 + const f = yield* fixture("native", row.platform, row.programFiles);
255 const requests: string[] = [];
256 const client = HttpClient.make((request) => {
257 requests.push(request.url);
@@ -288,6 +300,26 @@ it.layer(NodeServices.layer)("ClaudeMaintenance", (it) => {
300 }).pipe(Effect.scoped),
301 );
302
303 + it.effect.each([
304 + { name: "a wrapper script", install: "wrapper", lockKey: undefined },
305 + {
306 + name: "a native install under XDG_DATA_HOME",
307 + install: "xdgNative",
308 + lockKey: "claudeAgent-native",
309 + },
310 + ] as const)("resolves the native launcher path for $name", (row) =>
311 + Effect.gen(function* () {
312 + const f = yield* fixture(row.install);
313 + const resolve = yield* f.makeResolution.pipe(
314 + Effect.provideService(
315 + HttpClient.HttpClient,
316 + HttpClient.make(() => Effect.die("resolution must not look up a version")),
317 + ),
318 + );
319 + expect((yield* resolve()).update?.lockKey).toBe(row.lockKey);
320 + }).pipe(Effect.scoped),
321 + );
322 +
323 it.effect("automatic refresh rereads the native channel while preserving both caches", () =>
324 Effect.gen(function* () {
325 const f = yield* fixture();
apps/server/src/provider/Drivers/ClaudeMaintenance.ts
+5 -2
@@ -30,14 +30,17 @@ const update = makePackageManagedProviderMaintenanceResolver({
30 mise: { tool: "claude" },
31 nativeUpdate: {
32 args: ["update"],
33 + // On Unix the native launcher links into ${XDG_DATA_HOME:-~/.local/share}/claude/versions; a
34 + // plain file at ~/.local/bin/claude is a wrapper whose owner `claude update` cannot see.
35 isCommandPath: (commandPath) => {
36 const normalized = normalizeCommandPath(commandPath);
37 return (
36 - normalized.endsWith("/.local/bin/claude") ||
38 normalized.endsWith("/.local/bin/claude.exe") ||
38 - normalized.includes("/.local/share/claude/")
39 + normalized.includes("/.local/share/claude/") ||
40 + normalized.includes("/claude/versions/")
41 );
42 },
43 + requiresCommandPath: true,
44 },
45 });
46
docs/internals/providers.md
+4 -3
@@ -86,9 +86,10 @@ and npm are proven by the real path (symlinks followed): a versioned keg or cask
86 Native installer layouts and the global directories of pnpm, Bun, Yarn, and Vite+ may match on
87 either the resolved path or its real target, since those installers place real files or their own
88 symlinks there. Volta is proven by its `volta-shim` link plus the package's image directory. When
89 -nothing is proven, the provider's own updater (`claude update`, `codex update`, `opencode upgrade`,
90 -`pi update --self`, `grok update`) runs instead, because each one detects its installer itself;
91 -the runner's version check catches an updater that exits 0 without updating. Mise is checked
89 +nothing is proven, Pi's and Grok's own updaters (`pi update --self`, `grok update`) run instead,
90 +because each detects its installer itself; the runner's version check catches an updater that exits
91 +0 without updating. Claude, Codex, and OpenCode updaters only act on their own native layout, so
92 +those providers stay manual-only unless that layout is proven. Mise is checked
93 first, since a `mise x` wrapper can sit at a native installer's path, and `MISE_DATA_DIR` can put
94 installs anywhere, so `mise which` is asked whenever mise is on `PATH`. Each driver names its fixed
95 mise tool; mise must resolve the binary and list it in an active install of that tool requested as
docs/user/install.md
+3 -1
@@ -214,7 +214,9 @@ on the environment's machine. An unlisted version is unverified.
214 When a provider CLI is behind its latest release, its provider card shows the
215 available version. **Update now** runs the installer that owns the CLI
216 (Homebrew, mise, or a global npm, pnpm, Yarn, Bun, Volta, or Vite+ install), or
217 -the CLI's own update command when T3 Code cannot tell. T3 Code runs `mise upgrade`
217 +the CLI's own update command when T3 Code cannot tell. Claude, Codex, and
218 +OpenCode installs T3 Code cannot identify stay manual: update them through the
219 +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.