🙌 OpenHands: AI-Driven Development
fix(automations): surface non-MCP-installable integrations instead of silently dropping them (#16324)
Lokesh Kank708ce3d1919d
diff --git a/__tests__/components/automations/recommended-automations.test.tsx b/__tests__/components/automations/recommended-automations.test.tsxindex 1a7c47bfe3..cc4b73944a 100644--- a/__tests__/components/automations/recommended-automations.test.tsx+++ b/__tests__/components/automations/recommended-automations.test.tsx@@ -335,6 +335,147 @@ describe("recommended automations", () => {}});+ it("keeps a non-MCP-installable integration visible on its card instead of dropping it", () => {+ // SkillCardPillRow folds pills behind "+N more" when it measures zero+ // widths in jsdom; give it room so every pill renders.+ const offsetWidthDescriptor = Object.getOwnPropertyDescriptor(+ HTMLElement.prototype,+ "offsetWidth",+ );+ Object.defineProperty(HTMLElement.prototype, "offsetWidth", {+ configurable: true,+ get() {+ return 120;+ },+ });+ Object.defineProperty(HTMLElement.prototype, "clientWidth", {+ configurable: true,+ get() {+ return 2000;+ },+ });+ vi.stubGlobal(+ "ResizeObserver",+ class {+ observe() {}++ unobserve() {}++ disconnect() {}+ },+ );++ try {+ render(+ <RecommendedAutomationsSection+ backendKind="local"+ installedServers={[]}+ onSelect={vi.fn()}+ />,+ );++ // jira-issue-to-pr declares jira (HTTP-only catalog entry) and github+ // (MCP). Both belong on the card; jira is labeled as external setup.+ const pillRow = screen.getByTestId(+ "recommended-automation-pills-jira-issue-to-pr",+ );+ expect(pillRow).toHaveTextContent("Jira");+ expect(pillRow).toHaveTextContent("GitHub");+ expect(+ within(pillRow).getByTestId("automation-integration-external-jira"),+ ).toHaveTextContent("RECOMMENDED_AUTOMATIONS$EXTERNAL_SETUP");+ expect(+ within(pillRow).queryByTestId("automation-integration-external-github"),+ ).not.toBeInTheDocument();++ // The connect-before-launch count only covers what the install flow can+ // actually connect, so jira does not inflate it.+ expect(pillRow).toHaveTextContent(+ "RECOMMENDED_AUTOMATIONS$MISSING_CONNECT:1",+ );+ } finally {+ if (offsetWidthDescriptor) {+ Object.defineProperty(+ HTMLElement.prototype,+ "offsetWidth",+ offsetWidthDescriptor,+ );+ } else {+ Reflect.deleteProperty(HTMLElement.prototype, "offsetWidth");+ }+ Reflect.deleteProperty(HTMLElement.prototype, "clientWidth");+ vi.unstubAllGlobals();+ }+ });++ it("finds an automation by searching for its non-MCP-installable integration", () => {+ render(+ <RecommendedAutomationsSection+ backendKind="local"+ installedServers={[]}+ query="jira"+ onSelect={vi.fn()}+ />,+ );++ expect(+ screen.getByTestId("recommended-automation-card-jira-issue-to-pr"),+ ).toBeInTheDocument();+ });++ it("does not silently hide an unknown required integration ID", () => {+ const automation = AUTOMATION_CATALOG.find(+ (item) => item.id === "jira-issue-to-pr",+ )!;+ const mutableAutomation = automation as RecommendedAutomation & {+ requires: {+ integrations: Record<+ string,+ { required?: false; setupRequired?: boolean }+ >;+ };+ };+ const originalIntegrations = mutableAutomation.requires.integrations;+ mutableAutomation.requires.integrations = {+ ...originalIntegrations,+ "unknown-integration": {},+ };++ try {+ render(+ <RecommendedAutomationsSection+ backendKind="local"+ installedServers={[]}+ onSelect={vi.fn()}+ />,+ );++ // The current implementation drops unknown IDs while resolving the+ // catalog, so this assertion intentionally fails until they are surfaced.+ expect(+ screen.getByTestId(+ "recommended-automation-integration-unknown-integration",+ ),+ ).toBeInTheDocument();+ } finally {+ mutableAutomation.requires.integrations = originalIntegrations;+ }+ });++ it("queues installs only for MCP-installable required integrations", async () => {+ renderLauncher();++ fireEvent.click(+ screen.getByTestId("recommended-automation-card-jira-issue-to-pr"),+ );++ // jira cannot go through the local MCP install flow, so the queue starts+ // directly at github rather than failing or skipping the automation.+ const modal = await screen.findByTestId("mcp-install-modal");+ expect(modal).toHaveAttribute("data-marketplace-id", "github");+ expect(mockCreateConversationMutate).not.toHaveBeenCalled();+ });+it("shows a decorative plus badge on each card without toggle behavior", () => {render(<RecommendedAutomationsSectiondiff --git a/src/components/features/automations/recommended-automations-launcher.tsx b/src/components/features/automations/recommended-automations-launcher.tsxindex efe1be5b85..2f67ec4fbb 100644--- a/src/components/features/automations/recommended-automations-launcher.tsx+++ b/src/components/features/automations/recommended-automations-launcher.tsx@@ -19,7 +19,7 @@ import {import {findInstalledEntryMatch,getMarketplaceEntryById,- getMcpMarketplaceCatalog,+ isMcpInstallableEntry,} from "#/utils/mcp-marketplace-utils";import { InstallServerModal } from "#/components/features/mcp-page/install-server-modal";import { useTracking } from "#/hooks/use-tracking";@@ -44,12 +44,17 @@ interface RecommendedAutomationsLauncherProps {* The marketplace entries a launch waits on. An integration the automation is* willing to start without is deliberately absent, so it never queues an* install modal the user has to dismiss.+ *+ * A required integration this backend cannot install as MCP (e.g. Jira's+ * HTTP-only option) is also excluded here — the install queue can't do+ * anything with it — but it is not silently dropped from the product: the+ * automation card keeps it visible and labels it as needing external setup.*/function getRequiredEntries(automation: RecommendedAutomation) {- const mcpMarketplace = getMcpMarketplaceCatalog(MCP_MARKETPLACE);return getRequiredIntegrationIds(automation)- .map((id) => getMarketplaceEntryById(id, mcpMarketplace))- .filter((entry): entry is MarketplaceEntry => !!entry);+ .map((id) => getMarketplaceEntryById(id, MCP_MARKETPLACE))+ .filter((entry): entry is MarketplaceEntry => !!entry)+ .filter(isMcpInstallableEntry);}export function RecommendedAutomationsLauncher({diff --git a/src/components/features/automations/recommended-automations-section.tsx b/src/components/features/automations/recommended-automations-section.tsxindex 701f715b9e..0fbc6b2642 100644--- a/src/components/features/automations/recommended-automations-section.tsx+++ b/src/components/features/automations/recommended-automations-section.tsx@@ -20,7 +20,7 @@ import { MCPServerConfig } from "#/types/mcp-server";import {findInstalledEntryMatch,getMarketplaceEntryById,- getMcpMarketplaceCatalog,+ isMcpInstallableEntry,} from "#/utils/mcp-marketplace-utils";import { getFeaturedAutomationIds } from "#/manifests/automation-interface";import {@@ -68,21 +68,38 @@ function isProvenAutomation(automation: RecommendedAutomation): boolean {return getFeaturedAutomationIds().includes(automation.id);}+export interface AutomationIntegration {+ id: string;+ entry?: MarketplaceEntry;+ /** False when this backend has no MCP install flow for the entry. */+ mcpInstallable: boolean;+}+/*** Every integration the automation declares, including the ones it is willing* to start without: the card describes what the automation uses, so an- * optional integration still belongs on it.+ * optional integration still belongs on it. Entries are resolved against the+ * full catalog — an integration this backend cannot install as MCP (e.g.+ * Jira's HTTP-only option) is still a declared dependency and must stay+ * visible rather than being silently dropped. Unknown IDs are represented as+ * unresolved entries so catalog drift is visible to the user as well.*/-function getIntegrationEntries(automation: RecommendedAutomation) {- const mcpMarketplace = getMcpMarketplaceCatalog(MCP_MARKETPLACE);- return getIntegrationIds(automation)- .map((id) => getMarketplaceEntryById(id, mcpMarketplace))- .filter((entry): entry is MarketplaceEntry => !!entry);+function getIntegrationEntries(+ automation: RecommendedAutomation,+): AutomationIntegration[] {+ return getIntegrationIds(automation).map((id) => {+ const entry = getMarketplaceEntryById(id, MCP_MARKETPLACE);+ return {+ id,+ entry,+ mcpInstallable: !!entry && isMcpInstallableEntry(entry),+ };+ });}function automationMatchesQuery(automation: RecommendedAutomation,- entries: MarketplaceEntry[],+ integrations: AutomationIntegration[],rawQuery: string,) {const query = rawQuery.trim().toLowerCase();@@ -92,8 +109,9 @@ function automationMatchesQuery(automation.category,automation.description,getAutomationLaunchPrompt(automation),- ...entries.map((entry) => entry.name),- ...entries.flatMap((entry) => entry.keywords ?? []),+ ...integrations.flatMap(({ entry, id }) =>+ entry ? [entry.name, id, ...(entry.keywords ?? [])] : [id],+ ),].join(" ").toLowerCase();@@ -101,41 +119,56 @@ function automationMatchesQuery(}/**- * Returns true only when at least one of the automation's integration IDs- * resolves to a known marketplace entry. An empty result means none of the- * automation's integrations are in our catalog (or it declares none at all),- * so there is nothing for the user to set up — hide the card.- * NOTE: intentionally no local/cloud backend availability filter; every entry- * with a catalog match is shown regardless of runtimeAvailability.+ * Keep any automation with declared integrations visible, including when a+ * catalog entry is missing. This makes catalog drift actionable instead of+ * silently hiding the automation.*/function isAutomationAvailable(automation: RecommendedAutomation) {- return getIntegrationEntries(automation).length > 0;+ return getIntegrationIds(automation).length > 0;}function buildRecommendedAutomationPills(- integrationEntries: MarketplaceEntry[],+ integrations: AutomationIntegration[],installedServers: MCPServerConfig[],missingCount: number,translate: TFunction,): SkillCardPill[] {- const pills: SkillCardPill[] = integrationEntries.map((entry) => {- const installed = !!findInstalledEntryMatch(entry, installedServers);+ const pills: SkillCardPill[] = integrations.map(+ ({ id, entry, mcpInstallable }) => {+ const installed =+ !!entry && findInstalledEntryMatch(entry, installedServers);+ const name = entry?.name ?? id;- return {- id: `mcp-${entry.id}`,- node: (- <span className={cn(extensionModuleCardPillClassName, "gap-1")}>- <McpLogoBadge entry={entry} size="xs" />- {entry.name}- {installed ? (- <span className="text-white">- {translate(I18nKey.RECOMMENDED_AUTOMATIONS$CONNECTED)}- </span>- ) : null}- </span>- ),- };- });+ return {+ id: `integration-${id}`,+ node: (+ <span className={cn(extensionModuleCardPillClassName, "gap-1")}>+ <McpLogoBadge entry={entry} size="xs" />+ {name}+ {installed ? (+ <span className="text-white">+ {translate(I18nKey.RECOMMENDED_AUTOMATIONS$CONNECTED)}+ </span>+ ) : !entry ? (+ <span+ className="text-tertiary-alt"+ data-testid={`recommended-automation-integration-${id}`}+ >+ {translate(I18nKey.RECOMMENDED_AUTOMATIONS$UNKNOWN_SETUP)}+ </span>+ ) : !mcpInstallable ? (+ <span+ className="text-tertiary-alt"+ data-testid={`automation-integration-external-${id}`}+ >+ {translate(I18nKey.RECOMMENDED_AUTOMATIONS$EXTERNAL_SETUP)}+ </span>+ ) : null}+ </span>+ ),+ };+ },+ );if (missingCount > 0) {pills.push({@@ -169,9 +202,15 @@ function AutomationCardGrid({return (<div className={cn("mt-3", extensionModuleCardGridClassName)}>{automations.map((automation) => {- const integrationEntries = getIntegrationEntries(automation);- const missingCount = integrationEntries.filter(- (entry) => !findInstalledEntryMatch(entry, installedServers),+ const integrations = getIntegrationEntries(automation);+ // "N MCPs to connect" only counts entries the install flow can+ // actually connect; an external-setup integration is surfaced on its+ // own pill instead.+ const missingCount = integrations.filter(+ ({ entry, mcpInstallable }) =>+ !!entry &&+ mcpInstallable &&+ !findInstalledEntryMatch(entry, installedServers),).length;return (@@ -187,7 +226,9 @@ function AutomationCardGrid({><div className="flex min-w-0 flex-1 items-start gap-3"><McpLogoStackBadge- entries={integrationEntries}+ entries={integrations.flatMap(({ entry }) =>+ entry ? [entry] : [],+ )}testId={`recommended-automation-icon-${automation.id}`}/><div className="flex min-w-0 flex-1 flex-col gap-3">@@ -210,7 +251,7 @@ function AutomationCardGrid({<SkillCardPillRowpills={buildRecommendedAutomationPills(- integrationEntries,+ integrations,installedServers,missingCount,translate,diff --git a/src/i18n/translation.json b/src/i18n/translation.jsonindex bc1611e176..dd3305d434 100644--- a/src/i18n/translation.json+++ b/src/i18n/translation.json@@ -33744,6 +33744,40 @@"tr": "Başlatmadan önce bağlanacak {{count}} MCP","uk": "{{count}} MCP потрібно підключити перед запуском"},+ "RECOMMENDED_AUTOMATIONS$EXTERNAL_SETUP": {+ "en": "Needs external setup",+ "ja": "外部セットアップが必要",+ "zh-CN": "需要外部配置",+ "zh-TW": "需要外部設定",+ "ko-KR": "외부 설정 필요",+ "no": "Krever ekstern konfigurasjon",+ "ar": "يتطلب إعدادًا خارجيًا",+ "de": "Externe Einrichtung erforderlich",+ "fr": "Configuration externe requise",+ "it": "Richiede configurazione esterna",+ "pt": "Requer configuração externa",+ "es": "Requiere configuración externa",+ "ca": "Requereix configuració externa",+ "tr": "Harici kurulum gerektirir",+ "uk": "Потрібне зовнішнє налаштування"+ },+ "RECOMMENDED_AUTOMATIONS$UNKNOWN_SETUP": {+ "en": "Integration unavailable",+ "ja": "統合を利用できません",+ "zh-CN": "集成不可用",+ "zh-TW": "整合不可用",+ "ko-KR": "통합을 사용할 수 없음",+ "no": "Integrasjonen er ikke tilgjengelig",+ "ar": "التكامل غير متاح",+ "de": "Integration nicht verfügbar",+ "fr": "Intégration indisponible",+ "it": "Integrazione non disponibile",+ "pt": "Integração indisponível",+ "es": "Integración no disponible",+ "ca": "Integració no disponible",+ "tr": "Entegrasyon kullanılamıyor",+ "uk": "Інтеграція недоступна"+ },"RECOMMENDED_AUTOMATIONS$MODAL_AGENT_PROMPT": {"en": "Agent prompt","ja": "エージェントプロンプト",diff --git a/src/utils/mcp-marketplace-utils.ts b/src/utils/mcp-marketplace-utils.tsindex 784e53889a..7452ff1304 100644--- a/src/utils/mcp-marketplace-utils.ts+++ b/src/utils/mcp-marketplace-utils.ts@@ -110,7 +110,17 @@ export function getMcpOAuthAuthenticationConfig(export function getMcpMarketplaceCatalog(catalog: MarketplaceEntry[],): MarketplaceEntry[] {- return catalog.filter((entry) => !!getDefaultMcpConnectionOption(entry));+ return catalog.filter(isMcpInstallableEntry);+}++/**+ * Whether this backend can install/configure the entry as an MCP server.+ * Entries whose only connection options use another provider or transport+ * (e.g. Jira's HTTP/OpenAPI option) exist in the catalog but cannot go+ * through the local MCP install flow.+ */+export function isMcpInstallableEntry(entry: MarketplaceEntry): boolean {+ return !!getDefaultMcpConnectionOption(entry);}const tryUrl = (raw: string): URL | null => {