@devries-cameron20 / t3code-1 / commits / 4582a3bc68
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(server): MacPorts-owned agent CLIs are no longer updated through npm or their own updater (#36229)

Julius Marminge committed Nov 13, 2026 at 08:55 UTC 4582a3bc682d1258ae79ae4c0024a054dd5e64f2
2 files changed +82
packages/provider-core/src/server/maintenanceResolver.test.ts
+49
@@ -1634,6 +1634,55 @@ it.layer(
1634 }),
1635 );
1636
1637 + for (const fixture of [
1638 + {
1639 + name: "an npm-shaped package",
1640 + definition: packageToolUpdate,
1641 + target: ["lib", "node_modules", "@example", "package-tool", "bin", "package-tool.exe"],
1642 + },
1643 + {
1644 + name: "a launcher script",
1645 + definition: nativePackageToolUpdate,
1646 + target: ["share", "native-package-tool", "native-package-tool"],
1647 + },
1648 + ]) {
1649 + it.effect.skipIf(!symlinksSupported || windowsHost)(
1650 + `leaves ${fixture.name} owned by MacPorts to MacPorts`,
1651 + () =>
1652 + Effect.gen(function* () {
1653 + const prefix = yield* makeTempDir("t3-macports");
1654 + writeExecutable(NodePath.join(prefix, "bin", "port"));
1655 + const target = NodePath.join(prefix, ...fixture.target);
1656 + writeExecutable(target);
1657 + const launcher = NodePath.join(prefix, "bin", NodePath.basename(target, ".exe"));
1658 + NodeFS.symlinkSync(target, launcher);
1659 +
1660 + const capabilities = yield* resolveProviderMaintenanceCapabilitiesEffect(
1661 + fixture.definition,
1662 + { binaryPath: launcher, env: { PATH: NodePath.join(prefix, "bin") } },
1663 + ).pipe(
1664 + Effect.provideService(HostProcess.Platform, "darwin"),
1665 + Effect.provideService(
1666 + ChildProcessSpawner.ChildProcessSpawner,
1667 + stdoutSpawner((command, args) =>
1668 + NodePath.basename(command) === "port" && args.includes("provides")
1669 + ? args.includes("-q")
1670 + ? "package-tool\n"
1671 + : args
1672 + .filter((arg) => arg.startsWith("/"))
1673 + .map((file) => `${file} is provided by: package-tool\n`)
1674 + .join("")
1675 + : "",
1676 + ),
1677 + ),
1678 + );
1679 +
1680 + expect(capabilities.update).toBeNull();
1681 + expect(capabilities.manualCommand).toBe("sudo port upgrade package-tool");
1682 + }),
1683 + );
1684 + }
1685 +
1686 it("quotes copyable command words the shell would split", () => {
1687 const posix = makeProviderMaintenanceCapabilities({
1688 provider: driver("packageTool"),
packages/provider-core/src/server/maintenanceResolver.ts
+33
@@ -802,6 +802,15 @@ export const resolvePackageManagedProviderMaintenance = Effect.fn(
802 if (commandPaths.some(isNixStoreCommandPath)) {
803 return manual;
804 }
805 + const macPortsName = yield* resolveMacPortsOwner(context);
806 + if (macPortsName !== null) {
807 + return makeManualOnlyProviderMaintenanceCapabilities({
808 + provider: definition.provider,
809 + packageName,
810 + installPath: context.realCommandPath,
811 + ...(macPortsName ? { manualCommand: `sudo port upgrade ${macPortsName}` } : {}),
812 + });
813 + }
814
815 const nativeUpdate = definition.nativeUpdate;
816 const nativeEnv = nativeUpdate?.env;
@@ -1020,6 +1029,30 @@ const isMiseWrapperScript = Effect.fn("isMiseWrapperScript")(function* (
1029 return script.startsWith("#!") && /\bmise\s+(?:x|exec)\b/.test(script);
1030 });
1031
1032 +/**
1033 + * The port that installed the executable, "" when MacPorts owns it under an unusable name,
1034 + * or null when it does not. MacPorts prefixes are root-owned and its Claude port disables
1035 + * `claude update`, so neither npm nor the native updater can upgrade these installs.
1036 + */
1037 +const resolveMacPortsOwner = Effect.fn("resolveMacPortsOwner")(function* (
1038 + context: ProviderMaintenanceResolutionContext,
1039 +) {
1040 + if (context.platform === "win32") return null;
1041 + const fileSystem = yield* FileSystem.FileSystem;
1042 + const path = yield* Path.Path;
1043 + const siblingPort = path.join(path.dirname(context.resolvedCommandPath), "port");
1044 + const portPath = (yield* fileSystem.exists(siblingPort).pipe(Effect.orElseSucceed(() => false)))
1045 + ? siblingPort
1046 + : yield* resolveCommandPath("port", { env: context.env });
1047 + if (!portPath) return null;
1048 + const prefix = `${normalizeCommandPath(path.dirname(path.dirname(portPath)))}/`;
1049 + if (!normalizeCommandPath(context.realCommandPath).startsWith(prefix)) return null;
1050 + const output = yield* runProbe(portPath, ["provides", context.realCommandPath], context.env);
1051 + const name = output ? /\bis provided by: (\S+)/.exec(output)?.[1] : undefined;
1052 + if (name === undefined) return null;
1053 + return /^[\w.+-]+$/.test(name) ? name : "";
1054 +});
1055 +
1056 // Volta bin links only identify its shim; the package image proves ownership.
1057 const isVoltaPackageInstall = Effect.fn("isVoltaPackageInstall")(function* (
1058 context: ProviderMaintenanceResolutionContext,