Skip to content
TypeScript

fix(server): Claude no longer tries to update itself through a mise command wrapper (#27466)

Gourav Kumar Dhimandb7db4dbf6d3
diff --git a/packages/provider-core/src/server/maintenanceResolver.test.ts b/packages/provider-core/src/server/maintenanceResolver.test.ts
index 35ccaebf21e..7883d827d4e 100644
--- a/packages/provider-core/src/server/maintenanceResolver.test.ts
+++ b/packages/provider-core/src/server/maintenanceResolver.test.ts
@@ -1431,6 +1431,26 @@ it.layer(
env: { PATH: "" },
}).pipe(Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, noSpawn));
expect(mise.update).toBeNull();
+
+ // A mise command wrapper is a symlink to the mise binary, not to the tool.
+ const miseBinary = NodePath.join(tempDir, "usr", "bin", "mise");
+ writeExecutable(miseBinary);
+ const wrapper = NodePath.join(
+ tempDir,
+ ".local",
+ "share",
+ "mise",
+ "command-wrappers",
+ "bin",
+ "package-tool",
+ );
+ NodeFS.mkdirSync(NodePath.dirname(wrapper), { recursive: true });
+ NodeFS.symlinkSync(miseBinary, wrapper);
+ const viaWrapper = yield* resolveProviderMaintenanceCapabilitiesEffect(selfUpdating, {
+ binaryPath: wrapper,
+ env: { PATH: "" },
+ }).pipe(Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, noSpawn));
+ expect(viaWrapper.update).toBeNull();
}),
);
diff --git a/packages/provider-core/src/server/maintenanceResolver.ts b/packages/provider-core/src/server/maintenanceResolver.ts
index 635fa37a227..1810fff9a52 100644
--- a/packages/provider-core/src/server/maintenanceResolver.ts
+++ b/packages/provider-core/src/server/maintenanceResolver.ts
@@ -241,10 +241,18 @@ function isYarnGlobalCommandPath(commandPath: string): boolean {
return /\/yarn\/(?:data\/)?global\/node_modules\//.test(normalizeCommandPath(commandPath));
}
-/** Version-manager installs are pinned in its config, so updating them means editing that. */
+/**
+ * Version-manager installs are pinned in its config, so updating them means editing that.
+ * A command wrapper is a symlink to the `mise` binary, which dispatches on argv[0].
+ */
function isMiseCommandPath(commandPath: string): boolean {
const normalized = normalizeCommandPath(commandPath);
- return normalized.includes("/mise/installs/") || normalized.includes("/mise/shims/");
+ return (
+ normalized.includes("/mise/installs/") ||
+ normalized.includes("/mise/shims/") ||
+ normalized.includes("/mise/command-wrappers/") ||
+ /\/mise(?:\.exe)?$/.test(normalized)
+ );
}
const winGetClaudeCommandPath =