From 6dcf02bb75d67f1c59df04b2159e792d106f0ab1 Mon Sep 17 00:00:00 2001 From: ayattara Date: Wed, 26 Aug 2026 02:56:14 +0000 Subject: [PATCH] fix(plugins): mark ineligible saved profiles unavailable --- .../plugins/plugin-config-form.agent-profile.test.tsx | 6 ++++++ .../settings/plugins/plugin-config-form.tsx | 11 +++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/apps/web/components/settings/plugins/plugin-config-form.agent-profile.test.tsx b/apps/web/components/settings/plugins/plugin-config-form.agent-profile.test.tsx index 72fc10f35f..97d17ee6c7 100644 --- a/apps/web/components/settings/plugins/plugin-config-form.agent-profile.test.tsx +++ b/apps/web/components/settings/plugins/plugin-config-form.agent-profile.test.tsx @@ -82,6 +82,12 @@ describe("PluginConfigForm agent profile field", () => { expect(screen.getByText("Unavailable: deleted-profile")).not.toBeNull(); }); + it("marks an ineligible saved profile as unavailable", () => { + renderField([profile({ id: "disabled", label: "Disabled", enabled: false })], "disabled"); + + expect(screen.getByText("Unavailable: Disabled")).not.toBeNull(); + }); + it("hides the Not set option for required fields", () => { renderField([profile({ id: "eligible", label: ELIGIBLE_PROFILE_LABEL })], "", { required: true, diff --git a/apps/web/components/settings/plugins/plugin-config-form.tsx b/apps/web/components/settings/plugins/plugin-config-form.tsx index f9a04d60ea..cc06e246bb 100644 --- a/apps/web/components/settings/plugins/plugin-config-form.tsx +++ b/apps/web/components/settings/plugins/plugin-config-form.tsx @@ -256,14 +256,13 @@ function AgentProfileSelect({ const selectedID = typeof value === "string" ? value : ""; const selectedProfile = profiles.find((profile) => profile.id === selectedID); const eligibleProfiles = profiles.filter((profile) => utilityProfileEligibility(profile)); - let selectedLabel: string | undefined; - if (selectedProfile) { - selectedLabel = selectedProfile.label || selectedProfile.agent_name || selectedProfile.id; - } else if (selectedID) { - selectedLabel = t("settings:utilityUnavailableProfile", { name: selectedID }); - } const isStale = selectedID !== "" && !eligibleProfiles.some((profile) => profile.id === selectedID); + const selectedProfileLabel = + selectedProfile?.label || selectedProfile?.agent_name || selectedProfile?.id || selectedID; + const selectedLabel = isStale + ? t("settings:utilityUnavailableProfile", { name: selectedProfileLabel }) + : selectedProfileLabel || undefined; return (