🙌 OpenHands: AI-Driven Development
feat: add automation tag filter and recognition (#16388)
Hiep Le60d6a150b625
diff --git a/__tests__/components/features/conversation-panel/conversation-card.test.tsx b/__tests__/components/features/conversation-panel/conversation-card.test.tsxindex 5d3ccef449..4ab9c2d99f 100644--- a/__tests__/components/features/conversation-panel/conversation-card.test.tsx+++ b/__tests__/components/features/conversation-panel/conversation-card.test.tsx@@ -629,6 +629,31 @@ describe("ConversationCard", () => {expect(chips[0]).toHaveTextContent("origin: review");});+ it("keeps the automation name/trigger chips but hides the automation id chips", () => {+ // The automation id/run-id tags are raw UUIDs consumed by the panel's+ // automation filter — chip noise — while the human-meaningful name and+ // trigger stay visible.+ renderWithProviders(+ <ConversationCard+ title="Conversation 1"+ selectedRepository={null}+ lastUpdatedAt="2021-10-01T12:00:00Z"+ showTags+ tags={{+ automationname: "Nightly Audit",+ automationtrigger: "cron",+ automationid: "3f2b6c1e-1111-4222-8333-abcdefabcdef",+ automationrunid: "run-0001",+ }}+ />,+ );++ const chips = screen.getAllByTestId("conversation-card-tag-chip");+ expect(chips).toHaveLength(2);+ expect(chips[0]).toHaveTextContent("automationname: Nightly Audit");+ expect(chips[1]).toHaveTextContent("automationtrigger: cron");+ });+it("hides the chips when showTags is omitted", () => {renderWithProviders(<ConversationCarddiff --git a/__tests__/components/features/conversation-panel/conversation-panel-filter-menu.test.tsx b/__tests__/components/features/conversation-panel/conversation-panel-filter-menu.test.tsxindex 37c2caaffb..5476db5fa7 100644--- a/__tests__/components/features/conversation-panel/conversation-panel-filter-menu.test.tsx+++ b/__tests__/components/features/conversation-panel/conversation-panel-filter-menu.test.tsx@@ -7,6 +7,7 @@ import {ConversationPanelFilterMenu,type ConversationPanelFilterMenuProps,} from "#/components/features/conversation-panel/conversation-panel-filter-menu";+import { UNNAMED_AUTOMATION_FACET } from "#/components/features/conversation-panel/conversation-panel-list-helpers";// ConversationPanelFilterMenu composes the extracted MenuHeading / MenuRow /// MenuSeparator components. Rendering it open exercises all three through@@ -26,6 +27,11 @@ function renderFilterMenu(setConversationSort: vi.fn(),threadScope: "all",setThreadScope: vi.fn(),+ automationFilterMode: "all",+ setAutomationFilterMode: vi.fn(),+ selectedAutomationNames: [],+ onToggleAutomationName: vi.fn(),+ automationNameFacets: [],showOlderConversations: false,toggleShowOlderConversations: vi.fn(),showRepoBranchMetadata: false,@@ -80,4 +86,63 @@ describe("ConversationPanelFilterMenu", () => {// Assertexpect(screen.getByTestId("delete-all-conversations")).toBeDisabled();});++ it("selects an automation filter mode and closes the menu", async () => {+ // Arrange: default mode is "all", so the trigger shows no active dot.+ const user = userEvent.setup();+ const props = renderFilterMenu();+ expect(+ screen.queryByTestId("automation-filter-active-indicator"),+ ).not.toBeInTheDocument();++ // Act+ await user.click(screen.getByTestId("automation-filter-hide"));++ // Assert+ expect(props.setAutomationFilterMode).toHaveBeenCalledWith(+ "hide-automations",+ );+ expect(props.setFilterMenuOpen).toHaveBeenCalledWith(false);+ });++ it("hides the automation-name rows outside only-automations mode", () => {+ // Arrange + Act+ renderFilterMenu({+ automationFilterMode: "hide-automations",+ automationNameFacets: ["Nightly Audit"],+ });++ // Assert+ expect(+ screen.queryByTestId("automation-name-filter-Nightly Audit"),+ ).not.toBeInTheDocument();+ });++ it("toggles automation names without closing the menu in only-automations mode", async () => {+ // Arrange: only-automations mode also lights the trigger's active dot;+ // the unnamed bucket renders with its translated label.+ const user = userEvent.setup();+ const props = renderFilterMenu({+ automationFilterMode: "only-automations",+ automationNameFacets: ["Nightly Audit", UNNAMED_AUTOMATION_FACET],+ selectedAutomationNames: ["Nightly Audit"],+ });+ expect(+ screen.getByTestId("automation-filter-active-indicator"),+ ).toBeInTheDocument();+ expect(+ screen.getByText("CONVERSATION_PANEL$AUTOMATION_UNNAMED"),+ ).toBeInTheDocument();++ // Act+ await user.click(+ screen.getByTestId(`automation-name-filter-${UNNAMED_AUTOMATION_FACET}`),+ );++ // Assert: the name toggles while the menu stays open for multi-select.+ expect(props.onToggleAutomationName).toHaveBeenCalledWith(+ UNNAMED_AUTOMATION_FACET,+ );+ expect(props.setFilterMenuOpen).not.toHaveBeenCalled();+ });});diff --git a/__tests__/components/features/conversation-panel/conversation-panel-list-helpers.test.ts b/__tests__/components/features/conversation-panel/conversation-panel-list-helpers.test.tsindex 3526f7a08a..f9edaaeb6c 100644--- a/__tests__/components/features/conversation-panel/conversation-panel-list-helpers.test.ts+++ b/__tests__/components/features/conversation-panel/conversation-panel-list-helpers.test.ts@@ -1,13 +1,17 @@import { describe, expect, it } from "vitest";import {+ applyAutomationConversationFilter,applyGroupFolderOrder,+ collectAutomationNameFacets,getGroupConversationPreview,groupConversations,GROUP_CONVERSATIONS_PREVIEW_LIMIT,+ isAutomationConversation,parseConversationTimeMs,moveGroupFolderOrder,resolvePinnedConversations,sortConversationsByField,+ UNNAMED_AUTOMATION_FACET,} from "#/components/features/conversation-panel/conversation-panel-list-helpers";import type { AppConversation } from "#/api/conversation-service/agent-server-conversation-service.types";import { ExecutionStatus } from "#/types/agent-server/core";@@ -414,4 +418,136 @@ describe("conversation-panel-list-helpers", () => {"ws:/workspace/alpha",]);});++ it("recognizes automation-born conversations via automation tags or the cloud trigger", () => {+ // Bundles the recognition facets: any automation tag key marks the+ // conversation (local backend, where `trigger` is always null), the+ // cloud backend's `trigger: "automation"` marks it even without tags,+ // and unrelated tags / null triggers do not.+ const taggedByName: AppConversation = {+ ...base,+ id: "tagged-name",+ title: "tagged-name",+ tags: { automationname: "Nightly Audit" },+ };+ const taggedByRunId: AppConversation = {+ ...base,+ id: "tagged-run",+ title: "tagged-run",+ tags: { automationrunid: "run-1" },+ };+ const cloudTriggered: AppConversation = {+ ...base,+ id: "cloud",+ title: "cloud",+ trigger: "automation",+ };+ const manual: AppConversation = {+ ...base,+ id: "manual",+ title: "manual",+ tags: { origin: "slack" },+ };+ expect(+ [taggedByName, taggedByRunId, cloudTriggered, manual].map(+ isAutomationConversation,+ ),+ ).toEqual([true, true, true, false]);+ });++ it("collects unique sorted automation-name facets with the unnamed bucket last", () => {+ const conversations: AppConversation[] = [+ {+ ...base,+ id: "b1",+ title: "b1",+ tags: { automationname: "PR Review Bot" },+ },+ {+ ...base,+ id: "unnamed",+ title: "unnamed",+ tags: { automationrunid: "run-1" },+ },+ {+ ...base,+ id: "a1",+ title: "a1",+ tags: { automationname: "Nightly Audit" },+ },+ {+ ...base,+ id: "a2",+ title: "a2",+ tags: { automationname: "Nightly Audit" },+ },+ { ...base, id: "manual", title: "manual" },+ ];+ expect(collectAutomationNameFacets(conversations)).toEqual([+ "Nightly Audit",+ "PR Review Bot",+ UNNAMED_AUTOMATION_FACET,+ ]);+ });++ const automationFilterFixtures: AppConversation[] = [+ { ...base, id: "manual", title: "manual" },+ {+ ...base,+ id: "audit",+ title: "audit",+ tags: { automationname: "Nightly Audit" },+ },+ {+ ...base,+ id: "unnamed",+ title: "unnamed",+ tags: { automationrunid: "run-1" },+ },+ ];+ const automationFilterFacets = ["Nightly Audit", UNNAMED_AUTOMATION_FACET];++ it("hides automation runs under the hide-automations filter mode", () => {+ expect(+ applyAutomationConversationFilter(+ automationFilterFixtures,+ "hide-automations",+ [],+ automationFilterFacets,+ ).map((c) => c.id),+ ).toEqual(["manual"]);+ });++ it("keeps only automation runs under only-automations, narrowed by the selected name facets", () => {+ expect(+ applyAutomationConversationFilter(+ automationFilterFixtures,+ "only-automations",+ [],+ automationFilterFacets,+ ).map((c) => c.id),+ ).toEqual(["audit", "unnamed"]);++ expect(+ applyAutomationConversationFilter(+ automationFilterFixtures,+ "only-automations",+ [UNNAMED_AUTOMATION_FACET],+ automationFilterFacets,+ ).map((c) => c.id),+ ).toEqual(["unnamed"]);+ });++ it("degrades a stale name selection to all automation runs instead of an empty list", () => {+ // Selected names persist across backends/renames; when none intersect+ // the currently available facets the narrowing must self-heal.+ expect(+ applyAutomationConversationFilter(+ automationFilterFixtures,+ "only-automations",+ ["Renamed Automation"],+ automationFilterFacets,+ ).map((c) => c.id),+ ).toEqual(["audit", "unnamed"]);+ });});diff --git a/__tests__/components/features/conversation-panel/conversation-panel.test.tsx b/__tests__/components/features/conversation-panel/conversation-panel.test.tsxindex 599dc7848f..35d2e5a7a9 100644--- a/__tests__/components/features/conversation-panel/conversation-panel.test.tsx+++ b/__tests__/components/features/conversation-panel/conversation-panel.test.tsx@@ -114,6 +114,10 @@ describe("ConversationPanel", () => {mockStopConversationMutate.mockClear();_mockConversationCounter = 0;usePinnedConversationsStore.setState({ pinsByBackendId: {} });+ useConversationPanelPreferencesStore.setState({+ automationFilterMode: "all",+ selectedAutomationNames: [],+ });// Setup default mock for searchConversationsvi.spyOn(AgentServerConversationService,@@ -182,6 +186,89 @@ describe("ConversationPanel", () => {).not.toBeInTheDocument();});+ it("scopes the list to the automation filter mode across hide and only", async () => {+ // Arrange: two manual conversations plus one automation run recognized+ // by its tags (local backend) and one by its trigger (cloud backend).+ vi.spyOn(+ AgentServerConversationService,+ "searchConversations",+ ).mockResolvedValue({+ items: [+ createMockConversation({ id: "1", title: "Manual 1" }),+ createMockConversation({ id: "2", title: "Manual 2" }),+ createMockConversation({+ id: "3",+ title: "Tagged Run",+ tags: { automationname: "Nightly Audit", automationtrigger: "cron" },+ }),+ createMockConversation({+ id: "4",+ title: "Cloud Run",+ trigger: "automation",+ }),+ ],+ next_page_id: null,+ });+ useConversationPanelPreferencesStore.setState({+ automationFilterMode: "hide-automations",+ });++ // Act + Assert: hide mode keeps only the manual conversations.+ renderConversationPanel();+ const cards = await screen.findAllByTestId("conversation-card");+ expect(cards).toHaveLength(2);+ expect(screen.queryByText("Tagged Run")).not.toBeInTheDocument();+ expect(screen.queryByText("Cloud Run")).not.toBeInTheDocument();++ // Act + Assert: only mode inverts the scope.+ act(() => {+ useConversationPanelPreferencesStore.setState({+ automationFilterMode: "only-automations",+ });+ });+ expect(await screen.findByText("Tagged Run")).toBeInTheDocument();+ expect(screen.getByText("Cloud Run")).toBeInTheDocument();+ expect(screen.queryByText("Manual 1")).not.toBeInTheDocument();+ });++ it("keeps load more reachable with the filtered empty message when the automation filter hides every loaded conversation", async () => {+ // Arrange: page 1 holds only an automation run (hidden by the active+ // filter); a manual conversation sits on page 2.+ const user = userEvent.setup();+ vi.spyOn(AgentServerConversationService, "searchConversations")+ .mockResolvedValueOnce({+ items: [+ createMockConversation({+ id: "run",+ title: "Tagged Run",+ tags: { automationrunid: "run-1" },+ }),+ ],+ next_page_id: "page-2",+ })+ .mockResolvedValueOnce({+ items: [createMockConversation({ id: "manual", title: "Manual 1" })],+ next_page_id: null,+ });+ useConversationPanelPreferencesStore.setState({+ automationFilterMode: "hide-automations",+ });++ renderConversationPanel();++ // Assert: the filter-specific empty message shows, and unlike the+ // genuinely-empty case above, load more stays reachable.+ await screen.findByText("CONVERSATION_PANEL$NO_AUTOMATION_MATCHES");+ const loadMore = await screen.findByTestId("load-more-conversations");++ // Act: fetching the next page surfaces the manual conversation.+ await user.click(loadMore);+ expect(await screen.findByText("Manual 1")).toBeInTheDocument();+ expect(+ screen.queryByText("CONVERSATION_PANEL$NO_AUTOMATION_MATCHES"),+ ).not.toBeInTheDocument();+ });+it("does not flash the loading skeleton during a background refetch when the list is empty", async () => {// Arrange: first call (initial load) resolves with an empty list.// Second call (the background refetch) is kept in-flight so we candiff --git a/__tests__/stores/conversation-panel-preferences-store.test.ts b/__tests__/stores/conversation-panel-preferences-store.test.tsindex 6e52d2fe20..26ccc461f3 100644--- a/__tests__/stores/conversation-panel-preferences-store.test.ts+++ b/__tests__/stores/conversation-panel-preferences-store.test.ts@@ -17,6 +17,8 @@ describe("conversation-panel-preferences store", () => {expect(state.organizeMode).toBe("chronological");expect(state.conversationSort).toBe("updated");expect(state.threadScope).toBe("all");+ expect(state.automationFilterMode).toBe("all");+ expect(state.selectedAutomationNames).toEqual([]);});it("toggles showOlderConversations and persists the new value to localStorage", () => {@@ -71,9 +73,11 @@ describe("conversation-panel-preferences store", () => {window.localStorage.getItem(STORAGE_KEY) ?? "{}",);expect(Object.keys(persisted.state).sort()).toEqual([+ "automationFilterMode","conversationSort","groupFolderOrder","organizeMode",+ "selectedAutomationNames","showHoverMetadata","showLlmProfiles","showOlderConversations",@@ -115,6 +119,30 @@ describe("conversation-panel-preferences store", () => {});});+ it("updates the automation filter mode and toggles selected names via their actions", () => {+ const store = useConversationPanelPreferencesStore.getState();+ store.setAutomationFilterMode("only-automations");+ store.toggleAutomationName("Nightly Audit");+ store.toggleAutomationName("PR Review Bot");+ store.toggleAutomationName("Nightly Audit");++ const next = useConversationPanelPreferencesStore.getState();+ expect({+ automationFilterMode: next.automationFilterMode,+ selectedAutomationNames: next.selectedAutomationNames,+ }).toEqual({+ automationFilterMode: "only-automations",+ // Toggling twice removes the name again; the other selection stays.+ selectedAutomationNames: ["PR Review Bot"],+ });++ // Restore defaults so later tests in this file see a pristine store.+ useConversationPanelPreferencesStore.setState({+ automationFilterMode: "all",+ selectedAutomationNames: [],+ });+ });+it("rehydrates legacy localStorage payloads (older fields preserved, new fields filled with defaults)", async () => {// Simulate a user upgrading from a build that only persisted the two// original preferences. After rehydration the store should keep thediff --git a/src/api/agent-server-adapter.ts b/src/api/agent-server-adapter.tsindex 4ea06e28a4..c880927a93 100644--- a/src/api/agent-server-adapter.ts+++ b/src/api/agent-server-adapter.ts@@ -434,13 +434,34 @@ type ConversationSettingsPayload = SettingsRecord & {export const ACP_SERVER_TAG_KEY = "acpserver";+export const AUTOMATION_TRIGGER_TAG_KEY = "automationtrigger";+export const AUTOMATION_ID_TAG_KEY = "automationid";+export const AUTOMATION_NAME_TAG_KEY = "automationname";+export const AUTOMATION_RUN_ID_TAG_KEY = "automationrunid";++/**+ * Tag keys stamped on conversations created by automation runs (see the SDK's+ * `RemoteWorkspace.default_conversation_tags`). The presence of any of these+ * marks a conversation as automation-born.+ */+export const AUTOMATION_TAG_KEYS: readonly string[] = [+ AUTOMATION_TRIGGER_TAG_KEY,+ AUTOMATION_ID_TAG_KEY,+ AUTOMATION_NAME_TAG_KEY,+ AUTOMATION_RUN_ID_TAG_KEY,+];+/*** Conversation tag keys Canvas itself stamps/consumes for internal routing.- * They are already surfaced through dedicated UI (the ACP provider chip), so- * the generic tag-chip display filters them out.+ * They are already surfaced through dedicated UI (the ACP provider chip, the+ * automation filter in the conversation panel), so the generic tag-chip+ * display filters them out. The automation id/run-id keys are raw UUIDs —+ * chip noise — while `automationname`/`automationtrigger` stay visible.*/export const RESERVED_CONVERSATION_TAG_KEYS: ReadonlySet<string> = new Set([ACP_SERVER_TAG_KEY,+ AUTOMATION_ID_TAG_KEY,+ AUTOMATION_RUN_ID_TAG_KEY,]);/**diff --git a/src/api/open-hands.types.ts b/src/api/open-hands.types.tsindex 072a1e8078..f6e41cc5c7 100644--- a/src/api/open-hands.types.ts+++ b/src/api/open-hands.types.ts@@ -60,7 +60,8 @@ export type ConversationTrigger =| "resolver"| "gui"| "suggested_task"- | "microagent_management";+ | "microagent_management"+ | "automation";export interface Conversation {conversation_id: string;diff --git a/src/components/features/conversation-panel/conversation-panel-filter-menu.tsx b/src/components/features/conversation-panel/conversation-panel-filter-menu.tsxindex c48f2415c8..172e37cc2a 100644--- a/src/components/features/conversation-panel/conversation-panel-filter-menu.tsx+++ b/src/components/features/conversation-panel/conversation-panel-filter-menu.tsx@@ -15,6 +15,7 @@ import {Star,Tag,Trash2,+ Workflow,} from "lucide-react";import { I18nKey } from "#/i18n/declaration";import type { BackendKind } from "#/api/backend-registry/types";@@ -24,10 +25,12 @@ import {dropdownMenuListClassName,dropdownMenuViewportScrollClassName,} from "#/utils/dropdown-classes";-import type {- ConversationSortField,- OrganizeMode,- ThreadScope,+import {+ UNNAMED_AUTOMATION_FACET,+ type AutomationFilterMode,+ type ConversationSortField,+ type OrganizeMode,+ type ThreadScope,} from "./conversation-panel-list-helpers";import { MenuHeading } from "./menu-heading";import { MenuSeparator } from "./menu-separator";@@ -47,6 +50,11 @@ export interface ConversationPanelFilterMenuProps {setConversationSort: (sort: ConversationSortField) => void;threadScope: ThreadScope;setThreadScope: (scope: ThreadScope) => void;+ automationFilterMode: AutomationFilterMode;+ setAutomationFilterMode: (mode: AutomationFilterMode) => void;+ selectedAutomationNames: string[];+ onToggleAutomationName: (name: string) => void;+ automationNameFacets: string[];showOlderConversations: boolean;toggleShowOlderConversations: () => void;showRepoBranchMetadata: boolean;@@ -72,6 +80,11 @@ export function ConversationPanelFilterMenu({setConversationSort,threadScope,setThreadScope,+ automationFilterMode,+ setAutomationFilterMode,+ selectedAutomationNames,+ onToggleAutomationName,+ automationNameFacets,showOlderConversations,toggleShowOlderConversations,showRepoBranchMetadata,@@ -154,7 +167,7 @@ export function ConversationPanelFilterMenu({aria-expanded={filterMenuOpen}onClick={() => setFilterMenuOpen(!filterMenuOpen)}className={cn(- "inline-flex h-7 w-7 items-center justify-center rounded-md text-[var(--oh-muted)] hover:text-white hover:bg-[var(--oh-surface-raised)]",+ "relative inline-flex h-7 w-7 items-center justify-center rounded-md text-[var(--oh-muted)] hover:text-white hover:bg-[var(--oh-surface-raised)]",dropdownInstantColorClassName,)}>@@ -165,6 +178,13 @@ export function ConversationPanelFilterMenu({strokeWidth={2}aria-hidden/>+ {automationFilterMode !== "all" ? (+ <span+ aria-hidden+ data-testid="automation-filter-active-indicator"+ className="absolute right-0.5 top-0.5 h-1.5 w-1.5 rounded-full bg-[var(--oh-accent)]"+ />+ ) : null}</button>{filterMenuOpen ? (@@ -249,6 +269,58 @@ export function ConversationPanelFilterMenu({}}/>+ <MenuSeparator />+ <MenuHeading>{t(I18nKey.CONVERSATION_PANEL$AUTOMATIONS)}</MenuHeading>+ <MenuRow+ icon={MessageCircle}+ label={t(I18nKey.CONVERSATION_PANEL$AUTOMATIONS_ALL)}+ selected={automationFilterMode === "all"}+ testId="automation-filter-all"+ onClick={() => {+ setAutomationFilterMode("all");+ setFilterMenuOpen(false);+ }}+ />+ <MenuRow+ icon={EyeOff}+ label={t(I18nKey.CONVERSATION_PANEL$AUTOMATIONS_HIDE)}+ selected={automationFilterMode === "hide-automations"}+ testId="automation-filter-hide"+ onClick={() => {+ setAutomationFilterMode("hide-automations");+ setFilterMenuOpen(false);+ }}+ />+ <MenuRow+ icon={Workflow}+ label={t(I18nKey.CONVERSATION_PANEL$AUTOMATIONS_ONLY)}+ selected={automationFilterMode === "only-automations"}+ testId="automation-filter-only"+ onClick={() => {+ setAutomationFilterMode("only-automations");+ setFilterMenuOpen(false);+ }}+ />+ {automationFilterMode === "only-automations"+ ? automationNameFacets.map((facet) => (+ <MenuRow+ key={facet}+ icon={Tag}+ label={+ facet === UNNAMED_AUTOMATION_FACET+ ? t(I18nKey.CONVERSATION_PANEL$AUTOMATION_UNNAMED)+ : facet+ }+ selected={selectedAutomationNames.includes(facet)}+ testId={`automation-name-filter-${facet}`}+ // Multi-select name rows keep the menu open (unlike the+ // mode radios above) so several names can be toggled in+ // one visit.+ onClick={() => onToggleAutomationName(facet)}+ />+ ))+ : null}+<MenuSeparator /><MenuHeading>{t(I18nKey.CONVERSATION_PANEL$METADATA)}</MenuHeading><MenuRowdiff --git a/src/components/features/conversation-panel/conversation-panel-list-helpers.ts b/src/components/features/conversation-panel/conversation-panel-list-helpers.tsindex ef82893efd..362fb0512a 100644--- a/src/components/features/conversation-panel/conversation-panel-list-helpers.ts+++ b/src/components/features/conversation-panel/conversation-panel-list-helpers.ts@@ -1,10 +1,18 @@import type { AppConversation } from "#/api/conversation-service/agent-server-conversation-service.types";import type { BackendKind } from "#/api/backend-registry/types";import type { Provider } from "#/types/settings";+import {+ AUTOMATION_NAME_TAG_KEY,+ AUTOMATION_TAG_KEYS,+} from "#/api/agent-server-adapter";export type ConversationSortField = "created" | "updated";export type ThreadScope = "all" | "relevant";export type OrganizeMode = "grouped" | "chronological";+export type AutomationFilterMode =+ | "all"+ | "hide-automations"+ | "only-automations";/** Max conversations shown under a workspace/repo folder before "View more". */export const GROUP_CONVERSATIONS_PREVIEW_LIMIT = 5;@@ -85,6 +93,94 @@ export function filterOutPinnedConversations();}+/**+ * Facet bucket for automation-born conversations that carry no+ * `automationname` tag (double-underscore prefix mirrors the+ * `__none_workspace` group-id idiom).+ */+export const UNNAMED_AUTOMATION_FACET = "__unnamed__";++/**+ * Whether a conversation was created by an automation run: the cloud backend+ * stamps `trigger: "automation"`, while local agent-server conversations are+ * recognized by the automation tags the SDK workspace attaches at creation.+ */+export function isAutomationConversation(+ conversation: AppConversation,+): boolean {+ if (conversation.trigger === "automation") {+ return true;+ }+ const tags = conversation.tags;+ if (!tags) {+ return false;+ }+ return AUTOMATION_TAG_KEYS.some((key) => Boolean(tags[key]));+}++export function getAutomationNameFacet(conversation: AppConversation): string {+ const name = conversation.tags?.[AUTOMATION_NAME_TAG_KEY]?.trim();+ return name || UNNAMED_AUTOMATION_FACET;+}++/**+ * Unique automation names among the given conversations, sorted for stable+ * menu order; the unnamed bucket (if present) is appended last.+ */+export function collectAutomationNameFacets(+ conversations: readonly AppConversation[],+): string[] {+ const names = new Set<string>();+ let hasUnnamed = false;+ for (const conversation of conversations) {+ if (!isAutomationConversation(conversation)) {+ continue;+ }+ const facet = getAutomationNameFacet(conversation);+ if (facet === UNNAMED_AUTOMATION_FACET) {+ hasUnnamed = true;+ } else {+ names.add(facet);+ }+ }+ const sorted = [...names].sort((a, b) => a.localeCompare(b));+ if (hasUnnamed) {+ sorted.push(UNNAMED_AUTOMATION_FACET);+ }+ return sorted;+}++export function applyAutomationConversationFilter(+ conversations: readonly AppConversation[],+ mode: AutomationFilterMode,+ selectedNames: readonly string[],+ availableFacets: readonly string[],+): AppConversation[] {+ if (mode === "all") {+ return [...conversations];+ }+ if (mode === "hide-automations") {+ return conversations.filter(+ (conversation) => !isAutomationConversation(conversation),+ );+ }+ // "only-automations": an empty selection means every automation run, and a+ // selection that no longer intersects the available facets (stale names+ // persisted from another backend, renamed automations) degrades the same+ // way instead of yielding an unfillable empty list.+ const facetSet = new Set(availableFacets);+ const effectiveNames = selectedNames.filter((name) => facetSet.has(name));+ const narrowing = effectiveNames.length > 0 ? new Set(effectiveNames) : null;+ return conversations.filter((conversation) => {+ if (!isAutomationConversation(conversation)) {+ return false;+ }+ return (+ narrowing === null || narrowing.has(getAutomationNameFacet(conversation))+ );+ });+}+/** Subset of `useCreateConversation` variables for launching from a group row */export type ConversationGroupLaunch = {workingDir?: string;diff --git a/src/components/features/conversation-panel/conversation-panel.tsx b/src/components/features/conversation-panel/conversation-panel.tsxindex 42e1bee8a4..44a4bc6f55 100644--- a/src/components/features/conversation-panel/conversation-panel.tsx+++ b/src/components/features/conversation-panel/conversation-panel.tsx@@ -35,7 +35,9 @@ import { ConversationPanelNewThreadPicker } from "./conversation-panel-new-threaimport { ConversationGroupFolderList } from "./conversation-group-folder-list";import { ConversationPanelPinnedSection } from "./conversation-panel-pinned-section";import {+ applyAutomationConversationFilter,applyGroupFolderOrder,+ collectAutomationNameFacets,filterOutPinnedConversations,groupConversations,resolvePinnedConversations,@@ -154,6 +156,18 @@ export function ConversationPanel({const setThreadScope = useConversationPanelPreferencesStore((state) => state.setThreadScope,);+ const automationFilterMode = useConversationPanelPreferencesStore(+ (state) => state.automationFilterMode,+ );+ const setAutomationFilterMode = useConversationPanelPreferencesStore(+ (state) => state.setAutomationFilterMode,+ );+ const selectedAutomationNames = useConversationPanelPreferencesStore(+ (state) => state.selectedAutomationNames,+ );+ const toggleAutomationName = useConversationPanelPreferencesStore(+ (state) => state.toggleAutomationName,+ );const groupFolderOrder = useConversationPanelPreferencesStore((state) => state.groupFolderOrder,);@@ -255,6 +269,29 @@ export function ConversationPanel({});}, [data]);+ // Facets derive from the unfiltered list so the automation-name rows in the+ // filter menu don't vanish while a narrowing selection is active.+ const automationNameFacets = React.useMemo(+ () => collectAutomationNameFacets(conversations),+ [conversations],+ );++ const automationFilteredConversations = React.useMemo(+ () =>+ applyAutomationConversationFilter(+ conversations,+ automationFilterMode,+ selectedAutomationNames,+ automationNameFacets,+ ),+ [+ automationFilterMode,+ automationNameFacets,+ conversations,+ selectedAutomationNames,+ ],+ );+const pinnedConversations = React.useMemo(() => resolvePinnedConversations(pinnedIds, conversations),[conversations, pinnedIds],@@ -282,10 +319,14 @@ export function ConversationPanel({}, [pinnedIds.length]);const scopedConversations = React.useMemo(() => {+ // The pinned section intentionally bypasses the automation filter (same+ // exemption the thread scope has): a pin is an explicit user override.const scopeFiltered =threadScope === "relevant"- ? conversations.filter((c) => isExecutionActive(c.execution_status))- : conversations;+ ? automationFilteredConversations.filter((c) =>+ isExecutionActive(c.execution_status),+ )+ : automationFilteredConversations;// In the expanded panel, pinned conversations should only appear inside// the dedicated pinned section (not duplicated in grouped/flat lists).@@ -294,7 +335,7 @@ export function ConversationPanel({}return filterOutPinnedConversations(scopeFiltered, pinnedIds);- }, [compact, conversations, pinnedIds, threadScope]);+ }, [automationFilteredConversations, compact, pinnedIds, threadScope]);const { recent: recentScoped, older: olderScoped } = React.useMemo(() => partitionByCutoff(scopedConversations),@@ -390,6 +431,16 @@ export function ConversationPanel({? visibleGroupedCount === 0: visibleFlatCount === 0;+ // Attribution is exact: the automation filter step itself produced zero+ // rows out of a non-empty loaded set (not merely threadScope/older-cutoff+ // effects). Used to keep "Load more" reachable and to pick the empty-state+ // message.+ const emptyDueToAutomationFilter =+ listIsEffectivelyEmpty &&+ automationFilterMode !== "all" &&+ conversations.length > 0 &&+ automationFilteredConversations.length === 0;+// Number of conversations actually rendered in the list right now, in the// current organize mode. "Load more" succeeds only when this number grows.const visibleCount =@@ -469,10 +520,15 @@ export function ConversationPanel({const olderHidden = olderScoped.length > 0 && !showOlderConversations;// Compact mode also hides "Load more" — paginating into archived// conversations contradicts the "active only" intent of the icon rail.- // Do not show when the visible list is empty (e.g. filters hide every- // loaded conversation) — that state already shows "No conversations found".+ // Do not show when the visible list is empty (that state already shows+ // "No conversations found") — unless the automation filter alone emptied+ // it while more pages exist: then the button must stay reachable so the+ // load-more driver can keep fetching until a matching run surfaces.const showLoadMore =- !!hasNextPage && !olderHidden && !compact && !listIsEffectivelyEmpty;+ !!hasNextPage &&+ !olderHidden &&+ !compact &&+ (!listIsEffectivelyEmpty || emptyDueToAutomationFilter);const { mutate: createConversation } = useCreateConversation();const isCreatingConversationFlow = useIsCreatingConversation();@@ -771,6 +827,11 @@ export function ConversationPanel({setConversationSort={setConversationSort}threadScope={threadScope}setThreadScope={setThreadScope}+ automationFilterMode={automationFilterMode}+ setAutomationFilterMode={setAutomationFilterMode}+ selectedAutomationNames={selectedAutomationNames}+ onToggleAutomationName={toggleAutomationName}+ automationNameFacets={automationNameFacets}showOlderConversations={showOlderConversations}toggleShowOlderConversations={toggleShowOlderConversations}showRepoBranchMetadata={showRepoBranchMetadata}@@ -808,7 +869,11 @@ export function ConversationPanel({className="flex min-h-0 flex-1 flex-col items-center justify-center px-4 py-8"><p className="text-xs text-[var(--oh-muted)]">- {t(I18nKey.CONVERSATION$NO_CONVERSATIONS)}+ {t(+ emptyDueToAutomationFilter+ ? I18nKey.CONVERSATION_PANEL$NO_AUTOMATION_MATCHES+ : I18nKey.CONVERSATION$NO_CONVERSATIONS,+ )}</p></div>)}diff --git a/src/i18n/translation.json b/src/i18n/translation.jsonindex 78b7004d0f..8899e70ee0 100644--- a/src/i18n/translation.json+++ b/src/i18n/translation.json@@ -18036,6 +18036,108 @@"tr": "Etiketler","uk": "Теги"},+ "CONVERSATION_PANEL$AUTOMATIONS": {+ "en": "Automations",+ "ja": "オートメーション",+ "zh-CN": "自动化",+ "zh-TW": "自動化",+ "ko-KR": "자동화",+ "no": "Automatiseringer",+ "ar": "الأتمتة",+ "de": "Automatisierungen",+ "fr": "Automatisations",+ "it": "Automazioni",+ "pt": "Automações",+ "es": "Automatizaciones",+ "ca": "Automatitzacions",+ "tr": "Otomasyonlar",+ "uk": "Автоматизації"+ },+ "CONVERSATION_PANEL$AUTOMATIONS_ALL": {+ "en": "All conversations",+ "ja": "すべての会話",+ "zh-CN": "所有对话",+ "zh-TW": "所有對話",+ "ko-KR": "모든 대화",+ "no": "Alle samtaler",+ "ar": "كل المحادثات",+ "de": "Alle Gespräche",+ "fr": "Toutes les conversations",+ "it": "Tutte le conversazioni",+ "pt": "Todas as conversas",+ "es": "Todas las conversaciones",+ "ca": "Totes les converses",+ "tr": "Tüm konuşmalar",+ "uk": "Усі розмови"+ },+ "CONVERSATION_PANEL$AUTOMATIONS_HIDE": {+ "en": "Hide automation runs",+ "ja": "オートメーションの実行を非表示",+ "zh-CN": "隐藏自动化运行",+ "zh-TW": "隱藏自動化執行",+ "ko-KR": "자동화 실행 숨기기",+ "no": "Skjul automatiseringskjøringer",+ "ar": "إخفاء تشغيلات الأتمتة",+ "de": "Automatisierungsläufe ausblenden",+ "fr": "Masquer les exécutions d'automatisation",+ "it": "Nascondi le esecuzioni delle automazioni",+ "pt": "Ocultar execuções de automação",+ "es": "Ocultar ejecuciones de automatización",+ "ca": "Amaga les execucions d'automatització",+ "tr": "Otomasyon çalıştırmalarını gizle",+ "uk": "Приховати запуски автоматизацій"+ },+ "CONVERSATION_PANEL$AUTOMATIONS_ONLY": {+ "en": "Only automation runs",+ "ja": "オートメーションの実行のみ",+ "zh-CN": "仅自动化运行",+ "zh-TW": "僅自動化執行",+ "ko-KR": "자동화 실행만",+ "no": "Kun automatiseringskjøringer",+ "ar": "تشغيلات الأتمتة فقط",+ "de": "Nur Automatisierungsläufe",+ "fr": "Uniquement les exécutions d'automatisation",+ "it": "Solo esecuzioni delle automazioni",+ "pt": "Apenas execuções de automação",+ "es": "Solo ejecuciones de automatización",+ "ca": "Només execucions d'automatització",+ "tr": "Yalnızca otomasyon çalıştırmaları",+ "uk": "Лише запуски автоматизацій"+ },+ "CONVERSATION_PANEL$AUTOMATION_UNNAMED": {+ "en": "Unnamed automation",+ "ja": "名前のないオートメーション",+ "zh-CN": "未命名自动化",+ "zh-TW": "未命名自動化",+ "ko-KR": "이름 없는 자동화",+ "no": "Automatisering uten navn",+ "ar": "أتمتة بلا اسم",+ "de": "Unbenannte Automatisierung",+ "fr": "Automatisation sans nom",+ "it": "Automazione senza nome",+ "pt": "Automação sem nome",+ "es": "Automatización sin nombre",+ "ca": "Automatització sense nom",+ "tr": "Adsız otomasyon",+ "uk": "Автоматизація без назви"+ },+ "CONVERSATION_PANEL$NO_AUTOMATION_MATCHES": {+ "en": "No conversations match the automation filter",+ "ja": "オートメーションフィルターに一致する会話はありません",+ "zh-CN": "没有对话匹配自动化筛选条件",+ "zh-TW": "沒有對話符合自動化篩選條件",+ "ko-KR": "자동화 필터와 일치하는 대화가 없습니다",+ "no": "Ingen samtaler samsvarer med automatiseringsfilteret",+ "ar": "لا توجد محادثات مطابقة لعامل تصفية الأتمتة",+ "de": "Keine Gespräche entsprechen dem Automatisierungsfilter",+ "fr": "Aucune conversation ne correspond au filtre d'automatisation",+ "it": "Nessuna conversazione corrisponde al filtro delle automazioni",+ "pt": "Nenhuma conversa corresponde ao filtro de automação",+ "es": "Ninguna conversación coincide con el filtro de automatización",+ "ca": "Cap conversa no coincideix amb el filtre d'automatització",+ "tr": "Otomasyon filtresiyle eşleşen konuşma yok",+ "uk": "Немає розмов, що відповідають фільтру автоматизацій"+ },"CONVERSATION_PANEL$HOVER_METADATA": {"en": "Hover metadata","ja": "ホバーメタデータ",diff --git a/src/stores/conversation-panel-preferences-store.ts b/src/stores/conversation-panel-preferences-store.tsindex f0adbded09..fe0e79237e 100644--- a/src/stores/conversation-panel-preferences-store.ts+++ b/src/stores/conversation-panel-preferences-store.ts@@ -1,6 +1,7 @@import { create } from "zustand";import { persist, createJSONStorage } from "zustand/middleware";import {+ type AutomationFilterMode,type ConversationSortField,type OrganizeMode,type ThreadScope,@@ -28,6 +29,8 @@ interface ConversationPanelPreferencesState {organizeMode: OrganizeMode;conversationSort: ConversationSortField;threadScope: ThreadScope;+ automationFilterMode: AutomationFilterMode;+ selectedAutomationNames: string[];groupFolderOrder: string[];}@@ -45,6 +48,8 @@ interface ConversationPanelPreferencesActions {setOrganizeMode: (value: OrganizeMode) => void;setConversationSort: (value: ConversationSortField) => void;setThreadScope: (value: ThreadScope) => void;+ setAutomationFilterMode: (value: AutomationFilterMode) => void;+ toggleAutomationName: (name: string) => void;setGroupFolderOrder: (order: readonly string[]) => void;}@@ -60,6 +65,8 @@ const initialState: ConversationPanelPreferencesState = {organizeMode: "chronological",conversationSort: "updated",threadScope: "all",+ automationFilterMode: "all",+ selectedAutomationNames: [],groupFolderOrder: [],};@@ -107,6 +114,18 @@ export const useConversationPanelPreferencesStore =setConversationSort: (value) =>set(() => ({ conversationSort: value })),setThreadScope: (value) => set(() => ({ threadScope: value })),+ setAutomationFilterMode: (value) =>+ set(() => ({ automationFilterMode: value })),+ toggleAutomationName: (name) =>+ set((state) => ({+ selectedAutomationNames: state.selectedAutomationNames.includes(+ name,+ )+ ? state.selectedAutomationNames.filter(+ (existing) => existing !== name,+ )+ : [...state.selectedAutomationNames, name],+ })),setGroupFolderOrder: (order) =>set(() => ({ groupFolderOrder: [...order] })),}),@@ -123,6 +142,8 @@ export const useConversationPanelPreferencesStore =organizeMode: state.organizeMode,conversationSort: state.conversationSort,threadScope: state.threadScope,+ automationFilterMode: state.automationFilterMode,+ selectedAutomationNames: state.selectedAutomationNames,groupFolderOrder: state.groupFolderOrder,}),},