Skip to content
TypeScript

fix(web): stop offering a provider update that cannot clear a limited-support warning (#17676)

Sean Swansonfc0c36f963b6
diff --git a/apps/web/src/components/settings/providerStatus.test.ts b/apps/web/src/components/settings/providerStatus.test.ts
index 3709b7d3968..d231b911e75 100644
--- a/apps/web/src/components/settings/providerStatus.test.ts
+++ b/apps/web/src/components/settings/providerStatus.test.ts
@@ -99,6 +99,39 @@ it("does not suggest copying a command that installs an incompatible latest vers
).not.toBeNull();
});
+it("does not offer an update that cannot change a limited-support version", () => {
+ // OpenCode 1.18.35 is the newest `opencode-ai`; the recommended 2.x ships as another package.
+ const advisory = {
+ status: "current" as const,
+ currentVersion: "1.18.35",
+ latestVersion: "1.18.35",
+ updateCommand: "npm install -g opencode-ai@latest",
+ canUpdate: true,
+ checkedAt: provider.checkedAt,
+ message: null,
+ };
+ const compatibility = {
+ status: "graceful" as const,
+ latestVersionStatus: "graceful" as const,
+ message: null,
+ recommendedRange: ">=2.0.18",
+ recommendedVersion: null,
+ };
+ expect(getProviderVersionAdvisoryPresentation(advisory, compatibility)).toEqual({
+ title: "Limited support",
+ detail: "Use >=2.0.18 for full support.",
+ updateCommand: null,
+ emphasis: "normal",
+ targetVersion: null,
+ });
+ expect(
+ getProviderVersionAdvisoryPresentation(
+ { ...advisory, status: "behind_latest", currentVersion: "1.18.34" },
+ compatibility,
+ )?.updateCommand,
+ ).toBe(advisory.updateCommand);
+});
+
it("shows compatibility in the version popover even when the installed version is current", () => {
const advisory = {
status: "current" as const,
diff --git a/apps/web/src/components/settings/providerStatus.ts b/apps/web/src/components/settings/providerStatus.ts
index 25d51e0193d..32d1ef83610 100644
--- a/apps/web/src/components/settings/providerStatus.ts
+++ b/apps/web/src/components/settings/providerStatus.ts
@@ -114,13 +114,18 @@ export function getProviderVersionAdvisoryPresentation(
) {
const targetVersion = compatibility.recommendedVersion;
const recommendation = getProviderVersionLabel(targetVersion) ?? compatibility.recommendedRange;
+ // An installed version that is already the package's latest cannot be fixed by
+ // updating it, e.g. when the recommendation needs a different package.
+ const isAlreadyLatest = advisory?.status === "current";
return {
title: COMPATIBILITY_TITLES[compatibility.status],
detail:
compatibility.message ??
(recommendation ? `Use ${recommendation} for full support.` : "Update for full support."),
updateCommand:
- targetVersion || latestIsIncompatible ? null : (advisory?.updateCommand ?? null),
+ targetVersion || latestIsIncompatible || isAlreadyLatest
+ ? null
+ : (advisory?.updateCommand ?? null),
emphasis: compatibility.status === "graceful" ? "normal" : "strong",
targetVersion,
};