Skip to content

Commit db7db4d

Browse files
Gourav224claude
andauthored
fix(server): Claude no longer tries to update itself through a mise command wrapper (#27466)
Co-authored-by: Claude Sonnet 5.5 <[email protected]>
1 parent 4ff9a32 commit db7db4d

2 files changed

Lines changed: 30 additions & 2 deletions

File tree

‎packages/provider-core/src/server/maintenanceResolver.test.ts‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,6 +1431,26 @@ it.layer(
14311431
env: { PATH: "" },
14321432
}).pipe(Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, noSpawn));
14331433
expect(mise.update).toBeNull();
1434+
1435+
// A mise command wrapper is a symlink to the mise binary, not to the tool.
1436+
const miseBinary = NodePath.join(tempDir, "usr", "bin", "mise");
1437+
writeExecutable(miseBinary);
1438+
const wrapper = NodePath.join(
1439+
tempDir,
1440+
".local",
1441+
"share",
1442+
"mise",
1443+
"command-wrappers",
1444+
"bin",
1445+
"package-tool",
1446+
);
1447+
NodeFS.mkdirSync(NodePath.dirname(wrapper), { recursive: true });
1448+
NodeFS.symlinkSync(miseBinary, wrapper);
1449+
const viaWrapper = yield* resolveProviderMaintenanceCapabilitiesEffect(selfUpdating, {
1450+
binaryPath: wrapper,
1451+
env: { PATH: "" },
1452+
}).pipe(Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, noSpawn));
1453+
expect(viaWrapper.update).toBeNull();
14341454
}),
14351455
);
14361456

‎packages/provider-core/src/server/maintenanceResolver.ts‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,18 @@ function isYarnGlobalCommandPath(commandPath: string): boolean {
241241
return /\/yarn\/(?:data\/)?global\/node_modules\//.test(normalizeCommandPath(commandPath));
242242
}
243243

244-
/** Version-manager installs are pinned in its config, so updating them means editing that. */
244+
/**
245+
* Version-manager installs are pinned in its config, so updating them means editing that.
246+
* A command wrapper is a symlink to the `mise` binary, which dispatches on argv[0].
247+
*/
245248
function isMiseCommandPath(commandPath: string): boolean {
246249
const normalized = normalizeCommandPath(commandPath);
247-
return normalized.includes("/mise/installs/") || normalized.includes("/mise/shims/");
250+
return (
251+
normalized.includes("/mise/installs/") ||
252+
normalized.includes("/mise/shims/") ||
253+
normalized.includes("/mise/command-wrappers/") ||
254+
/\/mise(?:\.exe)?$/.test(normalized)
255+
);
248256
}
249257

250258
const winGetClaudeCommandPath =

0 commit comments

Comments
 (0)