Skip to content

🙌 OpenHands: AI-Driven Development

refactor: remove unused Recent Conversations section (#471)

Hiep Lef26ed89ea753
diff --git a/__tests__/components/features/conversation-panel/conversation-card.test.tsx b/__tests__/components/features/conversation-panel/conversation-card.test.tsx
index 5ac9d9cbe9..584e261c72 100644
--- a/__tests__/components/features/conversation-panel/conversation-card.test.tsx
+++ b/__tests__/components/features/conversation-panel/conversation-card.test.tsx
@@ -502,6 +502,21 @@ describe("ConversationCard", () => {
).not.toBeInTheDocument();
});
+ it("renders the status dot in the header when executionStatus is provided", () => {
+ renderWithProviders(
+ <ConversationCard
+ title="Conversation 1"
+ selectedRepository={null}
+ lastUpdatedAt="2021-10-01T12:00:00Z"
+ executionStatus={ExecutionStatus.RUNNING}
+ />,
+ );
+
+ expect(
+ screen.getByTestId("conversation-status-working"),
+ ).toBeInTheDocument();
+ });
+
const statusTable: [ExecutionStatus, boolean][] = [
[ExecutionStatus.RUNNING, true],
[ExecutionStatus.IDLE, true],
diff --git a/__tests__/components/features/home/conversation-status-dot.test.tsx b/__tests__/components/features/conversation-panel/conversation-status-dot.test.tsx
similarity index 94%
rename from __tests__/components/features/home/conversation-status-dot.test.tsx
rename to __tests__/components/features/conversation-panel/conversation-status-dot.test.tsx
index cedda5ace2..a7c5d4bc76 100644
--- a/__tests__/components/features/home/conversation-status-dot.test.tsx
+++ b/__tests__/components/features/conversation-panel/conversation-status-dot.test.tsx
@@ -3,7 +3,7 @@ import { screen } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest";
import { renderWithProviders } from "test-utils";
-import { ConversationStatusDot } from "#/components/features/home/recent-conversations/conversation-status-dot";
+import { ConversationStatusDot } from "#/components/features/conversation-panel/conversation-status-dot";
import { ExecutionStatus } from "#/types/agent-server/core/base/common";
vi.mock("#/components/shared/buttons/styled-tooltip", () => ({
diff --git a/__tests__/components/features/home/recent-conversation.test.tsx b/__tests__/components/features/home/recent-conversation.test.tsx
deleted file mode 100644
index 204383d21a..0000000000
--- a/__tests__/components/features/home/recent-conversation.test.tsx
+++ /dev/null
@@ -1,61 +0,0 @@
-import { screen } from "@testing-library/react";
-import { describe, it, expect, vi } from "vitest";
-import { renderWithProviders } from "test-utils";
-import { RecentConversation } from "#/components/features/home/recent-conversations/recent-conversation";
-import type { AppConversation } from "#/api/conversation-service/agent-server-conversation-service.types";
-import { ExecutionStatus } from "#/types/agent-server/core";
-
-vi.mock("react-i18next", async () => {
- const actual = await vi.importActual("react-i18next");
- return {
- ...actual,
- useTranslation: () => ({
- t: (key: string) => {
- const translations: Record<string, string> = {
- CONVERSATION$AGO: "ago",
- COMMON$NO_REPOSITORY: "No repository",
- };
- return translations[key] || key;
- },
- i18n: {
- changeLanguage: () => new Promise(() => {}),
- },
- }),
- };
-});
-
-const baseConversation: AppConversation = {
- id: "test-id",
- title: "Test Conversation",
- execution_status: ExecutionStatus.RUNNING,
- updated_at: "2021-10-01T12:00:00Z",
- created_at: "2021-10-01T12:00:00Z",
- selected_repository: null,
- selected_branch: null,
- git_provider: null,
- conversation_url: null,
- created_by_user_id: "user1",
- metrics: null,
- llm_model: null,
- trigger: null,
- pr_number: [],
- session_api_key: null,
- sandbox_id: null,
- sub_conversation_ids: [],
-};
-
-const renderRecentConversation = (conversation: AppConversation) =>
- renderWithProviders(<RecentConversation conversation={conversation} />);
-
-describe("RecentConversation - llm_model", () => {
- it("should not render the llm model even when provided", () => {
- renderRecentConversation({
- ...baseConversation,
- llm_model: "anthropic/claude-sonnet-4-20250514",
- });
-
- expect(
- screen.queryByTestId("recent-conversation-llm-model"),
- ).not.toBeInTheDocument();
- });
-});
diff --git a/__tests__/components/features/home/recent-conversations.test.tsx b/__tests__/components/features/home/recent-conversations.test.tsx
deleted file mode 100644
index 2ef9130027..0000000000
--- a/__tests__/components/features/home/recent-conversations.test.tsx
+++ /dev/null
@@ -1,56 +0,0 @@
-import { render, screen, waitFor } from "@testing-library/react";
-import { describe, it, expect, vi } from "vitest";
-import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
-import { createRoutesStub } from "react-router";
-import { RecentConversations } from "#/components/features/home/recent-conversations/recent-conversations";
-import AgentServerConversationService from "#/api/conversation-service/agent-server-conversation-service.api";
-
-const renderRecentConversations = () => {
- const RouterStub = createRoutesStub([
- {
- Component: () => <RecentConversations />,
- path: "/",
- },
- ]);
-
- const queryClient = new QueryClient({
- defaultOptions: {
- queries: {
- retry: false,
- },
- },
- });
-
- return render(<RouterStub />, {
- wrapper: ({ children }) => (
- <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
- ),
- });
-};
-
-describe("RecentConversations", () => {
- const searchConversationsSpy = vi.spyOn(
- AgentServerConversationService,
- "searchConversations",
- );
-
- it("should not show empty state when there is an error", async () => {
- searchConversationsSpy.mockRejectedValue(
- new Error("Failed to fetch conversations"),
- );
-
- renderRecentConversations();
-
- // Wait for the error to be displayed
- await waitFor(() => {
- expect(
- screen.getByText("Failed to fetch conversations"),
- ).toBeInTheDocument();
- });
-
- // The empty state should NOT be displayed when there's an error
- expect(
- screen.queryByText("HOME$NO_RECENT_CONVERSATIONS"),
- ).not.toBeInTheDocument();
- });
-});
diff --git a/src/components/features/conversation-panel/compact-conversation-row.tsx b/src/components/features/conversation-panel/compact-conversation-row.tsx
index 7550ab70ce..36d63b8a05 100644
--- a/src/components/features/conversation-panel/compact-conversation-row.tsx
+++ b/src/components/features/conversation-panel/compact-conversation-row.tsx
@@ -4,7 +4,7 @@ import { NavigationLink } from "#/components/shared/navigation-link";
import { ExecutionStatus } from "#/types/agent-server/core/base/common";
import { RepositorySelection } from "#/api/open-hands.types";
import { cn } from "#/utils/utils";
-import { ConversationStatusDot } from "../home/recent-conversations/conversation-status-dot";
+import { ConversationStatusDot } from "./conversation-status-dot";
import { ConversationCardFooter } from "./conversation-card/conversation-card-footer";
interface CompactConversationRowProps {
diff --git a/src/components/features/conversation-panel/conversation-card/conversation-card-header.tsx b/src/components/features/conversation-panel/conversation-card/conversation-card-header.tsx
index d0f919806c..7f852a0b16 100644
--- a/src/components/features/conversation-panel/conversation-card/conversation-card-header.tsx
+++ b/src/components/features/conversation-panel/conversation-card/conversation-card-header.tsx
@@ -1,6 +1,6 @@
import { ExecutionStatus } from "#/types/agent-server/core/base/common";
import { ConversationCardTitle } from "./conversation-card-title";
-import { ConversationStatusDot } from "../../home/recent-conversations/conversation-status-dot";
+import { ConversationStatusDot } from "../conversation-status-dot";
interface ConversationCardHeaderProps {
title: string;
diff --git a/src/components/features/home/recent-conversations/conversation-status-dot.tsx b/src/components/features/conversation-panel/conversation-status-dot.tsx
similarity index 100%
rename from src/components/features/home/recent-conversations/conversation-status-dot.tsx
rename to src/components/features/conversation-panel/conversation-status-dot.tsx
diff --git a/src/components/features/home/recent-conversations/conversation-status-indicator.tsx b/src/components/features/home/recent-conversations/conversation-status-indicator.tsx
deleted file mode 100644
index 89ad878df4..0000000000
--- a/src/components/features/home/recent-conversations/conversation-status-indicator.tsx
+++ /dev/null
@@ -1,51 +0,0 @@
-import { useMemo } from "react";
-import { useTranslation } from "react-i18next";
-import { ConversationStatus } from "#/types/conversation-status";
-import { cn, getConversationStatusLabel } from "#/utils/utils";
-import { I18nKey } from "#/i18n/declaration";
-import { StyledTooltip } from "#/components/shared/buttons/styled-tooltip";
-
-interface ConversationStatusIndicatorProps {
- conversationStatus: ConversationStatus;
-}
-
-export function ConversationStatusIndicator({
- conversationStatus,
-}: ConversationStatusIndicatorProps) {
- const { t } = useTranslation("openhands");
-
- const conversationStatusBackgroundColor = useMemo(() => {
- switch (conversationStatus) {
- case "STOPPED":
- return "bg-[#3C3C49]";
- case "RUNNING":
- return "bg-[#1FBD53]"; // Running/online - green
- case "STARTING":
- return "bg-[#FFD43B]"; // Busy/starting - yellow
- case "ERROR":
- return "bg-[#FF684E]"; // Error - red
- default:
- return "bg-[#3C3C49]"; // Default to grey for unknown states
- }
- }, [conversationStatus]);
-
- const statusLabel = t(
- getConversationStatusLabel(conversationStatus) as I18nKey,
- );
-
- return (
- <StyledTooltip
- content={statusLabel}
- placement="right"
- showArrow
- tooltipClassName="bg-[#1a1a1a] text-white text-xs shadow-lg"
- >
- <div
- className={cn(
- "w-1.5 h-1.5 rounded-full",
- conversationStatusBackgroundColor,
- )}
- />
- </StyledTooltip>
- );
-}
diff --git a/src/components/features/home/recent-conversations/recent-conversation.tsx b/src/components/features/home/recent-conversations/recent-conversation.tsx
deleted file mode 100644
index 7997ce87f1..0000000000
--- a/src/components/features/home/recent-conversations/recent-conversation.tsx
+++ /dev/null
@@ -1,82 +0,0 @@
-import { useTranslation } from "react-i18next";
-import CodeBranchIcon from "#/icons/u-code-branch.svg?react";
-import { AppConversation } from "#/api/conversation-service/agent-server-conversation-service.types";
-import { NavigationLink } from "#/components/shared/navigation-link";
-import { GitProviderIcon } from "#/components/shared/git-provider-icon";
-import { Provider } from "#/types/settings";
-import { formatTimeDelta } from "#/utils/format-time-delta";
-import { I18nKey } from "#/i18n/declaration";
-import { ConversationStatusDot } from "./conversation-status-dot";
-import RepoForkedIcon from "#/icons/repo-forked.svg?react";
-
-interface RecentConversationProps {
- conversation: AppConversation;
-}
-
-export function RecentConversation({ conversation }: RecentConversationProps) {
- const { t } = useTranslation("openhands");
-
- const hasRepository =
- conversation.selected_repository && conversation.selected_branch;
-
- return (
- <NavigationLink
- to={`/conversations/${conversation.id}`}
- className="flex flex-col gap-1 p-[14px] cursor-pointer w-full rounded-lg hover:bg-[#5C5D62] transition-all duration-300 text-left"
- >
- <div className="flex items-center gap-2 pl-1">
- <ConversationStatusDot
- executionStatus={conversation.execution_status}
- />
- <span className="text-xs text-white leading-6 font-normal">
- {conversation.title}
- </span>
- </div>
- <div className="flex items-center justify-between text-xs text-[#A3A3A3] leading-4 font-normal">
- <div className="flex items-center gap-3">
- {hasRepository ? (
- <div className="flex items-center gap-2">
- <GitProviderIcon
- gitProvider={conversation.git_provider as Provider}
- />
- <span
- className="max-w-[124px] truncate"
- title={conversation.selected_repository || ""}
- >
- {conversation.selected_repository}
- </span>
- </div>
- ) : (
- <div className="flex items-center gap-1">
- <RepoForkedIcon width={12} height={12} color="#A3A3A3" />
- <span className="max-w-[124px] truncate">
- {t(I18nKey.COMMON$NO_REPOSITORY)}
- </span>
- </div>
- )}
- {hasRepository ? (
- <div className="flex items-center gap-1">
- <CodeBranchIcon width={12} height={12} color="#A3A3A3" />
- <span
- className="max-w-[124px] truncate"
- title={conversation.selected_branch || ""}
- >
- {conversation.selected_branch}
- </span>
- </div>
- ) : null}
- </div>
- <div className="flex items-center gap-2">
- {(conversation.created_at || conversation.updated_at) && (
- <span>
- {formatTimeDelta(
- conversation.created_at || conversation.updated_at,
- )}{" "}
- {t(I18nKey.CONVERSATION$AGO)}
- </span>
- )}
- </div>
- </div>
- </NavigationLink>
- );
-}
diff --git a/src/components/features/home/recent-conversations/recent-conversations-skeleton.tsx b/src/components/features/home/recent-conversations/recent-conversations-skeleton.tsx
deleted file mode 100644
index 9e3b978335..0000000000
--- a/src/components/features/home/recent-conversations/recent-conversations-skeleton.tsx
+++ /dev/null
@@ -1,46 +0,0 @@
-function ConversationSkeleton() {
- return (
- <div className="flex flex-col gap-1 py-[14px]">
- <div className="flex items-center gap-2">
- <div className="w-3 h-3 rounded-full skeleton" />
- <div className="w-27 h-3 skeleton !rounded-sm" />
- </div>
- <div className="flex items-center justify-between">
- <div className="flex gap-3">
- <div className="flex items-center gap-2">
- <div className="w-3 h-3 skeleton !rounded-sm" />
- <div className="w-30.75 max-w-30.75 h-3 skeleton !rounded-sm" />
- </div>
- <div className="flex items-center gap-1">
- <div className="w-3 h-3 skeleton !rounded-sm" />
- <div className="w-24 max-w-24 h-3 skeleton !rounded-sm" />
- </div>
- </div>
- <div className="w-10 h-3 skeleton !rounded-sm" />
- </div>
- </div>
- );
-}
-
-interface RecentConversationSkeletonProps {
- items?: number;
-}
-
-function RecentConversationSkeleton({
- items = 3,
-}: RecentConversationSkeletonProps) {
- return (
- <div data-testid="recent-conversations-skeleton">
- <ul>
- {Array.from({ length: items }).map((_, index) => (
- <ConversationSkeleton key={index} />
- ))}
- </ul>
- <div className="w-15 h-3 skeleton !rounded-sm" />
- </div>
- );
-}
-
-export function RecentConversationsSkeleton() {
- return <RecentConversationSkeleton />;
-}
diff --git a/src/components/features/home/recent-conversations/recent-conversations.tsx b/src/components/features/home/recent-conversations/recent-conversations.tsx
deleted file mode 100644
index 93277ffc68..0000000000
--- a/src/components/features/home/recent-conversations/recent-conversations.tsx
+++ /dev/null
@@ -1,119 +0,0 @@
-import { useState } from "react";
-import { useTranslation } from "react-i18next";
-import { I18nKey } from "#/i18n/declaration";
-import { RecentConversationsSkeleton } from "./recent-conversations-skeleton";
-import { RecentConversation } from "./recent-conversation";
-import { usePaginatedConversations } from "#/hooks/query/use-paginated-conversations";
-import { useInfiniteScroll } from "#/hooks/use-infinite-scroll";
-import { cn } from "#/utils/utils";
-
-export function RecentConversations() {
- const { t } = useTranslation("openhands");
- const [isExpanded, setIsExpanded] = useState(false);
-
- const {
- data: conversationsList,
- isFetching,
- isFetchingNextPage,
- error,
- hasNextPage,
- fetchNextPage,
- } = usePaginatedConversations(10);
-
- // Set up infinite scroll
- const scrollContainerRef = useInfiniteScroll({
- hasNextPage: !!hasNextPage,
- isFetchingNextPage,
- fetchNextPage,
- threshold: 200, // Load more when 200px from bottom
- });
-
- const conversations =
- conversationsList?.pages.flatMap((page) => page.items) ?? [];
-
- // Get the conversations to display based on expansion state
- const displayLimit = isExpanded ? 10 : 3;
- const displayedConversations = conversations.slice(0, displayLimit);
-
- const hasConversations = conversations && conversations.length > 0;
-
- // Check if there are more conversations to show
- const hasMoreConversations =
- conversations && conversations.length > displayLimit;
-
- // Check if this is the initial load (no data yet)
- const isInitialLoading = isFetching && !conversationsList;
-
- const handleToggleExpansion = () => {
- setIsExpanded(!isExpanded);
- };
-
- return (
- <section
- data-testid="recent-conversations"
- className="flex flex-1 min-w-0 flex-col"
- >
- <div
- className={cn(
- "flex items-center gap-2",
- !hasConversations && "mb-[14px]",
- )}
- >
- <h3 className="text-xs leading-4 text-white font-bold py-[14px] pl-4">
- {t(I18nKey.COMMON$RECENT_CONVERSATIONS)}
- </h3>
- </div>
-
- {error && (
- <div className="flex flex-col items-center justify-center h-full pl-4">
- <p className="text-danger">{error.message}</p>
- </div>
- )}
-
- <div className="flex flex-col">
- {isInitialLoading && (
- <div className="pl-4">
- <RecentConversationsSkeleton />
- </div>
- )}
- </div>
-
- {!isInitialLoading && !error && displayedConversations?.length === 0 && (
- <span className="text-xs leading-4 text-white font-medium pl-4">
- {t(I18nKey.HOME$NO_RECENT_CONVERSATIONS)}
- </span>
- )}
-
- {!isInitialLoading &&
- displayedConversations &&
- displayedConversations.length > 0 && (
- <div className="flex flex-col">
- <div className="transition-all duration-300 ease-in-out overflow-y-auto custom-scrollbar">
- <div ref={scrollContainerRef} className="flex flex-col">
- {displayedConversations.map((conversation) => (
- <RecentConversation
- key={conversation.id}
- conversation={conversation}
- />
- ))}
- </div>
- </div>
- </div>
- )}
-
- {!isInitialLoading && (hasMoreConversations || isExpanded) && (
- <div className="flex justify-start mt-6 mb-8 ml-4">
- <button
- type="button"
- onClick={handleToggleExpansion}
- className="text-xs leading-4 text-[#FAFAFA] font-normal cursor-pointer hover:underline"
- >
- {isExpanded
- ? t(I18nKey.COMMON$VIEW_LESS)
- : t(I18nKey.COMMON$VIEW_MORE)}
- </button>
- </div>
- )}
- </section>
- );
-}
diff --git a/src/i18n/translation.json b/src/i18n/translation.json
index 602e2692ea..d885de73a8 100644
--- a/src/i18n/translation.json
+++ b/src/i18n/translation.json
@@ -9179,23 +9179,6 @@
"ja": ".jsonファイルをアップロード",
"ca": "Carrega un fitxer .json"
},
- "LANDING$RECENT_CONVERSATION": {
- "en": "jump back to your most recent conversation",
- "ja": "最新の会話に戻る",
- "zh-CN": "返回到最近的对话",
- "zh-TW": "返回到最近的對話",
- "ko-KR": "가장 최근 대화로 돌아가기",
- "fr": "revenez à votre conversation la plus récente",
- "es": "vuelve a tu conversación más reciente",
- "de": "kehre zu deiner letzten Konversation zurück",
- "it": "torna alla tua conversazione più recente",
- "pt": "volte para sua conversa mais recente",
- "ar": "أو العودة إلى آخر محادثة",
- "no": "gå tilbake til din siste samtale",
- "tr": "Son konuşma",
- "uk": "повернутися до вашої останньої розмови",
- "ca": "torna a la conversa més recent"
- },
"CONVERSATION$CONFIRM_DELETE": {
"en": "Confirm Delete",
"ja": "削除の確認",
@@ -20093,23 +20076,6 @@
"uk": "Пуш",
"ca": "Push"
},
- "COMMON$RECENT_CONVERSATIONS": {
- "en": "Recent Conversations",
- "ja": "最近の会話",
- "zh-CN": "最近的对话",
- "zh-TW": "最近的對話",
- "ko-KR": "최근 대화",
- "no": "Nylige samtaler",
- "it": "Conversazioni recenti",
- "pt": "Conversas recentes",
- "es": "Conversaciones recientes",
- "ar": "المحادثات الأخيرة",
- "fr": "Conversations récentes",
- "tr": "Son Konuşmalar",
- "de": "Kürzliche Gespräche",
- "uk": "Останні розмови",
- "ca": "Converses recents"
- },
"COMMON$RECENT_PROJECTS": {
"en": "Recent Projects",
"ja": "最近のプロジェクト",
@@ -20501,23 +20467,6 @@
"uk": "Почніть нову розмову, яка не пов'язана з існуючим репозиторієм.",
"ca": "Inicia una nova conversa que no estigui connectada a un repositori existent."
},
- "HOME$NO_RECENT_CONVERSATIONS": {
- "en": "No recent conversations",
- "ja": "最近の会話はありません",
- "zh-CN": "没有最近的对话",
- "zh-TW": "沒有最近的對話",
- "ko-KR": "최근 대화 없음",
- "no": "Ingen nylige samtaler",
- "it": "Nessuna conversazione recente",
- "pt": "Nenhuma conversa recente",
- "es": "No hay conversaciones recientes",
- "ar": "لا توجد محادثات حديثة",
- "fr": "Aucune conversation récente",
- "tr": "Son konuşma yok",
- "de": "Keine aktuellen Unterhaltungen",
- "uk": "Немає недавніх розмов",
- "ca": "No hi ha converses recents"
- },
"HOME$SELECT_OR_INSERT_URL": {
"en": "Select or insert a URL",
"ja": "URLを選択または挿入",
diff --git a/tests/e2e/snapshots/COVERAGE_PLAN.md b/tests/e2e/snapshots/COVERAGE_PLAN.md
index 851b8ddb49..c6e9b9938c 100644
--- a/tests/e2e/snapshots/COVERAGE_PLAN.md
+++ b/tests/e2e/snapshots/COVERAGE_PLAN.md
@@ -18,9 +18,8 @@ Existing coverage is marked **✅ done**. Everything else is proposed.
| Snapshot name | State to capture |
|---|---|
-| `home-empty-no-workspace` | No workspaces stored, no recent conversations |
+| `home-empty-no-workspace` | No workspaces stored |
| `home-with-workspace-selected` | One workspace selected in the dropdown |
-| `home-with-recent-conversations` | Recent conversations list populated (mock 2–3 entries) |
| `home-workspace-dropdown-open` | Workspace dropdown expanded showing stored workspaces |
| `home-folder-browser-modal` | `FolderBrowserModal` open with a mocked directory listing |
| `home-manage-workspaces-modal` | `ManageWorkspacesModal` open with two workspaces listed |