🙌 OpenHands: AI-Driven Development
feat: feature 3 proven workflows, group the rest under Beta (#1259)
Hiep Le3e311312b6ae
diff --git a/__tests__/components/automations/recommended-automations.test.tsx b/__tests__/components/automations/recommended-automations.test.tsxindex 217837590b..a95c570a71 100644--- a/__tests__/components/automations/recommended-automations.test.tsx+++ b/__tests__/components/automations/recommended-automations.test.tsx@@ -1,8 +1,15 @@import { QueryClient, QueryClientProvider } from "@tanstack/react-query";-import { fireEvent, render, screen, waitFor } from "@testing-library/react";+import {+ fireEvent,+ render,+ screen,+ waitFor,+ within,+} from "@testing-library/react";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import SettingsService from "#/api/settings-service/settings-service.api";import McpService from "#/api/mcp-service/mcp-service.api";+import { I18nKey } from "#/i18n/declaration";import { getConversationState } from "#/utils/conversation-local-storage";import {__resetActiveStoreForTests,@@ -126,34 +133,69 @@ describe("recommended automations", () => {__resetActiveStoreForTests();});- it("shows recommended automations in popularity order", () => {- const onSelect = vi.fn();-+ it("renders the proven automations before the beta ones, each in popularity order", () => {render(<RecommendedAutomationsSectionbackendKind="local"installedServers={[]}- onSelect={onSelect}+ onSelect={vi.fn()}/>,);- const cards = screen.getAllByTestId(/^recommended-automation-card-/);- expect(cards[0]).toHaveAttribute(- "data-testid",- "recommended-automation-card-github-pr-reviewer",+ const cardIds = screen+ .getAllByTestId(/^recommended-automation-card-/)+ .map((card) =>+ card+ .getAttribute("data-testid")+ ?.replace("recommended-automation-card-", ""),+ );++ expect(cardIds).toEqual([+ "github-pr-reviewer",+ "github-repo-monitor",+ "slack-channel-monitor",+ "slack-standup-digest",+ "linear-triage-assistant",+ "research-brief-writer",+ "incident-retrospective-drafter",+ ]);+ });++ it("groups the non-proven automations under a labeled Beta section", () => {+ render(+ <RecommendedAutomationsSection+ backendKind="local"+ installedServers={[]}+ onSelect={vi.fn()}+ />,);- expect(cards[1]).toHaveAttribute(- "data-testid",- "recommended-automation-card-github-repo-monitor",++ const provenHeading = screen.getByText(+ I18nKey.RECOMMENDED_AUTOMATIONS$SECTION_TITLE,+ ).parentElement!;+ expect(within(provenHeading).getByText("3")).toBeInTheDocument();++ const betaHeading = screen.getByTestId(+ "recommended-automations-beta-heading",);- expect(cards[2]).toHaveAttribute(- "data-testid",- "recommended-automation-card-slack-standup-digest",+ expect(betaHeading).toHaveTextContent(+ I18nKey.RECOMMENDED_AUTOMATIONS$BETA_LABEL,);- expect(cards[3]).toHaveAttribute(- "data-testid",- "recommended-automation-card-slack-channel-monitor",+ expect(within(betaHeading).getByText("4")).toBeInTheDocument();++ const betaSection = screen.getByTestId(+ "recommended-automations-beta-section",);+ expect(+ within(betaSection).getByTestId(+ "recommended-automation-card-slack-standup-digest",+ ),+ ).toBeInTheDocument();+ expect(+ within(betaSection).queryByTestId(+ "recommended-automation-card-github-pr-reviewer",+ ),+ ).not.toBeInTheDocument();});it("sorts recommendation popularity deterministically when ranks are missing or tied", () => {diff --git a/src/components/features/automations/recommended-automations-section.tsx b/src/components/features/automations/recommended-automations-section.tsxindex f6e985dadf..e95c10b528 100644--- a/src/components/features/automations/recommended-automations-section.tsx+++ b/src/components/features/automations/recommended-automations-section.tsx@@ -56,6 +56,21 @@ export function getAutomationsByPopularity(const RECOMMENDED_AUTOMATIONS = getAutomationsByPopularity(AUTOMATION_CATALOG);+/**+ * Launch allowlist — proven automations featured above the Beta group.+ * NOT derived from popularityRank (slack-standup-digest@94 outranks+ * slack-channel-monitor@92 yet is Beta). A future flag could swap this set.+ */+export const PROVEN_AUTOMATION_IDS = [+ "github-pr-reviewer",+ "github-repo-monitor",+ "slack-channel-monitor",+] as const;++function isProvenAutomation(automation: RecommendedAutomation): boolean {+ return (PROVEN_AUTOMATION_IDS as readonly string[]).includes(automation.id);+}+function getRequiredEntries(automation: RecommendedAutomation) {const mcpMarketplace = getMcpMarketplaceCatalog(MCP_MARKETPLACE);return automation.requiredIntegrationIds@@ -133,6 +148,79 @@ function buildRecommendedAutomationPills(return pills;}+interface AutomationCardGridProps {+ automations: RecommendedAutomation[];+ installedServers: MCPServerConfig[];+ onSelect: (automation: RecommendedAutomation) => void;+ translate: TFunction;+}++function AutomationCardGrid({+ automations,+ installedServers,+ onSelect,+ translate,+}: AutomationCardGridProps) {+ return (+ <div className={cn("mt-3", extensionModuleCardGridClassName)}>+ {automations.map((automation) => {+ const requiredEntries = getRequiredEntries(automation);+ const missingCount = requiredEntries.filter(+ (entry) => !findInstalledEntryMatch(entry, installedServers),+ ).length;++ return (+ <button+ key={automation.id}+ type="button"+ data-testid={`recommended-automation-card-${automation.id}`}+ onClick={() => onSelect(automation)}+ className={cn(+ "flex min-w-0 overflow-hidden p-4 text-left rounded-xl bg-surface-raised",+ extensionModuleCardInteractiveClassName,+ )}+ >+ <div className="flex min-w-0 flex-1 items-start gap-3">+ <McpLogoStackBadge+ entries={requiredEntries}+ testId={`recommended-automation-icon-${automation.id}`}+ />+ <div className="flex min-w-0 flex-1 flex-col gap-3">+ <header className="flex items-start justify-between gap-3">+ <div className="min-w-0 flex-1">+ <h3 className="truncate text-sm font-semibold text-white">+ {automation.name}+ </h3>+ <p className="mt-0.5 truncate text-xs text-tertiary-alt">+ {automation.category}+ </p>+ </div>+ <CirclePlusBadge+ testId={`recommended-automation-plus-${automation.id}`}+ />+ </header>+ <p className="line-clamp-2 text-xs leading-relaxed text-tertiary-light">+ {automation.description}+ </p>++ <SkillCardPillRow+ pills={buildRecommendedAutomationPills(+ requiredEntries,+ installedServers,+ missingCount,+ translate,+ )}+ testId={`recommended-automation-pills-${automation.id}`}+ />+ </div>+ </div>+ </button>+ );+ })}+ </div>+ );+}+export function RecommendedAutomationsSection({backendKind,installedServers,@@ -152,6 +240,11 @@ export function RecommendedAutomationsSection({if (visibleAutomations.length === 0) return null;+ const provenAutomations = visibleAutomations.filter(isProvenAutomation);+ const betaAutomations = visibleAutomations.filter(+ (automation) => !isProvenAutomation(automation),+ );+return (<sectiondata-testid="recommended-automations-section"@@ -168,72 +261,50 @@ export function RecommendedAutomationsSection({"min-h-0 flex-1 overflow-y-auto custom-scrollbar-always",)}>- <div className="flex items-center">- <h2 className="text-base font-semibold text-foreground">- {t(I18nKey.RECOMMENDED_AUTOMATIONS$SECTION_TITLE)}- </h2>- <StatusBadge count={visibleAutomations.length} />- </div>- <p className="mt-1 text-sm text-muted">- {t(I18nKey.RECOMMENDED_AUTOMATIONS$SECTION_DESCRIPTION)}- </p>-- <div className={cn("mt-3", extensionModuleCardGridClassName)}>- {visibleAutomations.map((automation) => {- const requiredEntries = getRequiredEntries(automation);- const missingCount = requiredEntries.filter(- (entry) => !findInstalledEntryMatch(entry, installedServers),- ).length;-- return (- <button- key={automation.id}- type="button"- data-testid={`recommended-automation-card-${automation.id}`}- onClick={() => onSelect(automation)}- className={cn(- "flex min-w-0 overflow-hidden p-4 text-left rounded-xl bg-surface-raised",- extensionModuleCardInteractiveClassName,- )}- >- <div className="flex min-w-0 flex-1 items-start gap-3">- <McpLogoStackBadge- entries={requiredEntries}- testId={`recommended-automation-icon-${automation.id}`}- />- <div className="flex min-w-0 flex-1 flex-col gap-3">- <header className="flex items-start justify-between gap-3">- <div className="min-w-0 flex-1">- <h3 className="truncate text-sm font-semibold text-white">- {automation.name}- </h3>- <p className="mt-0.5 truncate text-xs text-tertiary-alt">- {automation.category}- </p>- </div>- <CirclePlusBadge- testId={`recommended-automation-plus-${automation.id}`}- />- </header>- <p className="line-clamp-2 text-xs leading-relaxed text-tertiary-light">- {automation.description}- </p>+ {provenAutomations.length > 0 && (+ <>+ <div className="flex items-center">+ <h2 className="text-base font-semibold text-foreground">+ {t(I18nKey.RECOMMENDED_AUTOMATIONS$SECTION_TITLE)}+ </h2>+ <StatusBadge count={provenAutomations.length} />+ </div>+ <p className="mt-1 text-sm text-muted">+ {t(I18nKey.RECOMMENDED_AUTOMATIONS$SECTION_DESCRIPTION)}+ </p>- <SkillCardPillRow- pills={buildRecommendedAutomationPills(- requiredEntries,- installedServers,- missingCount,- t,- )}- testId={`recommended-automation-pills-${automation.id}`}- />- </div>- </div>- </button>- );- })}- </div>+ <AutomationCardGrid+ automations={provenAutomations}+ installedServers={installedServers}+ onSelect={onSelect}+ translate={t}+ />+ </>+ )}++ {betaAutomations.length > 0 && (+ <section+ data-testid="recommended-automations-beta-section"+ className={cn(provenAutomations.length > 0 && "mt-8")}+ >+ <div+ data-testid="recommended-automations-beta-heading"+ className="flex items-center"+ >+ <h2 className="text-base font-semibold text-foreground">+ {t(I18nKey.RECOMMENDED_AUTOMATIONS$BETA_LABEL)}+ </h2>+ <StatusBadge count={betaAutomations.length} />+ </div>++ <AutomationCardGrid+ automations={betaAutomations}+ installedServers={installedServers}+ onSelect={onSelect}+ translate={t}+ />+ </section>+ )}</div></section>);diff --git a/src/i18n/translation.json b/src/i18n/translation.jsonindex 5f293b0c88..a682cc609e 100644--- a/src/i18n/translation.json+++ b/src/i18n/translation.json@@ -29630,6 +29630,23 @@"tr": "Her şablon bir ajan istemini, uygulama taslağını ve onu kullanışlı kılan MCP'leri içerir. Önceden doldurulmuş bir konuşma açmak ve ayrıntıları ajanla tamamlamak için birini seçin.","uk": "Кожен шаблон містить запит для агента, ескіз реалізації та MCP, потрібні, щоб зробити його корисним. Виберіть один, щоб відкрити попередньо заповнену розмову й завершити деталі з агентом."},+ "RECOMMENDED_AUTOMATIONS$BETA_LABEL": {+ "en": "Beta",+ "ja": "ベータ",+ "zh-CN": "测试版",+ "zh-TW": "測試版",+ "ko-KR": "베타",+ "no": "Beta",+ "ar": "تجريبي",+ "de": "Beta",+ "fr": "Bêta",+ "it": "Beta",+ "pt": "Beta",+ "es": "Beta",+ "ca": "Beta",+ "tr": "Beta",+ "uk": "Бета"+ },"RECOMMENDED_AUTOMATIONS$POPULARITY_SORTED": {"en": "Popularity sorted","ja": "人気順",