Skip to content

🙌 OpenHands: AI-Driven Development

feat(conversations): add client-side conversation archive (#16100)

FraterCCCLXIIIeb85ed456627
diff --git a/__tests__/components/features/conversation-panel/confirm-archive-modal.test.tsx b/__tests__/components/features/conversation-panel/confirm-archive-modal.test.tsx
new file mode 100644
index 0000000000..5ba14f6a60
--- /dev/null
+++ b/__tests__/components/features/conversation-panel/confirm-archive-modal.test.tsx
@@ -0,0 +1,55 @@
+import React from "react";
+import { describe, it, expect, vi } from "vitest";
+import { screen } from "@testing-library/react";
+import { renderWithProviders } from "test-utils";
+import { ConfirmArchiveModal } from "#/components/features/conversation-panel/confirm-archive-modal";
+
+vi.mock("react-i18next", async (importOriginal) => ({
+ ...(await importOriginal<typeof import("react-i18next")>()),
+ Trans: ({
+ values,
+ components,
+ }: {
+ values: { title: string };
+ components: { title: React.ReactElement };
+ }) => React.cloneElement(components.title, {}, values.title),
+}));
+
+describe("ConfirmArchiveModal", () => {
+ it("should display the conversation title in the warning", () => {
+ renderWithProviders(
+ <ConfirmArchiveModal
+ onConfirm={vi.fn()}
+ onCancel={vi.fn()}
+ conversationTitle="My Test Conversation"
+ />,
+ );
+
+ expect(screen.getByText(/My Test Conversation/)).toBeInTheDocument();
+ });
+
+ it("falls back to the default warning when no title is provided", () => {
+ renderWithProviders(
+ <ConfirmArchiveModal onConfirm={vi.fn()} onCancel={vi.fn()} />,
+ );
+
+ expect(
+ screen.getByText("CONVERSATION$ARCHIVE_WARNING"),
+ ).toBeInTheDocument();
+ });
+
+ it("places Cancel before Confirm in the footer", () => {
+ renderWithProviders(
+ <ConfirmArchiveModal onConfirm={vi.fn()} onCancel={vi.fn()} />,
+ );
+
+ const cancel = screen.getByText("BUTTON$CANCEL");
+ const confirm = screen.getByText("ACTION$CONFIRM_ARCHIVE");
+
+ // eslint-disable-next-line no-bitwise
+ expect(
+ cancel.compareDocumentPosition(confirm) &
+ Node.DOCUMENT_POSITION_FOLLOWING,
+ ).toBeTruthy();
+ });
+});
diff --git a/__tests__/components/features/conversation-panel/conversation-card.test.tsx b/__tests__/components/features/conversation-panel/conversation-card.test.tsx
index 7c7bef4b4b..ee97512cd1 100644
--- a/__tests__/components/features/conversation-panel/conversation-card.test.tsx
+++ b/__tests__/components/features/conversation-panel/conversation-card.test.tsx
@@ -336,6 +336,30 @@ describe("ConversationCard", () => {
expect(onContextMenuToggle).toHaveBeenCalledWith(false);
});
+ it("should call onArchive when the archive button is clicked", async () => {
+ const user = userEvent.setup();
+ const onArchive = vi.fn();
+ const onContextMenuToggle = vi.fn();
+ renderWithProviders(
+ <ConversationCard
+ onDelete={onDelete}
+ onArchive={onArchive}
+ onChangeTitle={onChangeTitle}
+ title="Conversation 1"
+ selectedRepository={null}
+ lastUpdatedAt="2021-10-01T12:00:00Z"
+ contextMenuOpen
+ onContextMenuToggle={onContextMenuToggle}
+ />,
+ );
+
+ const menu = screen.getByTestId("context-menu");
+ await user.click(within(menu).getByTestId("archive-button"));
+
+ expect(onArchive).toHaveBeenCalled();
+ expect(onContextMenuToggle).toHaveBeenCalledWith(false);
+ });
+
test("clicking the selectedRepository should not trigger the onClick handler", async () => {
const user = userEvent.setup();
renderWithProviders(
diff --git a/__tests__/components/features/conversation-panel/conversation-panel-filter-menu.test.tsx b/__tests__/components/features/conversation-panel/conversation-panel-filter-menu.test.tsx
index 820585a718..e42311b776 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
@@ -34,6 +34,8 @@ function renderFilterMenu(
automationNameFacets: [],
showOlderConversations: false,
toggleShowOlderConversations: vi.fn(),
+ showArchivedConversations: false,
+ toggleShowArchivedConversations: vi.fn(),
showRepoBranchMetadata: false,
toggleShowRepoBranchMetadata: vi.fn(),
showLlmProfiles: false,
diff --git a/__tests__/components/features/conversation-panel/conversation-panel.test.tsx b/__tests__/components/features/conversation-panel/conversation-panel.test.tsx
index 35d2e5a7a9..d5851d6802 100644
--- a/__tests__/components/features/conversation-panel/conversation-panel.test.tsx
+++ b/__tests__/components/features/conversation-panel/conversation-panel.test.tsx
@@ -1,4 +1,11 @@
-import { act, fireEvent, render, screen, waitFor, within } from "@testing-library/react";
+import {
+ act,
+ fireEvent,
+ render,
+ screen,
+ waitFor,
+ within,
+} from "@testing-library/react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { I18nextProvider } from "react-i18next";
import i18n from "i18next";
@@ -18,6 +25,7 @@ import React from "react";
import { renderWithProviders } from "test-utils";
import { ConversationPanel } from "#/components/features/conversation-panel/conversation-panel";
import { useConversationPanelPreferencesStore } from "#/stores/conversation-panel-preferences-store";
+import { useArchivedConversationsStore } from "#/stores/archived-conversations-store";
import { usePinnedConversationsStore } from "#/stores/pinned-conversations-store";
import AgentServerConversationService from "#/api/conversation-service/agent-server-conversation-service.api";
import { AppConversation } from "#/api/conversation-service/agent-server-conversation-service.types";
@@ -114,7 +122,9 @@ describe("ConversationPanel", () => {
mockStopConversationMutate.mockClear();
_mockConversationCounter = 0;
usePinnedConversationsStore.setState({ pinsByBackendId: {} });
+ useArchivedConversationsStore.setState({ archivesByBackendId: {} });
useConversationPanelPreferencesStore.setState({
+ showArchivedConversations: false,
automationFilterMode: "all",
selectedAutomationNames: [],
});
@@ -172,17 +182,73 @@ describe("ConversationPanel", () => {
expect(emptyState).toBeInTheDocument();
});
- it("does not show load more when the visible list is empty even if another page exists", async () => {
- vi.spyOn(AgentServerConversationService, "searchConversations").mockResolvedValue({
+ it("keeps load more available when the visible list is empty and another page exists", async () => {
+ // Client-side filters (archiving, thread scope) can hide every row of the
+ // loaded pages. Hiding "Load more" there would strand the remaining
+ // backend pages behind an empty list with no way to reach them.
+ vi.spyOn(
+ AgentServerConversationService,
+ "searchConversations",
+ ).mockResolvedValue({
items: [],
next_page_id: "page-2",
});
renderConversationPanel();
+ await screen.findByText("CONVERSATION$NO_CONVERSATIONS");
+ expect(screen.getByTestId("load-more-conversations")).toBeInTheDocument();
+ });
+
+ it("can reach an unarchived conversation on the next page after archiving every loaded row", async () => {
+ // Archiving filters rows out of the visible list without changing
+ // backend pagination. If every currently loaded conversation is archived
+ // while hasNextPage is still true, Load more must stay available and
+ // fetching the next page must surface the unarchived conversation.
+ const user = userEvent.setup();
+ const page1 = [
+ createMockConversation({ id: "archived-1", title: "Archived 1" }),
+ createMockConversation({ id: "archived-2", title: "Archived 2" }),
+ ];
+ const page2 = [
+ createMockConversation({
+ id: "visible-next",
+ title: "Unarchived on next page",
+ }),
+ ];
+ vi.spyOn(
+ AgentServerConversationService,
+ "searchConversations",
+ ).mockImplementation(async (_limit, pageId) => {
+ if (pageId === "page-2") {
+ return { items: page2, next_page_id: null };
+ }
+ return { items: page1, next_page_id: "page-2" };
+ });
+
+ useArchivedConversationsStore.setState({
+ archivesByBackendId: {
+ "default-local": ["archived-1", "archived-2"],
+ },
+ });
+ useConversationPanelPreferencesStore.setState({
+ showArchivedConversations: false,
+ });
+
+ renderConversationPanel();
+
await screen.findByText("CONVERSATION$NO_CONVERSATIONS");
expect(
- screen.queryByTestId("load-more-conversations"),
+ screen.queryByText("Unarchived on next page"),
+ ).not.toBeInTheDocument();
+
+ await user.click(screen.getByTestId("load-more-conversations"));
+
+ expect(
+ await screen.findByText("Unarchived on next page"),
+ ).toBeInTheDocument();
+ expect(
+ screen.queryByText("CONVERSATION$NO_CONVERSATIONS"),
).not.toBeInTheDocument();
});
@@ -256,8 +322,8 @@ describe("ConversationPanel", () => {
renderConversationPanel();
- // Assert: the filter-specific empty message shows, and unlike the
- // genuinely-empty case above, load more stays reachable.
+ // Assert: the filter-specific empty message shows and load more stays
+ // reachable.
await screen.findByText("CONVERSATION_PANEL$NO_AUTOMATION_MATCHES");
const loadMore = await screen.findByTestId("load-more-conversations");
@@ -538,6 +604,74 @@ describe("ConversationPanel", () => {
).not.toBeInTheDocument();
});
+ it("should archive a conversation and remove it from the list", async () => {
+ const user = userEvent.setup();
+ renderConversationPanel();
+
+ let cards = await screen.findAllByTestId("conversation-card");
+ expect(cards).toHaveLength(3);
+
+ const firstCardTitle = within(cards[0]).getByText("Conversation 1");
+ expect(firstCardTitle).toBeInTheDocument();
+
+ const ellipsisButton = within(cards[0]).getByTestId("ellipsis-button");
+ await user.click(ellipsisButton);
+ await user.click(screen.getByTestId("archive-button"));
+
+ expect(
+ screen.getByText("CONVERSATION$CONFIRM_ARCHIVE"),
+ ).toBeInTheDocument();
+
+ await user.click(screen.getByRole("button", { name: /archive/i }));
+
+ await waitFor(() => {
+ expect(
+ screen.queryByText("CONVERSATION$CONFIRM_ARCHIVE"),
+ ).not.toBeInTheDocument();
+ });
+
+ cards = await screen.findAllByTestId("conversation-card");
+ expect(cards).toHaveLength(2);
+ expect(screen.queryByText("Conversation 1")).not.toBeInTheDocument();
+ });
+
+ it("shows archived conversations when the preference is on and restores them", async () => {
+ // Archiving must stay reversible — that is the whole distinction from
+ // deleting, which removes the conversation from the agent server.
+ const user = userEvent.setup();
+ useArchivedConversationsStore
+ .getState()
+ .archiveConversation("default-local", "1");
+ useConversationPanelPreferencesStore.setState({
+ showArchivedConversations: true,
+ });
+
+ renderConversationPanel();
+
+ const cards = await screen.findAllByTestId("conversation-card");
+ expect(cards).toHaveLength(3);
+ const archivedCard = cards.find((card) =>
+ within(card).queryByText("Conversation 1"),
+ )!;
+ expect(
+ within(archivedCard).getByTestId("conversation-card-archived-chip"),
+ ).toBeInTheDocument();
+
+ await user.click(within(archivedCard).getByTestId("ellipsis-button"));
+ await user.click(screen.getByTestId("unarchive-button"));
+
+ await waitFor(() => {
+ expect(
+ useArchivedConversationsStore
+ .getState()
+ .isArchived("default-local", "1"),
+ ).toBe(false);
+ });
+ expect(
+ screen.queryByTestId("conversation-card-archived-chip"),
+ ).not.toBeInTheDocument();
+ });
+
it("should call onClose after clicking a card", async () => {
const user = userEvent.setup();
renderConversationPanel();
@@ -899,9 +1033,8 @@ describe("ConversationPanel", () => {
// Test RUNNING conversation - should show stop button
const runningCard = await getCardByTitle("Running Conversation");
- const runningEllipsisButton = within(runningCard).getByTestId(
- "ellipsis-button",
- );
+ const runningEllipsisButton =
+ within(runningCard).getByTestId("ellipsis-button");
await user.click(runningEllipsisButton);
expect(await screen.findByTestId("stop-button")).toBeInTheDocument();
@@ -916,9 +1049,8 @@ describe("ConversationPanel", () => {
// Test STARTING/RUNNING conversation - should show stop button
const startingCard = await getCardByTitle("Starting Conversation");
- const startingEllipsisButton = within(startingCard).getByTestId(
- "ellipsis-button",
- );
+ const startingEllipsisButton =
+ within(startingCard).getByTestId("ellipsis-button");
await user.click(startingEllipsisButton);
expect(await screen.findByTestId("stop-button")).toBeInTheDocument();
@@ -933,9 +1065,8 @@ describe("ConversationPanel", () => {
// Test STOPPED conversation - should NOT show stop button
const stoppedCard = await getCardByTitle("Stopped Conversation");
- const stoppedEllipsisButton = within(stoppedCard).getByTestId(
- "ellipsis-button",
- );
+ const stoppedEllipsisButton =
+ within(stoppedCard).getByTestId("ellipsis-button");
await user.click(stoppedEllipsisButton);
await waitFor(() => {
@@ -1559,6 +1690,75 @@ describe("ConversationPanel", () => {
expect(deleteSpy).toHaveBeenCalledWith("recent-2");
});
+ it("delete-all still deletes hidden archived conversations", async () => {
+ // "Show archived" only controls rendering. Delete all must keep using
+ // the full loaded collection so archived server-side conversations are
+ // not silently left behind (or the action disabled when every loaded
+ // row is archived).
+ const user = userEvent.setup();
+ const deleteSpy = vi
+ .spyOn(AgentServerConversationService, "deleteConversation")
+ .mockResolvedValue();
+
+ vi.spyOn(
+ AgentServerConversationService,
+ "searchConversations",
+ ).mockResolvedValue({
+ items: [
+ createMockConversation({
+ id: "visible-1",
+ title: "Visible 1",
+ updated_at: recentIso(),
+ }),
+ createMockConversation({
+ id: "archived-1",
+ title: "Archived 1",
+ updated_at: recentIso(),
+ }),
+ createMockConversation({
+ id: "archived-2",
+ title: "Archived 2",
+ updated_at: recentIso(),
+ }),
+ ],
+ next_page_id: null,
+ });
+
+ useArchivedConversationsStore.setState({
+ archivesByBackendId: {
+ "default-local": ["archived-1", "archived-2"],
+ },
+ });
+ useConversationPanelPreferencesStore.setState({
+ showArchivedConversations: false,
+ });
+
+ renderConversationPanel();
+ const cards = await screen.findAllByTestId("conversation-card");
+ expect(cards).toHaveLength(1);
+ expect(screen.getByText("Visible 1")).toBeInTheDocument();
+ expect(screen.queryByText("Archived 1")).not.toBeInTheDocument();
+
+ await user.click(screen.getByTestId("older-conversations-filter-toggle"));
+ const deleteAllButton = await screen.findByTestId(
+ "delete-all-conversations",
+ );
+ expect(deleteAllButton).toBeEnabled();
+
+ await user.click(deleteAllButton);
+ expect(
+ await screen.findByText(/CONVERSATION\$CONFIRM_DELETE_ALL_DESC/),
+ ).toBeInTheDocument();
+ await user.click(await screen.findByRole("button", { name: /confirm/i }));
+
+ await waitFor(() => {
+ expect(deleteSpy).toHaveBeenCalledTimes(3);
+ });
+ expect(deleteSpy).toHaveBeenCalledWith("visible-1");
+ expect(deleteSpy).toHaveBeenCalledWith("archived-1");
+ expect(deleteSpy).toHaveBeenCalledWith("archived-2");
+ });
+
it("navigates away after the active conversation is deleted successfully even when another deletion fails", async () => {
const user = userEvent.setup();
const navigate = vi.fn();
@@ -1883,7 +2083,9 @@ describe("ConversationPanel", () => {
const reorderedAlpha = screen.getByTestId(
"thread-folder-ws--workspace-alpha",
);
- const reorderedBeta = screen.getByTestId("thread-folder-ws--workspace-beta");
+ const reorderedBeta = screen.getByTestId(
+ "thread-folder-ws--workspace-beta",
+ );
expect(reorderedBeta.compareDocumentPosition(reorderedAlpha)).toBe(
Node.DOCUMENT_POSITION_FOLLOWING,
);
@@ -1923,9 +2125,9 @@ describe("ConversationPanel", () => {
const pinnedSection = await screen.findByTestId(
"conversation-panel-pinned-section",
);
- expect(within(pinnedSection).getAllByTestId("conversation-card")).toHaveLength(
- 1,
- );
+ expect(
+ within(pinnedSection).getAllByTestId("conversation-card"),
+ ).toHaveLength(1);
expect(await screen.findAllByTestId("conversation-card")).toHaveLength(3);
expect(screen.getAllByText("Conversation 2")).toHaveLength(1);
});
@@ -1941,9 +2143,9 @@ describe("ConversationPanel", () => {
const pinnedSection = await screen.findByTestId(
"conversation-panel-pinned-section",
);
- expect(within(pinnedSection).getAllByTestId("conversation-card")).toHaveLength(
- 1,
- );
+ expect(
+ within(pinnedSection).getAllByTestId("conversation-card"),
+ ).toHaveLength(1);
expect(await screen.findAllByTestId("conversation-card")).toHaveLength(3);
expect(screen.getAllByText("Conversation 2")).toHaveLength(1);
});
diff --git a/__tests__/stores/archived-conversations-store.test.ts b/__tests__/stores/archived-conversations-store.test.ts
new file mode 100644
index 0000000000..482a9d199e
--- /dev/null
+++ b/__tests__/stores/archived-conversations-store.test.ts
@@ -0,0 +1,77 @@
+import { beforeEach, describe, expect, it } from "vitest";
+import {
+ ARCHIVED_CONVERSATIONS_STORAGE_KEY,
+ useArchivedConversationsStore,
+} from "#/stores/archived-conversations-store";
+
+const BACKEND_ID = "default-local";
+
+describe("archived-conversations store", () => {
+ beforeEach(() => {
+ window.localStorage.clear();
+ useArchivedConversationsStore.setState({ archivesByBackendId: {} });
+ });
+
+ it("archives a conversation for a backend", () => {
+ // Arrange / Act
+ useArchivedConversationsStore
+ .getState()
+ .archiveConversation(BACKEND_ID, "conversation-a");
+
+ // Assert
+ expect(
+ useArchivedConversationsStore.getState().archivesByBackendId[BACKEND_ID],
+ ).toEqual(["conversation-a"]);
+ expect(
+ useArchivedConversationsStore
+ .getState()
+ .isArchived(BACKEND_ID, "conversation-a"),
+ ).toBe(true);
+ });
+
+ it("does not duplicate archives for the same conversation", () => {
+ useArchivedConversationsStore
+ .getState()
+ .archiveConversation(BACKEND_ID, "conversation-a");
+ useArchivedConversationsStore
+ .getState()
+ .archiveConversation(BACKEND_ID, "conversation-a");
+
+ expect(
+ useArchivedConversationsStore.getState().archivesByBackendId[BACKEND_ID],
+ ).toEqual(["conversation-a"]);
+ });
+
+ it("removes an archived conversation id", () => {
+ useArchivedConversationsStore
+ .getState()
+ .archiveConversation(BACKEND_ID, "conversation-a");
+ useArchivedConversationsStore
+ .getState()
+ .removeArchivedConversation(BACKEND_ID, "conversation-a");
+
+ expect(
+ useArchivedConversationsStore.getState().archivesByBackendId[BACKEND_ID],
+ ).toEqual([]);
+ });
+
+ it("persists archives across reloads so they survive pagination", () => {
+ // Archives are never pruned against the loaded pages: an archived
+ // conversation that is not on the currently fetched page must stay
+ // archived instead of reappearing in the list.
+ useArchivedConversationsStore
+ .getState()
+ .archiveConversation(BACKEND_ID, "conversation-a");
+ useArchivedConversationsStore
+ .getState()
+ .archiveConversation(BACKEND_ID, "conversation-b");
+
+ const persisted = JSON.parse(
+ window.localStorage.getItem(ARCHIVED_CONVERSATIONS_STORAGE_KEY) ?? "{}",
+ );
+ expect(persisted.state.archivesByBackendId[BACKEND_ID]).toEqual([
+ "conversation-b",
+ "conversation-a",
+ ]);
+ });
+});
diff --git a/__tests__/stores/conversation-panel-preferences-store.test.ts b/__tests__/stores/conversation-panel-preferences-store.test.ts
index fe23b77b07..4f351622fb 100644
--- a/__tests__/stores/conversation-panel-preferences-store.test.ts
+++ b/__tests__/stores/conversation-panel-preferences-store.test.ts
@@ -78,6 +78,7 @@ describe("conversation-panel-preferences store", () => {
"groupFolderOrder",
"organizeMode",
"selectedAutomationNames",
+ "showArchivedConversations",
"showHoverMetadata",
"showLlmProfiles",
"showOlderConversations",
@@ -93,9 +94,7 @@ describe("conversation-panel-preferences store", () => {
useConversationPanelPreferencesStore.getState().showLlmProfiles,
).toBe(true);
- useConversationPanelPreferencesStore
- .getState()
- .toggleShowLlmProfiles();
+ useConversationPanelPreferencesStore.getState().toggleShowLlmProfiles();
expect(
useConversationPanelPreferencesStore.getState().showLlmProfiles,
).toBe(false);
diff --git a/src/components/features/conversation-panel/confirm-archive-modal.tsx b/src/components/features/conversation-panel/confirm-archive-modal.tsx
new file mode 100644
index 0000000000..639cb45c6b
--- /dev/null
+++ b/src/components/features/conversation-panel/confirm-archive-modal.tsx
@@ -0,0 +1,68 @@
+import React from "react";
+import { Trans, useTranslation } from "react-i18next";
+import {
+ BaseModalDescription,
+ BaseModalTitle,
+} from "#/components/shared/modals/confirmation-modals/base-modal";
+import { ModalBackdrop } from "#/components/shared/modals/modal-backdrop";
+import { ModalBody } from "#/components/shared/modals/modal-body";
+import { BrandButton } from "../settings/brand-button";
+import { I18nKey } from "#/i18n/declaration";
+
+interface ConfirmArchiveModalProps {
+ onConfirm: () => void;
+ onCancel: () => void;
+ conversationTitle?: string;
+}
+
+export function ConfirmArchiveModal({
+ onConfirm,
+ onCancel,
+ conversationTitle,
+}: ConfirmArchiveModalProps) {
+ const { t } = useTranslation("openhands");
+
+ const confirmationMessage =
+ conversationTitle != null && conversationTitle !== "" ? (
+ <Trans
+ ns="openhands"
+ i18nKey={I18nKey.CONVERSATION$ARCHIVE_WARNING_WITH_TITLE}
+ values={{ title: conversationTitle }}
+ components={{ title: <span className="text-white" /> }}
+ />
+ ) : (
+ t(I18nKey.CONVERSATION$ARCHIVE_WARNING)
+ );
+
+ return (
+ <ModalBackdrop onClose={onCancel}>
+ <ModalBody className="items-start border border-[var(--oh-border)]">
+ <div className="flex flex-col gap-2">
+ <BaseModalTitle title={t(I18nKey.CONVERSATION$CONFIRM_ARCHIVE)} />
+ <BaseModalDescription>{confirmationMessage}</BaseModalDescription>
+ </div>
+ <div
+ className="flex justify-end gap-2 w-full"
+ onClick={(event) => event.stopPropagation()}
+ >
+ <BrandButton
+ type="button"
+ variant="secondary"
+ onClick={onCancel}
+ testId="cancel-button"
+ >
+ {t(I18nKey.BUTTON$CANCEL)}
+ </BrandButton>
+ <BrandButton
+ type="button"
+ variant="primary"
+ onClick={onConfirm}
+ testId="confirm-button"
+ >
+ {t(I18nKey.ACTION$CONFIRM_ARCHIVE)}
+ </BrandButton>
+ </div>
+ </ModalBody>
+ </ModalBackdrop>
+ );
+}
diff --git a/src/components/features/conversation-panel/conversation-card/conversation-card-actions.tsx b/src/components/features/conversation-panel/conversation-card/conversation-card-actions.tsx
index b4339b9c53..c54505b7a7 100644
--- a/src/components/features/conversation-panel/conversation-card/conversation-card-actions.tsx
+++ b/src/components/features/conversation-panel/conversation-card/conversation-card-actions.tsx
@@ -10,6 +10,8 @@ interface ConversationCardActionsProps {
contextMenuOpen: boolean;
onContextMenuToggle: (isOpen: boolean) => void;
onDelete?: (event: React.MouseEvent<HTMLButtonElement>) => void;
+ onArchive?: (event: React.MouseEvent<HTMLButtonElement>) => void;
+ onUnarchive?: (event: React.MouseEvent<HTMLButtonElement>) => void;
onStop?: (event: React.MouseEvent<HTMLButtonElement>) => void;
onEdit?: (event: React.MouseEvent<HTMLButtonElement>) => void;
onDownloadViaVSCode?: (event: React.MouseEvent<HTMLButtonElement>) => void;
@@ -23,6 +25,8 @@ export function ConversationCardActions({
contextMenuOpen,
onContextMenuToggle,
onDelete,
+ onArchive,
+ onUnarchive,
onStop,
onEdit,
onDownloadViaVSCode,
@@ -72,7 +76,7 @@ export function ConversationCardActions({
// bottom that opening downward would clip the menu, flip it above
// the anchor instead. Slight over-estimate is fine — it just means
// we flip a few pixels earlier than strictly necessary.
- const ESTIMATED_MENU_HEIGHT = 280;
+ const ESTIMATED_MENU_HEIGHT = 320;
const gutter = 8;
const overflowsDownward = bottom + ESTIMATED_MENU_HEIGHT + gutter > vh;
const top = overflowsDownward
@@ -106,6 +110,8 @@ export function ConversationCardActions({
floatingStyle={floatingStyle}
onClose={() => onContextMenuToggle(false)}
onDelete={onDelete}
+ onArchive={onArchive}
+ onUnarchive={onUnarchive}
onStop={isActive ? onStop : undefined}
onEdit={onEdit}
onDownloadViaVSCode={
diff --git a/src/components/features/conversation-panel/conversation-card/conversation-card-context-menu.tsx b/src/components/features/conversation-panel/conversation-card/conversation-card-context-menu.tsx
index 7ed9beae3a..5be1887d83 100644
--- a/src/components/features/conversation-panel/conversation-card/conversation-card-context-menu.tsx
+++ b/src/components/features/conversation-panel/conversation-card/conversation-card-context-menu.tsx
@@ -7,6 +7,7 @@ import { ContextMenuListItem } from "../../context-menu/context-menu-list-item";
import { I18nKey } from "#/i18n/declaration";
import { ConversationNameContextMenuIconText } from "../../conversation/conversation-name-context-menu-icon-text";
+import { Archive, ArchiveRestore } from "lucide-react";
import EditIcon from "#/icons/u-edit.svg?react";
import SkillsIcon from "#/icons/skills.svg?react";
import ToolsIcon from "#/icons/u-tools.svg?react";
@@ -19,6 +20,8 @@ import { Divider } from "#/ui/divider";
interface ConversationCardContextMenuProps {
onClose: () => void;
onDelete?: (event: React.MouseEvent<HTMLButtonElement>) => void;
+ onArchive?: (event: React.MouseEvent<HTMLButtonElement>) => void;
+ onUnarchive?: (event: React.MouseEvent<HTMLButtonElement>) => void;
onStop?: (event: React.MouseEvent<HTMLButtonElement>) => void;
onEdit?: (event: React.MouseEvent<HTMLButtonElement>) => void;
onDisplayCost?: (event: React.MouseEvent<HTMLButtonElement>) => void;
@@ -38,6 +41,8 @@ interface ConversationCardContextMenuProps {
export function ConversationCardContextMenu({
onClose,
onDelete,
+ onArchive,
+ onUnarchive,
onStop,
onEdit,
onDisplayCost,
@@ -207,6 +212,30 @@ export function ConversationCardContextMenu({
/>
</ContextMenuListItem>
),
+ onArchive && (
+ <ContextMenuListItem
+ key="archive-button"
+ testId="archive-button"
+ onClick={onArchive}
+ >
+ <ConversationNameContextMenuIconText
+ icon={<Archive className="h-4 w-4" aria-hidden />}
+ text={t(I18nKey.COMMON$ARCHIVE_CONVERSATION)}
+ />
+ </ContextMenuListItem>
+ ),
+ onUnarchive && (
+ <ContextMenuListItem
+ key="unarchive-button"
+ testId="unarchive-button"
+ onClick={onUnarchive}
+ >
+ <ConversationNameContextMenuIconText
+ icon={<ArchiveRestore className="h-4 w-4" aria-hidden />}
+ text={t(I18nKey.COMMON$UNARCHIVE_CONVERSATION)}
+ />
+ </ContextMenuListItem>
+ ),
onDelete && (
<ContextMenuListItem
key="delete-button"
diff --git a/src/components/features/conversation-panel/conversation-card/conversation-card-footer.tsx b/src/components/features/conversation-panel/conversation-card/conversation-card-footer.tsx
index 11273f3a80..49ddbbbb36 100644
--- a/src/components/features/conversation-panel/conversation-card/conversation-card-footer.tsx
+++ b/src/components/features/conversation-panel/conversation-card/conversation-card-footer.tsx
@@ -62,6 +62,12 @@ interface ConversationCardFooterProps {
* "Tags" toggle.
*/
showTags?: boolean;
+ /**
+ * Marks the conversation as archived. Archived rows are hidden from the list
+ * unless the panel's "Show archived" toggle is on, so the chip is what tells
+ * the user why an otherwise ordinary row is visible.
+ */
+ isArchived?: boolean;
}
export function ConversationCardFooter({
@@ -78,6 +84,7 @@ export function ConversationCardFooter({
acpServer = null,
tags = null,
showTags = false,
+ isArchived = false,
}: ConversationCardFooterProps) {
const { t } = useTranslation("openhands");
@@ -173,6 +180,16 @@ export function ConversationCardFooter({
</span>
</div>
) : null}
+ {isArchived ? (
+ <div className={metadataIndentClass}>
+ <span
+ data-testid="conversation-card-archived-chip"
+ className={CONVERSATION_CARD_META_CHIP_CLASSNAME}
+ >
+ {t(I18nKey.COMMON$ARCHIVED)}
+ </span>
+ </div>
+ ) : null}
{displayTags.length > 0 ? (
<div className={metadataIndentClass}>
<ConversationTagChips tags={displayTags} />
diff --git a/src/components/features/conversation-panel/conversation-card/conversation-card.tsx b/src/components/features/conversation-panel/conversation-card/conversation-card.tsx
index cf8c02d8b5..99255784b9 100644
--- a/src/components/features/conversation-panel/conversation-card/conversation-card.tsx
+++ b/src/components/features/conversation-panel/conversation-card/conversation-card.tsx
@@ -20,6 +20,13 @@ import { useDownloadConversation } from "#/hooks/use-download-conversation";
interface ConversationCardProps {
onClick?: () => void;
onDelete?: () => void;
+ onArchive?: () => void;
+ /**
+ * Restores an archived conversation. The panel passes this instead of
+ * `onArchive` for rows that are already archived, so the menu offers exactly
+ * one of the two directions.
+ */
+ onUnarchive?: () => void;
onStop?: () => void;
onChangeTitle?: (title: string) => void;
showOptions?: boolean;
@@ -42,6 +49,7 @@ interface ConversationCardProps {
tags?: Record<string, string> | null;
/** Gates the tag-chip row; wired to the panel's "Tags" metadata toggle. */
showTags?: boolean;
+ isArchived?: boolean;
isPinned?: boolean;
onTogglePin?: () => void;
/** When true and pinned, keep the pin icon visible without hovering. */
@@ -51,6 +59,8 @@ interface ConversationCardProps {
export function ConversationCard({
onClick,
onDelete,
+ onArchive,
+ onUnarchive,
onStop,
onChangeTitle,
showOptions,
@@ -72,6 +82,7 @@ export function ConversationCard({
acpServer = null,
tags = null,
showTags = false,
+ isArchived = false,
isPinned = false,
onTogglePin,
alwaysShowPinIcon = false,
@@ -95,6 +106,20 @@ export function ConversationCard({
onContextMenuToggle?.(false);
};
+ const handleArchive = (event: React.MouseEvent<HTMLButtonElement>) => {
+ event.preventDefault();
+ event.stopPropagation();
+ onArchive?.();
+ onContextMenuToggle?.(false);
+ };
+
+ const handleUnarchive = (event: React.MouseEvent<HTMLButtonElement>) => {
+ event.preventDefault();
+ event.stopPropagation();
+ onUnarchive?.();
+ onContextMenuToggle?.(false);
+ };
+
const handleStop = (event: React.MouseEvent<HTMLButtonElement>) => {
event.preventDefault();
event.stopPropagation();
@@ -180,11 +205,18 @@ export function ConversationCard({
</button>
);
- const hasContextMenu = !!(onDelete || onChangeTitle || showOptions);
+ const hasContextMenu = !!(
+ onDelete ||
+ onArchive ||
+ onUnarchive ||
+ onChangeTitle ||
+ showOptions
+ );
const hasHoverActions = hasContextMenu || !!onTogglePin;
const showPersistentPinIcon = alwaysShowPinIcon && isPinned && !!onTogglePin;
const shouldRenderFooter =
showRepositoryMetadata ||
+ isArchived ||
(showLlmProfiles && (agentKind === "acp" || !!llmModel)) ||
(showTags && getDisplayConversationTags(tags).length > 0);
@@ -268,6 +300,8 @@ export function ConversationCard({
contextMenuOpen={contextMenuOpen}
onContextMenuToggle={onContextMenuToggle || (() => {})}
onDelete={onDelete && handleDelete}
+ onArchive={onArchive && handleArchive}
+ onUnarchive={onUnarchive && handleUnarchive}
onStop={onStop && handleStop}
onEdit={onChangeTitle && handleEdit}
onDownloadViaVSCode={handleDownloadViaVSCode}
@@ -294,6 +328,8 @@ export function ConversationCard({
contextMenuOpen={contextMenuOpen}
onContextMenuToggle={onContextMenuToggle || (() => {})}
onDelete={onDelete && handleDelete}
+ onArchive={onArchive && handleArchive}
+ onUnarchive={onUnarchive && handleUnarchive}
onStop={onStop && handleStop}
onEdit={onChangeTitle && handleEdit}
onDownloadViaVSCode={handleDownloadViaVSCode}
@@ -323,6 +359,7 @@ export function ConversationCard({
acpServer={acpServer}
tags={tags}
showTags={showTags}
+ isArchived={isArchived}
/>
)}
</div>
diff --git a/src/components/features/conversation-panel/conversation-panel-filter-menu.tsx b/src/components/features/conversation-panel/conversation-panel-filter-menu.tsx
index b726d379f7..f80967709b 100644
--- a/src/components/features/conversation-panel/conversation-panel-filter-menu.tsx
+++ b/src/components/features/conversation-panel/conversation-panel-filter-menu.tsx
@@ -1,6 +1,7 @@
import React from "react";
import { useTranslation } from "react-i18next";
import {
+ Archive,
Bot,
CalendarArrowDown,
Clock3,
@@ -56,6 +57,8 @@ export interface ConversationPanelFilterMenuProps {
onToggleAutomationName: (name: string) => void;
automationNameFacets: string[];
showOlderConversations: boolean;
+ showArchivedConversations: boolean;
+ toggleShowArchivedConversations: () => void;
toggleShowOlderConversations: () => void;
showRepoBranchMetadata: boolean;
toggleShowRepoBranchMetadata: () => void;
@@ -86,6 +89,8 @@ export function ConversationPanelFilterMenu({
onToggleAutomationName,
automationNameFacets,
showOlderConversations,
+ showArchivedConversations,
+ toggleShowArchivedConversations,
toggleShowOlderConversations,
showRepoBranchMetadata,
toggleShowRepoBranchMetadata,
@@ -268,6 +273,16 @@ export function ConversationPanelFilterMenu({
setFilterMenuOpen(false);
}}
/>
+ <MenuRow
+ icon={Archive}
+ label={t(I18nKey.CONVERSATION_PANEL$SHOW_ARCHIVED)}
+ selected={showArchivedConversations}
+ testId="toggle-show-archived"
+ onClick={() => {
+ toggleShowArchivedConversations();
+ setFilterMenuOpen(false);
+ }}
+ />
<MenuSeparator />
<MenuHeading>{t(I18nKey.CONVERSATION_PANEL$AUTOMATIONS)}</MenuHeading>
diff --git a/src/components/features/conversation-panel/conversation-panel.tsx b/src/components/features/conversation-panel/conversation-panel.tsx
index f1161a5ffb..c3de9420cf 100644
--- a/src/components/features/conversation-panel/conversation-panel.tsx
+++ b/src/components/features/conversation-panel/conversation-panel.tsx
@@ -9,6 +9,7 @@ import { usePaginatedConversations } from "#/hooks/query/use-paginated-conversat
import { useStartTasks } from "#/hooks/query/use-start-tasks";
import { useDeleteConversation } from "#/hooks/mutation/use-delete-conversation";
import { useUnifiedPauseConversation } from "#/hooks/mutation/use-unified-stop-conversation";
+import { ConfirmArchiveModal } from "./confirm-archive-modal";
import { ConfirmDeleteModal } from "./confirm-delete-modal";
import { ConfirmStopModal } from "./confirm-stop-modal";
import { NavigationLink } from "#/components/shared/navigation-link";
@@ -44,6 +45,7 @@ import {
sortConversationsByField,
type ConversationGroupLaunch,
} from "./conversation-panel-list-helpers";
+import { useArchivedConversationsStore } from "#/stores/archived-conversations-store";
import { usePinnedConversationsStore } from "#/stores/pinned-conversations-store";
interface ConversationPanelProps {
@@ -100,6 +102,8 @@ export function ConversationPanel({
const [confirmDeleteModalVisible, setConfirmDeleteModalVisible] =
React.useState(false);
+ const [confirmArchiveModalVisible, setConfirmArchiveModalVisible] =
+ React.useState(false);
const [confirmStopModalVisible, setConfirmStopModalVisible] =
React.useState(false);
const [
@@ -111,6 +115,12 @@ export function ConversationPanel({
const showOlderConversations = useConversationPanelPreferencesStore(
(state) => state.showOlderConversations,
);
+ const showArchivedConversations = useConversationPanelPreferencesStore(
+ (state) => state.showArchivedConversations,
+ );
+ const toggleShowArchivedConversations = useConversationPanelPreferencesStore(
+ (state) => state.toggleShowArchivedConversations,
+ );
const toggleShowOlderConversations = useConversationPanelPreferencesStore(
(state) => state.toggleShowOlderConversations,
);
@@ -193,9 +203,27 @@ export function ConversationPanel({
state.pinsByBackendId[activeBackend.id] ?? EMPTY_PINNED_CONVERSATION_IDS,
);
const togglePin = usePinnedConversationsStore((state) => state.togglePin);
+ const unpinConversation = usePinnedConversationsStore(
+ (state) => state.unpinConversation,
+ );
const pruneMissingPinnedConversations = usePinnedConversationsStore(
(state) => state.pruneMissingConversations,
);
+ const archivedIds = useArchivedConversationsStore(
+ (state) =>
+ state.archivesByBackendId[activeBackend.id] ??
+ EMPTY_PINNED_CONVERSATION_IDS,
+ );
+ const archiveConversation = useArchivedConversationsStore(
+ (state) => state.archiveConversation,
+ );
+ const archivedIdSet = React.useMemo(
+ () => new Set(archivedIds),
+ [archivedIds],
+ );
+ const removeArchivedConversation = useArchivedConversationsStore(
+ (state) => state.removeArchivedConversation,
+ );
const toggleGroupCollapsed = React.useCallback((groupId: string) => {
setCollapsedGroupIds((prev) => {
@@ -252,7 +280,10 @@ export function ConversationPanel({
// Fetch in-progress start tasks
const { data: startTasks } = useStartTasks();
- const conversations = React.useMemo(() => {
+ // Deduped, archive-unaware collection of every conversation currently loaded
+ // from the backend. Bulk actions like "Delete all" must use this list so
+ // hiding archived rows from the UI never shrinks what gets deleted.
+ const allLoadedConversations = React.useMemo(() => {
const all = data?.pages.flatMap((page) => page.items) ?? [];
// The 10s background refetch re-fetches every loaded page with the
// `UPDATED_AT_DESC` cursor. If a conversation's `updated_at` shifts between
@@ -269,6 +300,17 @@ export function ConversationPanel({
});
}, [data]);
+ // Display collection: same loaded pages, with archived rows filtered out
+ // unless the user has opted into "Show archived".
+ const conversations = React.useMemo(() => {
+ if (showArchivedConversations) {
+ return allLoadedConversations;
+ }
+ return allLoadedConversations.filter(
+ (conversation) => !archivedIdSet.has(conversation.id),
+ );
+ }, [allLoadedConversations, archivedIdSet, showArchivedConversations]);
+
// 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(
@@ -301,16 +343,14 @@ export function ConversationPanel({
if (!isFetched) {
return;
}
- pruneMissingPinnedConversations(
- activeBackend.id,
- conversations.map((conversation) => conversation.id),
- );
- }, [
- activeBackend.id,
- conversations,
- isFetched,
- pruneMissingPinnedConversations,
- ]);
+ // Prune pins against the unfiltered loaded pages so archived-but-still-
+ // pinned rows are not treated as missing. Archived IDs are intentionally
+ // not pruned here — pagination would otherwise drop archives that are not
+ // on the currently loaded pages and let them reappear in the list.
+ const loadedIds =
+ data?.pages.flatMap((page) => page.items.map((item) => item.id)) ?? [];
+ pruneMissingPinnedConversations(activeBackend.id, loadedIds);
+ }, [activeBackend.id, data, isFetched, pruneMissingPinnedConversations]);
React.useEffect(() => {
if (pinnedIds.length === 0) {
@@ -416,25 +456,16 @@ export function ConversationPanel({
const visibleFlatCount = sortedVisibleConversations.length;
- const visibleGroupedCount = React.useMemo(() => {
- if (!orderedConversationGroups) {
- return 0;
- }
- return orderedConversationGroups.reduce(
- (n, g) => n + g.conversations.length,
- 0,
- );
- }, [orderedConversationGroups]);
+ const visibleGroupCount = orderedConversationGroups?.length ?? 0;
const listIsEffectivelyEmpty =
organizeMode === "grouped" && !compact
- ? visibleGroupedCount === 0
+ ? visibleGroupCount === 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.
+ // effects). Used to pick the empty-state message.
const emptyDueToAutomationFilter =
listIsEffectivelyEmpty &&
automationFilterMode !== "all" &&
@@ -445,8 +476,9 @@ export function ConversationPanel({
// current organize mode. "Load more" succeeds only when this number grows.
const visibleCount =
organizeMode === "grouped" && !compact
- ? visibleGroupedCount
+ ? visibleGroupCount
: visibleFlatCount;
+ const loadedPageCount = data?.pages.length ?? 0;
// KNOWN ISSUE (unresolved as of 2026-05-29): users still report that the
// sidebar "Load more" sometimes requires two clicks before new conversations
@@ -466,7 +498,9 @@ export function ConversationPanel({
// *visible* rows (filtered out by the active scope, or deduped as overlap),
// so the list does not appear to grow. We capture the visible count at click
// time and keep fetching pages — once the query is idle — until the visible
- // count actually increases or there are no more pages.
+ // count actually increases or there are no more pages. `loadedPageCount`
+ // keeps the driver advancing when a grouped page contains only folders that
+ // were already discovered, leaving every other effect dependency unchanged.
const [loadMoreFloor, setLoadMoreFloor] = React.useState<number | null>(null);
const visibleCountRef = React.useRef(visibleCount);
visibleCountRef.current = visibleCount;
@@ -486,20 +520,22 @@ export function ConversationPanel({
setLoadMoreFloor(null);
return;
}
+ // Wait for any in-flight fetch (including the background refetch) to settle
+ // before evaluating `hasNextPage`; React Query may transiently clear that
+ // flag while replacing the last page.
+ if (isFetching || isFetchingNextPage) {
+ return;
+ }
// Nothing more to fetch — stop waiting even if the list did not grow.
if (!hasNextPage) {
setLoadMoreFloor(null);
return;
}
- // Wait for any in-flight fetch (including the background refetch) to settle
- // before requesting the next page, otherwise the request is dropped.
- if (isFetching || isFetchingNextPage) {
- return;
- }
fetchNextPage();
}, [
loadMoreFloor,
visibleCount,
+ loadedPageCount,
hasNextPage,
isFetching,
isFetchingNextPage,
@@ -518,17 +554,15 @@ export function ConversationPanel({
// pagination, which previously caused the panel to feel like it had stray
// scrollable space at the bottom.
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 (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 || emptyDueToAutomationFilter);
+ // Compact mode also hides "Load more" — paginating into stale conversations
+ // contradicts the "active only" intent of the icon rail.
+ // Availability tracks backend exhaustion, never visible emptiness: a
+ // client-side filter (archiving, the automation filter) can hide every row
+ // of the loaded pages, and hiding the control there would strand the
+ // remaining pages behind an empty-state message with no way forward.
+ // `requestLoadMore`'s floor driver keeps paging until a visible row
+ // appears, so a single click walks past pages that are entirely filtered.
+ const showLoadMore = !!hasNextPage && !olderHidden && !compact;
const { mutate: createConversation } = useCreateConversation();
const isCreatingConversationFlow = useIsCreatingConversation();
@@ -561,6 +595,24 @@ export function ConversationPanel({
[],
);
+ const handleArchiveProject = React.useCallback(
+ (conversationId: string, title: string) => {
+ setConfirmArchiveModalVisible(true);
+ setSelectedConversationId(conversationId);
+ setSelectedConversationTitle(title);
+ },
+ [],
+ );
+
+ // Unarchiving needs no confirmation: it restores a row the user can archive
+ // again in one click, and nothing about the conversation itself changes.
+ const handleUnarchiveProject = React.useCallback(
+ (conversationId: string) => {
+ removeArchivedConversation(activeBackend.id, conversationId);
+ },
+ [activeBackend.id, removeArchivedConversation],
+ );
+
const handleStopConversation = React.useCallback((conversationId: string) => {
setConfirmStopModalVisible(true);
setSelectedConversationId(conversationId);
@@ -582,11 +634,13 @@ export function ConversationPanel({
const handleConfirmDelete = () => {
if (selectedConversationId) {
+ const conversationId = selectedConversationId;
deleteConversation(
- { conversationId: selectedConversationId },
+ { conversationId },
{
onSuccess: () => {
- if (selectedConversationId === currentConversationId) {
+ removeArchivedConversation(activeBackend.id, conversationId);
+ if (conversationId === currentConversationId) {
navigate("/conversations");
}
},
@@ -595,6 +649,17 @@ export function ConversationPanel({
}
};
+ const handleConfirmArchive = () => {
+ if (!selectedConversationId) {
+ return;
+ }
+ archiveConversation(activeBackend.id, selectedConversationId);
+ unpinConversation(activeBackend.id, selectedConversationId);
+ if (selectedConversationId === currentConversationId) {
+ navigate("/conversations");
+ }
+ };
+
const handleConfirmStop = () => {
if (selectedConversationId) {
pauseConversation({
@@ -604,7 +669,10 @@ export function ConversationPanel({
};
const handleConfirmDeleteAll = async () => {
- const idsToDelete = conversations.map((c) => c.id);
+ // Delete against the unfiltered loaded set so archived (currently hidden)
+ // conversations are still removed from the server — matching the action's
+ // "delete all conversations" label and confirmation count.
+ const idsToDelete = allLoadedConversations.map((c) => c.id);
const results = await Promise.allSettled(
idsToDelete.map((conversationId) =>
deleteConversationAsync({ conversationId }),
@@ -616,6 +684,10 @@ export function ConversationPanel({
);
const failedCount = results.length - deletedIds.length;
+ for (const conversationId of deletedIds) {
+ removeArchivedConversation(activeBackend.id, conversationId);
+ }
+
if (
currentConversationId !== null &&
deletedIds.includes(currentConversationId)
@@ -636,6 +708,7 @@ export function ConversationPanel({
options?: { inPinnedSection?: boolean },
) => {
const isPinned = pinnedIds.includes(conversation.id);
+ const isArchived = archivedIdSet.has(conversation.id);
if (compact) {
return (
<CompactConversationRow
@@ -716,6 +789,22 @@ export function ConversationPanel({
onDelete={() =>
handleDeleteProject(conversation.id, conversation.title ?? "")
}
+ // Exactly one direction is offered per row, so the menu always
+ // reflects the conversation's current archived state.
+ onArchive={
+ isArchived
+ ? undefined
+ : () =>
+ handleArchiveProject(
+ conversation.id,
+ conversation.title ?? "",
+ )
+ }
+ onUnarchive={
+ isArchived
+ ? () => handleUnarchiveProject(conversation.id)
+ : undefined
+ }
onStop={() => handleStopConversation(conversation.id)}
onChangeTitle={(title) =>
handleConversationTitleChange(conversation.id, title)
@@ -747,6 +836,7 @@ export function ConversationPanel({
acpServer={conversation.acp_server}
tags={conversation.tags}
showTags={showTagsMetadata}
+ isArchived={isArchived}
isPinned={isPinned}
onTogglePin={() => togglePin(activeBackend.id, conversation.id)}
alwaysShowPinIcon={isPinned && !options?.inPinnedSection}
@@ -757,11 +847,14 @@ export function ConversationPanel({
},
[
activeBackend.id,
+ archivedIdSet,
compact,
currentConversationId,
+ handleArchiveProject,
handleConversationTitleChange,
handleDeleteProject,
handleStopConversation,
+ handleUnarchiveProject,
onClose,
openContextMenuId,
pinnedIds,
@@ -836,6 +929,10 @@ export function ConversationPanel({
onToggleAutomationName={toggleAutomationName}
automationNameFacets={automationNameFacets}
showOlderConversations={showOlderConversations}
+ showArchivedConversations={showArchivedConversations}
+ toggleShowArchivedConversations={
+ toggleShowArchivedConversations
+ }
toggleShowOlderConversations={toggleShowOlderConversations}
showRepoBranchMetadata={showRepoBranchMetadata}
toggleShowRepoBranchMetadata={toggleShowRepoBranchMetadata}
@@ -845,7 +942,7 @@ export function ConversationPanel({
toggleShowTagsMetadata={toggleShowTagsMetadata}
showHoverMetadata={showHoverMetadata}
toggleShowHoverMetadata={toggleShowHoverMetadata}
- totalConversationsCount={conversations.length}
+ totalConversationsCount={allLoadedConversations.length}
onRequestDeleteAll={() => setConfirmDeleteAllVisible(true)}
/>
</div>
@@ -987,11 +1084,26 @@ export function ConversationPanel({
/>
)}
+ {confirmArchiveModalVisible && (
+ <ConfirmArchiveModal
+ onConfirm={() => {
+ handleConfirmArchive();
+ setConfirmArchiveModalVisible(false);
+ setSelectedConversationTitle(null);
+ }}
+ onCancel={() => {
+ setConfirmArchiveModalVisible(false);
+ setSelectedConversationTitle(null);
+ }}
+ conversationTitle={selectedConversationTitle ?? undefined}
+ />
+ )}
+
{confirmDeleteAllVisible && (
<ConfirmDeleteModal
title={t(I18nKey.CONVERSATION$CONFIRM_DELETE_ALL_TITLE)}
description={t(I18nKey.CONVERSATION$CONFIRM_DELETE_ALL_DESC, {
- count: conversations.length,
+ count: allLoadedConversations.length,
})}
onConfirm={async () => {
await handleConfirmDeleteAll();
diff --git a/src/components/shared/modals/confirmation-modals/base-modal.tsx b/src/components/shared/modals/confirmation-modals/base-modal.tsx
index 7a2a2ac410..64b340686b 100644
--- a/src/components/shared/modals/confirmation-modals/base-modal.tsx
+++ b/src/components/shared/modals/confirmation-modals/base-modal.tsx
@@ -34,7 +34,7 @@ export function BaseModalDescription({
children,
}: BaseModalDescriptionProps) {
return (
- <span className="text-xs text-modal-muted">{children || description}</span>
+ <span className="text-sm text-modal-muted">{children || description}</span>
);
}
diff --git a/src/i18n/translation.json b/src/i18n/translation.json
index 789849d3f0..d32b2f9822 100644
--- a/src/i18n/translation.json
+++ b/src/i18n/translation.json
@@ -17968,6 +17968,23 @@
"tr": "İlgili (etkin)",
"uk": "Релевантні (активні)"
},
+ "CONVERSATION_PANEL$SHOW_ARCHIVED": {
+ "en": "Show archived",
+ "ja": "アーカイブを表示",
+ "zh-CN": "显示已归档",
+ "zh-TW": "顯示已封存",
+ "ko-KR": "보관된 항목 표시",
+ "no": "Vis arkiverte",
+ "it": "Mostra archiviate",
+ "pt": "Mostrar arquivadas",
+ "es": "Mostrar archivadas",
+ "ar": "إظهار المؤرشفة",
+ "fr": "Afficher les archivées",
+ "tr": "Arşivlenenleri göster",
+ "de": "Archivierte anzeigen",
+ "uk": "Показати архівовані",
+ "ca": "Mostra les arxivades"
+ },
"CONVERSATION_PANEL$METADATA": {
"en": "Metadata",
"ja": "メタデータ",
@@ -36702,6 +36719,108 @@
"uk": "Переглянути примітки до випуску",
"ca": "Mostra les notes de la versió"
},
+ "CONVERSATION$CONFIRM_ARCHIVE": {
+ "en": "Archive conversation",
+ "ja": "会話をアーカイブ",
+ "zh-CN": "归档对话",
+ "zh-TW": "封存對話",
+ "ko-KR": "대화 보관",
+ "no": "Arkiver samtale",
+ "it": "Archivia conversazione",
+ "pt": "Arquivar conversa",
+ "es": "Archivar conversación",
+ "ar": "أرشفة المحادثة",
+ "fr": "Archiver la conversation",
+ "tr": "Konuşmayı arşivle",
+ "de": "Gespräch archivieren",
+ "uk": "Архівувати розмову",
+ "ca": "Arxiva la conversa"
+ },
+ "CONVERSATION$ARCHIVE_WARNING": {
+ "en": "The conversation stays available with its full history and can be restored from Show archived.",
+ "ja": "会話は全履歴とともに保持され、「アーカイブを表示」から復元できます。",
+ "zh-CN": "该对话及其完整历史记录将保留,可通过“显示已归档”恢复。",
+ "zh-TW": "該對話及其完整歷史記錄會保留,可透過「顯示已封存」還原。",
+ "ko-KR": "대화는 전체 기록과 함께 유지되며 \"보관된 항목 표시\"에서 복원할 수 있습니다.",
+ "no": "Samtalen beholdes med hele historikken og kan gjenopprettes fra «Vis arkiverte».",
+ "it": "La conversazione resta disponibile con tutta la cronologia e può essere ripristinata da \"Mostra archiviate\".",
+ "pt": "A conversa permanece disponível com todo o histórico e pode ser restaurada em \"Mostrar arquivadas\".",
+ "es": "La conversación se mantiene con todo su historial y puede restaurarse desde \"Mostrar archivadas\".",
+ "ar": "تبقى المحادثة متاحة مع سجلها الكامل ويمكن استعادتها من \"إظهار المؤرشفة\".",
+ "fr": "La conversation est conservée avec tout son historique et peut être restaurée depuis « Afficher les archivées ».",
+ "tr": "Konuşma tüm geçmişiyle birlikte saklanır ve \"Arşivlenenleri göster\" ile geri yüklenebilir.",
+ "de": "Das Gespräch bleibt mit seinem vollständigen Verlauf erhalten und kann über „Archivierte anzeigen“ wiederhergestellt werden.",
+ "uk": "Розмова зберігається з усією історією, і її можна відновити через «Показати архівовані».",
+ "ca": "La conversa es manté amb tot l'historial i es pot restaurar des de \"Mostra les arxivades\"."
+ },
+ "CONVERSATION$ARCHIVE_WARNING_WITH_TITLE": {
+ "en": "Archive \"<title>{{title}}</title>\"? The conversation stays available with its full history and can be restored from Show archived.",
+ "ja": "「<title>{{title}}</title>」をアーカイブしますか?会話は全履歴とともに保持され、「アーカイブを表示」から復元できます。",
+ "zh-CN": "要归档“<title>{{title}}</title>”吗?该对话及其完整历史记录将保留,可通过“显示已归档”恢复。",
+ "zh-TW": "要封存「<title>{{title}}</title>」嗎?該對話及其完整歷史記錄會保留,可透過「顯示已封存」還原。",
+ "ko-KR": "\"<title>{{title}}</title>\"을(를) 보관하시겠습니까? 대화는 전체 기록과 함께 유지되며 \"보관된 항목 표시\"에서 복원할 수 있습니다.",
+ "no": "Vil du arkivere «<title>{{title}}</title>»? Samtalen beholdes med hele historikken og kan gjenopprettes fra «Vis arkiverte».",
+ "it": "Archiviare \"<title>{{title}}</title>\"? La conversazione resta disponibile con tutta la cronologia e può essere ripristinata da \"Mostra archiviate\".",
+ "pt": "Arquivar \"<title>{{title}}</title>\"? A conversa permanece disponível com todo o histórico e pode ser restaurada em \"Mostrar arquivadas\".",
+ "es": "¿Archivar \"<title>{{title}}</title>\"? La conversación se mantiene con todo su historial y puede restaurarse desde \"Mostrar archivadas\".",
+ "ar": "أرشفة \"<title>{{title}}</title>\"؟ تبقى المحادثة متاحة مع سجلها الكامل ويمكن استعادتها من \"إظهار المؤرشفة\".",
+ "fr": "Archiver « <title>{{title}}</title> » ? La conversation est conservée avec tout son historique et peut être restaurée depuis « Afficher les archivées ».",
+ "tr": "\"<title>{{title}}</title>\" arşivlensin mi? Konuşma tüm geçmişiyle birlikte saklanır ve \"Arşivlenenleri göster\" ile geri yüklenebilir.",
+ "de": "„<title>{{title}}</title>“ archivieren? Das Gespräch bleibt mit seinem vollständigen Verlauf erhalten und kann über „Archivierte anzeigen“ wiederhergestellt werden.",
+ "uk": "Архівувати «<title>{{title}}</title>»? Розмова зберігається з усією історією, і її можна відновити через «Показати архівовані».",
+ "ca": "Vols arxivar \"<title>{{title}}</title>\"? La conversa es manté amb tot l'historial i es pot restaurar des de \"Mostra les arxivades\"."
+ },
+ "ACTION$CONFIRM_ARCHIVE": {
+ "en": "Archive",
+ "ja": "アーカイブ",
+ "zh-CN": "归档",
+ "zh-TW": "封存",
+ "ko-KR": "보관",
+ "fr": "Archiver",
+ "es": "Archivar",
+ "de": "Archivieren",
+ "it": "Archivia",
+ "pt": "Arquivar",
+ "ar": "أرشفة",
+ "no": "Arkiver",
+ "tr": "Arşivle",
+ "uk": "Архівувати",
+ "ca": "Arxiva"
+ },
+ "COMMON$ARCHIVE_CONVERSATION": {
+ "en": "Archive Conversation",
+ "ja": "会話をアーカイブ",
+ "zh-CN": "归档对话",
+ "zh-TW": "封存對話",
+ "ko-KR": "대화 보관",
+ "no": "Arkiver samtale",
+ "it": "Archivia conversazione",
+ "pt": "Arquivar conversa",
+ "es": "Archivar conversación",
+ "ar": "أرشفة المحادثة",
+ "fr": "Archiver la conversation",
+ "tr": "Konuşmayı Arşivle",
+ "de": "Gespräch archivieren",
+ "uk": "Архівувати розмову",
+ "ca": "Arxiva la conversa"
+ },
+ "COMMON$UNARCHIVE_CONVERSATION": {
+ "en": "Unarchive Conversation",
+ "ja": "会話のアーカイブを解除",
+ "zh-CN": "取消归档对话",
+ "zh-TW": "取消封存對話",
+ "ko-KR": "대화 보관 취소",
+ "no": "Gjenopprett samtale",
+ "it": "Ripristina conversazione",
+ "pt": "Desarquivar conversa",
+ "es": "Desarchivar conversación",
+ "ar": "إلغاء أرشفة المحادثة",
+ "fr": "Désarchiver la conversation",
+ "tr": "Konuşmayı Arşivden Çıkar",
+ "de": "Gespräch wiederherstellen",
+ "uk": "Розархівувати розмову",
+ "ca": "Desarxiva la conversa"
+ },
"BUTTON$CONTINUE": {
"en": "Continue",
"ja": "続ける",
diff --git a/src/stores/archived-conversations-store.ts b/src/stores/archived-conversations-store.ts
new file mode 100644
index 0000000000..6ef9aa83f3
--- /dev/null
+++ b/src/stores/archived-conversations-store.ts
@@ -0,0 +1,84 @@
+import { create } from "zustand";
+import { persist, createJSONStorage } from "zustand/middleware";
+
+export const ARCHIVED_CONVERSATIONS_STORAGE_KEY = "archived-conversations";
+
+interface ArchivedConversationsState {
+ archivesByBackendId: Record<string, string[]>;
+}
+
+interface ArchivedConversationsActions {
+ archiveConversation: (backendId: string, conversationId: string) => void;
+ removeArchivedConversation: (
+ backendId: string,
+ conversationId: string,
+ ) => void;
+ isArchived: (backendId: string, conversationId: string) => boolean;
+}
+
+type ArchivedConversationsStore = ArchivedConversationsState &
+ ArchivedConversationsActions;
+
+const initialState: ArchivedConversationsState = {
+ archivesByBackendId: {},
+};
+
+function getArchivesForBackend(
+ archivesByBackendId: Record<string, string[]>,
+ backendId: string,
+): string[] {
+ return archivesByBackendId[backendId] ?? [];
+}
+
+export const useArchivedConversationsStore =
+ create<ArchivedConversationsStore>()(
+ persist(
+ (set, get) => ({
+ ...initialState,
+
+ archiveConversation: (backendId, conversationId) => {
+ const current = getArchivesForBackend(
+ get().archivesByBackendId,
+ backendId,
+ );
+ if (current.includes(conversationId)) {
+ return;
+ }
+ set((state) => ({
+ archivesByBackendId: {
+ ...state.archivesByBackendId,
+ [backendId]: [conversationId, ...current],
+ },
+ }));
+ },
+
+ removeArchivedConversation: (backendId, conversationId) => {
+ const current = getArchivesForBackend(
+ get().archivesByBackendId,
+ backendId,
+ );
+ if (!current.includes(conversationId)) {
+ return;
+ }
+ set((state) => ({
+ archivesByBackendId: {
+ ...state.archivesByBackendId,
+ [backendId]: current.filter((id) => id !== conversationId),
+ },
+ }));
+ },
+
+ isArchived: (backendId, conversationId) =>
+ getArchivesForBackend(get().archivesByBackendId, backendId).includes(
+ conversationId,
+ ),
+ }),
+ {
+ name: ARCHIVED_CONVERSATIONS_STORAGE_KEY,
+ storage: createJSONStorage(() => localStorage),
+ partialize: (state): ArchivedConversationsState => ({
+ archivesByBackendId: state.archivesByBackendId,
+ }),
+ },
+ ),
+ );
diff --git a/src/stores/conversation-panel-preferences-store.ts b/src/stores/conversation-panel-preferences-store.ts
index 383f97bb39..5a7242220c 100644
--- a/src/stores/conversation-panel-preferences-store.ts
+++ b/src/stores/conversation-panel-preferences-store.ts
@@ -22,6 +22,7 @@ import {
*/
interface ConversationPanelPreferencesState {
showOlderConversations: boolean;
+ showArchivedConversations: boolean;
showRepoBranchMetadata: boolean;
showLlmProfiles: boolean;
showTagsMetadata: boolean;
@@ -37,6 +38,8 @@ interface ConversationPanelPreferencesState {
interface ConversationPanelPreferencesActions {
setShowOlderConversations: (value: boolean) => void;
toggleShowOlderConversations: () => void;
+ setShowArchivedConversations: (value: boolean) => void;
+ toggleShowArchivedConversations: () => void;
setShowRepoBranchMetadata: (value: boolean) => void;
toggleShowRepoBranchMetadata: () => void;
setShowLlmProfiles: (value: boolean) => void;
@@ -58,6 +61,7 @@ type ConversationPanelPreferencesStore = ConversationPanelPreferencesState &
const initialState: ConversationPanelPreferencesState = {
showOlderConversations: true,
+ showArchivedConversations: false,
showRepoBranchMetadata: false,
showLlmProfiles: false,
showTagsMetadata: false,
@@ -83,6 +87,13 @@ export const useConversationPanelPreferencesStore =
showOlderConversations: !state.showOlderConversations,
})),
+ setShowArchivedConversations: (value) =>
+ set(() => ({ showArchivedConversations: value })),
+ toggleShowArchivedConversations: () =>
+ set((state) => ({
+ showArchivedConversations: !state.showArchivedConversations,
+ })),
+
setShowRepoBranchMetadata: (value) =>
set(() => ({ showRepoBranchMetadata: value })),
toggleShowRepoBranchMetadata: () =>
@@ -135,6 +146,7 @@ export const useConversationPanelPreferencesStore =
// Only persist the data fields — actions are recreated on each load.
partialize: (state): ConversationPanelPreferencesState => ({
showOlderConversations: state.showOlderConversations,
+ showArchivedConversations: state.showArchivedConversations,
showRepoBranchMetadata: state.showRepoBranchMetadata,
showLlmProfiles: state.showLlmProfiles,
showTagsMetadata: state.showTagsMetadata,